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.101.0", strlen("v0.0.101.0"));
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_Trace;
458 case 1: return LDKLevel_Debug;
459 case 2: return LDKLevel_Info;
460 case 3: return LDKLevel_Warn;
461 case 4: return LDKLevel_Error;
465 static jclass Level_class = NULL;
466 static jfieldID Level_LDKLevel_Trace = NULL;
467 static jfieldID Level_LDKLevel_Debug = NULL;
468 static jfieldID Level_LDKLevel_Info = NULL;
469 static jfieldID Level_LDKLevel_Warn = NULL;
470 static jfieldID Level_LDKLevel_Error = NULL;
471 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
472 Level_class = (*env)->NewGlobalRef(env, clz);
473 CHECK(Level_class != NULL);
474 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
475 CHECK(Level_LDKLevel_Trace != NULL);
476 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Debug != NULL);
478 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Info != 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_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
483 CHECK(Level_LDKLevel_Error != NULL);
485 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
488 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
490 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
496 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
501 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
502 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
503 case 0: return LDKNetwork_Bitcoin;
504 case 1: return LDKNetwork_Testnet;
505 case 2: return LDKNetwork_Regtest;
506 case 3: return LDKNetwork_Signet;
510 static jclass Network_class = NULL;
511 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
512 static jfieldID Network_LDKNetwork_Testnet = NULL;
513 static jfieldID Network_LDKNetwork_Regtest = NULL;
514 static jfieldID Network_LDKNetwork_Signet = NULL;
515 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
516 Network_class = (*env)->NewGlobalRef(env, clz);
517 CHECK(Network_class != NULL);
518 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
519 CHECK(Network_LDKNetwork_Bitcoin != NULL);
520 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
521 CHECK(Network_LDKNetwork_Testnet != NULL);
522 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
523 CHECK(Network_LDKNetwork_Regtest != NULL);
524 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
525 CHECK(Network_LDKNetwork_Signet != NULL);
527 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
529 case LDKNetwork_Bitcoin:
530 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
531 case LDKNetwork_Testnet:
532 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
533 case LDKNetwork_Regtest:
534 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
535 case LDKNetwork_Signet:
536 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
541 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
542 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
543 case 0: return LDKSecp256k1Error_IncorrectSignature;
544 case 1: return LDKSecp256k1Error_InvalidMessage;
545 case 2: return LDKSecp256k1Error_InvalidPublicKey;
546 case 3: return LDKSecp256k1Error_InvalidSignature;
547 case 4: return LDKSecp256k1Error_InvalidSecretKey;
548 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
549 case 6: return LDKSecp256k1Error_InvalidTweak;
550 case 7: return LDKSecp256k1Error_TweakCheckFailed;
551 case 8: return LDKSecp256k1Error_NotEnoughMemory;
555 static jclass Secp256k1Error_class = NULL;
556 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
557 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
558 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
559 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
560 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
561 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
565 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
566 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
567 CHECK(Secp256k1Error_class != NULL);
568 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
569 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
570 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
571 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
572 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
573 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
574 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
580 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
582 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
584 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
585 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
587 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
589 case LDKSecp256k1Error_IncorrectSignature:
590 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
591 case LDKSecp256k1Error_InvalidMessage:
592 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
593 case LDKSecp256k1Error_InvalidPublicKey:
594 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
595 case LDKSecp256k1Error_InvalidSignature:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
597 case LDKSecp256k1Error_InvalidSecretKey:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
599 case LDKSecp256k1Error_InvalidRecoveryId:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
601 case LDKSecp256k1Error_InvalidTweak:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
603 case LDKSecp256k1Error_TweakCheckFailed:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
605 case LDKSecp256k1Error_NotEnoughMemory:
606 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
611 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
612 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
613 case 0: return LDKSemanticError_NoPaymentHash;
614 case 1: return LDKSemanticError_MultiplePaymentHashes;
615 case 2: return LDKSemanticError_NoDescription;
616 case 3: return LDKSemanticError_MultipleDescriptions;
617 case 4: return LDKSemanticError_NoPaymentSecret;
618 case 5: return LDKSemanticError_MultiplePaymentSecrets;
619 case 6: return LDKSemanticError_InvalidFeatures;
620 case 7: return LDKSemanticError_InvalidRecoveryId;
621 case 8: return LDKSemanticError_InvalidSignature;
622 case 9: return LDKSemanticError_ImpreciseAmount;
626 static jclass SemanticError_class = NULL;
627 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
628 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
629 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
630 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
631 static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
633 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
634 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
635 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
636 static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
637 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
638 SemanticError_class = (*env)->NewGlobalRef(env, clz);
639 CHECK(SemanticError_class != NULL);
640 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
642 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
644 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
646 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
648 SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != 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);
658 SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
659 CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
661 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
663 case LDKSemanticError_NoPaymentHash:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
665 case LDKSemanticError_MultiplePaymentHashes:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
667 case LDKSemanticError_NoDescription:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
669 case LDKSemanticError_MultipleDescriptions:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
671 case LDKSemanticError_NoPaymentSecret:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
673 case LDKSemanticError_MultiplePaymentSecrets:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
675 case LDKSemanticError_InvalidFeatures:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
677 case LDKSemanticError_InvalidRecoveryId:
678 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
679 case LDKSemanticError_InvalidSignature:
680 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
681 case LDKSemanticError_ImpreciseAmount:
682 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
687 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
688 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
689 case 0: return LDKSiPrefix_Milli;
690 case 1: return LDKSiPrefix_Micro;
691 case 2: return LDKSiPrefix_Nano;
692 case 3: return LDKSiPrefix_Pico;
696 static jclass SiPrefix_class = NULL;
697 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
698 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
699 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
700 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
701 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
702 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
703 CHECK(SiPrefix_class != NULL);
704 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
706 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
707 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
708 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
709 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
710 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
711 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
713 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
715 case LDKSiPrefix_Milli:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
717 case LDKSiPrefix_Micro:
718 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
719 case LDKSiPrefix_Nano:
720 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
721 case LDKSiPrefix_Pico:
722 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
728 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
729 ret->datalen = (*env)->GetArrayLength(env, elems);
730 if (ret->datalen == 0) {
733 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
734 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
735 for (size_t i = 0; i < ret->datalen; i++) {
736 ret->data[i] = java_elems[i];
738 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
740 return (uint64_t)ret;
742 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
743 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
744 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
747 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) { return CVec_u8Z_clone(&thing->script_pubkey);}JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t thing) {
748 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
749 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
750 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
751 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
752 CVec_u8Z_free(ret_var);
756 uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t thing) {
757 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
758 int64_t ret_val = TxOut_get_value(thing_conv);
762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
763 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
766 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
767 CHECK(val->result_ok);
768 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
769 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
772 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
773 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
774 CHECK(!val->result_ok);
775 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
779 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
782 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
783 CHECK(val->result_ok);
784 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
785 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
788 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
789 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
790 CHECK(!val->result_ok);
791 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
795 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
798 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
799 CHECK(val->result_ok);
800 LDKTxCreationKeys 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_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
807 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(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_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
816 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
819 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
820 CHECK(val->result_ok);
821 LDKChannelPublicKeys 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 int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
828 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
829 CHECK(!val->result_ok);
830 LDKDecodeError err_var = (*val->contents.err);
831 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
832 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
833 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
837 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
840 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
841 CHECK(val->result_ok);
842 LDKTxCreationKeys res_var = (*val->contents.result);
843 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
844 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
845 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
848 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
849 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
850 CHECK(!val->result_ok);
851 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
854 static jclass LDKCOption_u32Z_Some_class = NULL;
855 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
856 static jclass LDKCOption_u32Z_None_class = NULL;
857 static jmethodID LDKCOption_u32Z_None_meth = NULL;
858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
859 LDKCOption_u32Z_Some_class =
860 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
861 CHECK(LDKCOption_u32Z_Some_class != NULL);
862 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
863 CHECK(LDKCOption_u32Z_Some_meth != NULL);
864 LDKCOption_u32Z_None_class =
865 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
866 CHECK(LDKCOption_u32Z_None_class != NULL);
867 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
868 CHECK(LDKCOption_u32Z_None_meth != NULL);
870 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
871 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
873 case LDKCOption_u32Z_Some: {
874 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
876 case LDKCOption_u32Z_None: {
877 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
883 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
886 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
887 CHECK(val->result_ok);
888 LDKHTLCOutputInCommitment 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_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
895 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(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_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
904 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
907 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
908 CHECK(val->result_ok);
909 LDKCounterpartyChannelTransactionParameters 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_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
916 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(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_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
925 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
928 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
929 CHECK(val->result_ok);
930 LDKChannelTransactionParameters 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_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
937 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(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_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
946 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
949 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
950 CHECK(val->result_ok);
951 LDKHolderCommitmentTransaction 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_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
958 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(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_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
967 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
970 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
971 CHECK(val->result_ok);
972 LDKBuiltCommitmentTransaction 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_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
979 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(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_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
988 return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
991 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
992 CHECK(val->result_ok);
993 LDKTrustedClosingTransaction 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_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1000 LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
1001 CHECK(!val->result_ok);
1002 return *val->contents.err;
1004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1008 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1009 CHECK(val->result_ok);
1010 LDKCommitmentTransaction res_var = (*val->contents.result);
1011 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1012 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1013 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1017 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1018 CHECK(!val->result_ok);
1019 LDKDecodeError err_var = (*val->contents.err);
1020 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1022 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1026 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1029 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1030 CHECK(val->result_ok);
1031 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1032 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1033 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1034 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1038 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1039 CHECK(!val->result_ok);
1040 return *val->contents.err;
1042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1045 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1046 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1047 CHECK(val->result_ok);
1048 LDKCVec_SignatureZ res_var = (*val->contents.result);
1049 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1051 for (size_t i = 0; i < res_var.datalen; i++) {
1052 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1053 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1054 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1059 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1060 CHECK(!val->result_ok);
1061 return *val->contents.err;
1063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1064 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1067 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1068 CHECK(val->result_ok);
1069 LDKShutdownScript res_var = (*val->contents.result);
1070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1076 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1077 CHECK(!val->result_ok);
1078 LDKDecodeError err_var = (*val->contents.err);
1079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1085 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1088 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1089 CHECK(val->result_ok);
1090 LDKShutdownScript res_var = (*val->contents.result);
1091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1097 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1098 CHECK(!val->result_ok);
1099 LDKInvalidShutdownScript err_var = (*val->contents.err);
1100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1106 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1109 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1110 CHECK(val->result_ok);
1111 return *val->contents.result;
1113 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1114 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1115 CHECK(!val->result_ok);
1116 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1120 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1123 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1124 CHECK(val->result_ok);
1125 LDKRouteHop res_var = (*val->contents.result);
1126 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1127 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1128 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1132 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1133 CHECK(!val->result_ok);
1134 LDKDecodeError err_var = (*val->contents.err);
1135 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1136 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1137 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1141 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1142 ret->datalen = (*env)->GetArrayLength(env, elems);
1143 if (ret->datalen == 0) {
1146 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1147 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1148 for (size_t i = 0; i < ret->datalen; i++) {
1149 int64_t arr_elem = java_elems[i];
1150 LDKRouteHop arr_elem_conv;
1151 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1152 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1153 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1154 ret->data[i] = arr_elem_conv;
1156 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1158 return (uint64_t)ret;
1160 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1161 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1162 for (size_t i = 0; i < ret.datalen; i++) {
1163 ret.data[i] = RouteHop_clone(&orig->data[i]);
1167 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1168 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1169 for (size_t i = 0; i < ret.datalen; i++) {
1170 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1175 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1178 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1179 CHECK(val->result_ok);
1180 LDKRoute res_var = (*val->contents.result);
1181 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1182 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1183 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1187 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1188 CHECK(!val->result_ok);
1189 LDKDecodeError err_var = (*val->contents.err);
1190 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1191 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1192 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1195 static jclass LDKCOption_u64Z_Some_class = NULL;
1196 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1197 static jclass LDKCOption_u64Z_None_class = NULL;
1198 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1200 LDKCOption_u64Z_Some_class =
1201 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1202 CHECK(LDKCOption_u64Z_Some_class != NULL);
1203 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1204 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1205 LDKCOption_u64Z_None_class =
1206 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1207 CHECK(LDKCOption_u64Z_None_class != NULL);
1208 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1209 CHECK(LDKCOption_u64Z_None_meth != NULL);
1211 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1212 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1214 case LDKCOption_u64Z_Some: {
1215 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1217 case LDKCOption_u64Z_None: {
1218 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1224 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1225 ret->datalen = (*env)->GetArrayLength(env, elems);
1226 if (ret->datalen == 0) {
1229 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1230 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1231 for (size_t i = 0; i < ret->datalen; i++) {
1232 int64_t arr_elem = java_elems[i];
1233 LDKChannelDetails arr_elem_conv;
1234 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1235 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1236 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1237 ret->data[i] = arr_elem_conv;
1239 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1241 return (uint64_t)ret;
1243 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1244 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1245 for (size_t i = 0; i < ret.datalen; i++) {
1246 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1251 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1252 ret->datalen = (*env)->GetArrayLength(env, elems);
1253 if (ret->datalen == 0) {
1256 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1257 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1258 for (size_t i = 0; i < ret->datalen; i++) {
1259 int64_t arr_elem = java_elems[i];
1260 LDKRouteHint arr_elem_conv;
1261 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1262 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1263 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1264 ret->data[i] = arr_elem_conv;
1266 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1268 return (uint64_t)ret;
1270 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1271 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1272 for (size_t i = 0; i < ret.datalen; i++) {
1273 ret.data[i] = RouteHint_clone(&orig->data[i]);
1277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1278 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1281 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1282 CHECK(val->result_ok);
1283 LDKRoute res_var = (*val->contents.result);
1284 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1285 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1286 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1290 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1291 CHECK(!val->result_ok);
1292 LDKLightningError err_var = (*val->contents.err);
1293 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1294 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1295 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1299 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1302 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1303 CHECK(val->result_ok);
1304 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1305 return (uint64_t)res_ref;
1307 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1308 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1309 CHECK(!val->result_ok);
1310 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1314 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1316 LDKTransaction b_ref;
1317 b_ref.datalen = (*env)->GetArrayLength(env, b);
1318 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1319 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1320 b_ref.data_is_owned = false;
1322 return (uint64_t)ret;
1324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1325 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1329 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1330 LDKTransaction b_var = tuple->b;
1331 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1332 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1336 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1337 ret->datalen = (*env)->GetArrayLength(env, elems);
1338 if (ret->datalen == 0) {
1341 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1342 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1343 for (size_t i = 0; i < ret->datalen; i++) {
1344 int64_t arr_elem = java_elems[i];
1345 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1346 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1347 ret->data[i] = arr_elem_conv;
1349 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1351 return (uint64_t)ret;
1353 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1354 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1355 for (size_t i = 0; i < ret.datalen; i++) {
1356 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1360 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1361 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1362 for (size_t i = 0; i < ret.datalen; i++) {
1363 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1368 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1371 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1372 CHECK(val->result_ok);
1373 return *val->contents.result;
1375 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1376 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1377 CHECK(!val->result_ok);
1378 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1381 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1382 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1383 static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
1384 static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
1385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1386 LDKMonitorEvent_HTLCEvent_class =
1387 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1388 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1389 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1390 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1391 LDKMonitorEvent_CommitmentTxConfirmed_class =
1392 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
1393 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
1394 LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
1395 CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
1397 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1398 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1400 case LDKMonitorEvent_HTLCEvent: {
1401 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1402 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1403 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1404 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1405 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1407 case LDKMonitorEvent_CommitmentTxConfirmed: {
1408 LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
1409 CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1410 CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1411 uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
1412 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
1417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1418 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1419 ret->datalen = (*env)->GetArrayLength(env, elems);
1420 if (ret->datalen == 0) {
1423 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1424 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1425 for (size_t i = 0; i < ret->datalen; i++) {
1426 int64_t arr_elem = java_elems[i];
1427 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1428 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1429 ret->data[i] = arr_elem_conv;
1431 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1433 return (uint64_t)ret;
1435 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1436 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1437 for (size_t i = 0; i < ret.datalen; i++) {
1438 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1442 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1443 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1444 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1445 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1447 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1448 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1449 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1450 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1451 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1452 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1453 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1454 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1455 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1456 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1458 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1459 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1461 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1462 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1463 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1465 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1466 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1471 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
1472 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
1473 static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
1474 static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
1475 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
1476 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
1477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
1478 LDKNetworkUpdate_ChannelUpdateMessage_class =
1479 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
1480 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
1481 LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1482 CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
1483 LDKNetworkUpdate_ChannelClosed_class =
1484 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
1485 CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
1486 LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1487 CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
1488 LDKNetworkUpdate_NodeFailure_class =
1489 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
1490 CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
1491 LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
1492 CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
1494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1495 LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
1497 case LDKNetworkUpdate_ChannelUpdateMessage: {
1498 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1499 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1500 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1501 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1502 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
1504 case LDKNetworkUpdate_ChannelClosed: {
1505 return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1507 case LDKNetworkUpdate_NodeFailure: {
1508 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1509 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1510 return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1515 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
1516 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
1517 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
1518 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
1519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
1520 LDKCOption_NetworkUpdateZ_Some_class =
1521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
1522 CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
1523 LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
1524 CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
1525 LDKCOption_NetworkUpdateZ_None_class =
1526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
1527 CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
1528 LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
1529 CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
1531 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1532 LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
1534 case LDKCOption_NetworkUpdateZ_Some: {
1535 uint64_t some_ref = ((uint64_t)&obj->some) | 1;
1536 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
1538 case LDKCOption_NetworkUpdateZ_None: {
1539 return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
1544 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1545 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1546 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1547 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1548 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1549 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1551 LDKSpendableOutputDescriptor_StaticOutput_class =
1552 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1553 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1554 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1555 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1556 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1557 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1558 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1559 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1560 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1561 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1562 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1563 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1564 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1565 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1567 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1568 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1570 case LDKSpendableOutputDescriptor_StaticOutput: {
1571 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1572 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1573 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1574 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1575 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1576 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1578 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1579 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1580 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1583 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1585 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1586 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1587 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1588 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1589 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1590 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1596 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1597 ret->datalen = (*env)->GetArrayLength(env, elems);
1598 if (ret->datalen == 0) {
1601 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1602 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1603 for (size_t i = 0; i < ret->datalen; i++) {
1604 int64_t arr_elem = java_elems[i];
1605 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1606 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1607 ret->data[i] = arr_elem_conv;
1609 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1611 return (uint64_t)ret;
1613 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1614 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1615 for (size_t i = 0; i < ret.datalen; i++) {
1616 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1620 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1621 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1622 static jclass LDKErrorAction_IgnoreError_class = NULL;
1623 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1624 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1625 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1626 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1627 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1629 LDKErrorAction_DisconnectPeer_class =
1630 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1631 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1632 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1633 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1634 LDKErrorAction_IgnoreError_class =
1635 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1636 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1637 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1638 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1639 LDKErrorAction_IgnoreAndLog_class =
1640 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1641 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1642 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1643 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1644 LDKErrorAction_SendErrorMessage_class =
1645 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1646 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1647 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1648 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1650 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1651 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1653 case LDKErrorAction_DisconnectPeer: {
1654 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1655 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1656 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1657 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1658 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1660 case LDKErrorAction_IgnoreError: {
1661 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1663 case LDKErrorAction_IgnoreAndLog: {
1664 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1665 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1667 case LDKErrorAction_SendErrorMessage: {
1668 LDKErrorMessage msg_var = obj->send_error_message.msg;
1669 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1670 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1671 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1672 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1677 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1678 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1679 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1680 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1681 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1682 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1683 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1684 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1685 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1686 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1687 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1688 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1689 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1690 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1691 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1692 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1693 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1694 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1695 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1696 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1697 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1698 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1699 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1700 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1701 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1702 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1703 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1704 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1705 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1706 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1707 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1708 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1709 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1710 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1711 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1712 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1713 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1714 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1716 LDKMessageSendEvent_SendAcceptChannel_class =
1717 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1718 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1719 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1720 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1721 LDKMessageSendEvent_SendOpenChannel_class =
1722 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1723 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1724 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1725 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1726 LDKMessageSendEvent_SendFundingCreated_class =
1727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1728 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1729 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1730 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1731 LDKMessageSendEvent_SendFundingSigned_class =
1732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1733 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1734 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1735 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1736 LDKMessageSendEvent_SendFundingLocked_class =
1737 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1738 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1739 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1740 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1741 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1742 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1743 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1744 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1745 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1746 LDKMessageSendEvent_UpdateHTLCs_class =
1747 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1748 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1749 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1750 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1751 LDKMessageSendEvent_SendRevokeAndACK_class =
1752 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1753 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1754 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1755 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1756 LDKMessageSendEvent_SendClosingSigned_class =
1757 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1758 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1759 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1760 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1761 LDKMessageSendEvent_SendShutdown_class =
1762 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1763 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1764 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1765 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1766 LDKMessageSendEvent_SendChannelReestablish_class =
1767 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1768 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1769 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1770 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1771 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1772 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1773 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1774 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1775 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1776 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1778 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1779 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1780 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1781 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1783 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1784 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1785 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1786 LDKMessageSendEvent_SendChannelUpdate_class =
1787 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1788 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1789 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1790 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1791 LDKMessageSendEvent_HandleError_class =
1792 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1793 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1794 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1795 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1796 LDKMessageSendEvent_SendChannelRangeQuery_class =
1797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1798 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1799 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1800 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1801 LDKMessageSendEvent_SendShortIdsQuery_class =
1802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1803 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1804 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1805 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1806 LDKMessageSendEvent_SendReplyChannelRange_class =
1807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1808 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1809 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1810 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1812 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1813 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1815 case LDKMessageSendEvent_SendAcceptChannel: {
1816 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1817 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1818 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1819 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1820 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1821 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1822 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1824 case LDKMessageSendEvent_SendOpenChannel: {
1825 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1826 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1827 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1828 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1829 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1830 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1831 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1833 case LDKMessageSendEvent_SendFundingCreated: {
1834 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1835 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1836 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1837 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1838 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1839 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1840 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1842 case LDKMessageSendEvent_SendFundingSigned: {
1843 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1844 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1845 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1846 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1847 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1848 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1849 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1851 case LDKMessageSendEvent_SendFundingLocked: {
1852 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1853 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1854 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1855 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1856 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1857 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1858 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1860 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1861 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1862 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1863 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1864 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1865 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1866 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1867 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1869 case LDKMessageSendEvent_UpdateHTLCs: {
1870 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1871 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1872 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1873 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1874 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1875 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1876 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1878 case LDKMessageSendEvent_SendRevokeAndACK: {
1879 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1880 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1881 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1882 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1883 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1884 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1885 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1887 case LDKMessageSendEvent_SendClosingSigned: {
1888 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1889 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1890 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1891 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1892 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1893 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1894 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1896 case LDKMessageSendEvent_SendShutdown: {
1897 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1898 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1899 LDKShutdown msg_var = obj->send_shutdown.msg;
1900 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1901 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1902 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1903 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1905 case LDKMessageSendEvent_SendChannelReestablish: {
1906 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1907 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1908 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1909 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1910 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1911 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1912 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1914 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1915 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1916 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1917 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1918 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1919 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1920 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1921 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1922 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1923 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1925 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1926 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1927 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1928 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1929 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1930 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1932 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1933 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1934 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1935 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1936 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1937 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1939 case LDKMessageSendEvent_SendChannelUpdate: {
1940 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1941 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1942 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1943 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1944 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1945 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1946 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1948 case LDKMessageSendEvent_HandleError: {
1949 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1950 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1951 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1952 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1954 case LDKMessageSendEvent_SendChannelRangeQuery: {
1955 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1956 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1957 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1958 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1959 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1960 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1961 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1963 case LDKMessageSendEvent_SendShortIdsQuery: {
1964 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1965 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1966 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1967 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1970 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1972 case LDKMessageSendEvent_SendReplyChannelRange: {
1973 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1974 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1975 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1976 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1977 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1978 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1979 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1985 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1986 ret->datalen = (*env)->GetArrayLength(env, elems);
1987 if (ret->datalen == 0) {
1990 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1991 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1992 for (size_t i = 0; i < ret->datalen; i++) {
1993 int64_t arr_elem = java_elems[i];
1994 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1995 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1996 ret->data[i] = arr_elem_conv;
1998 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2000 return (uint64_t)ret;
2002 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2003 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2004 for (size_t i = 0; i < ret.datalen; i++) {
2005 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2009 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2010 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2013 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2014 CHECK(val->result_ok);
2015 LDKInitFeatures res_var = (*val->contents.result);
2016 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2017 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2018 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2022 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2023 CHECK(!val->result_ok);
2024 LDKDecodeError err_var = (*val->contents.err);
2025 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2026 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2027 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2031 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2034 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2035 CHECK(val->result_ok);
2036 LDKNodeFeatures res_var = (*val->contents.result);
2037 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2038 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2039 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2043 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2044 CHECK(!val->result_ok);
2045 LDKDecodeError err_var = (*val->contents.err);
2046 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2047 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2048 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2052 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2055 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2056 CHECK(val->result_ok);
2057 LDKChannelFeatures res_var = (*val->contents.result);
2058 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2059 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2060 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2064 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2065 CHECK(!val->result_ok);
2066 LDKDecodeError err_var = (*val->contents.err);
2067 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2068 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2069 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2073 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2076 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2077 CHECK(val->result_ok);
2078 LDKInvoiceFeatures res_var = (*val->contents.result);
2079 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2080 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2081 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2085 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2086 CHECK(!val->result_ok);
2087 LDKDecodeError err_var = (*val->contents.err);
2088 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2089 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2090 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2094 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2097 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2098 CHECK(val->result_ok);
2099 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2100 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2101 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2102 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2106 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2107 CHECK(!val->result_ok);
2108 LDKDecodeError err_var = (*val->contents.err);
2109 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2110 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2111 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2114 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2115 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2118 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2119 CHECK(val->result_ok);
2120 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2121 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2122 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2123 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2127 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2128 CHECK(!val->result_ok);
2129 LDKDecodeError err_var = (*val->contents.err);
2130 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2131 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2132 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2136 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2139 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2140 CHECK(val->result_ok);
2141 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2145 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2146 CHECK(!val->result_ok);
2147 LDKDecodeError err_var = (*val->contents.err);
2148 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2149 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2150 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2154 return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
2156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2157 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2158 CHECK(val->result_ok);
2159 return *val->contents.result;
2161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2162 LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
2163 CHECK(!val->result_ok);
2164 return *val->contents.err;
2166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2167 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2169 CHECK((*env)->GetArrayLength(env, a) == 64);
2170 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2172 LDKCVec_SignatureZ b_constr;
2173 b_constr.datalen = (*env)->GetArrayLength(env, b);
2174 if (b_constr.datalen > 0)
2175 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2177 b_constr.data = NULL;
2178 for (size_t i = 0; i < b_constr.datalen; i++) {
2179 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2180 LDKSignature b_conv_8_ref;
2181 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2182 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2183 b_constr.data[i] = b_conv_8_ref;
2186 return (uint64_t)ret;
2188 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2189 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2190 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2191 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2194 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2195 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2196 LDKCVec_SignatureZ b_var = tuple->b;
2197 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2199 for (size_t i = 0; i < b_var.datalen; i++) {
2200 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2201 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2202 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2207 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2210 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2211 CHECK(val->result_ok);
2212 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2216 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2217 CHECK(!val->result_ok);
2218 return *val->contents.err;
2220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2221 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2224 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2225 CHECK(val->result_ok);
2226 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2227 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2231 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2232 CHECK(!val->result_ok);
2233 return *val->contents.err;
2235 typedef struct LDKBaseSign_JCalls {
2236 atomic_size_t refcnt;
2239 jmethodID get_per_commitment_point_meth;
2240 jmethodID release_commitment_secret_meth;
2241 jmethodID validate_holder_commitment_meth;
2242 jmethodID channel_keys_id_meth;
2243 jmethodID sign_counterparty_commitment_meth;
2244 jmethodID validate_counterparty_revocation_meth;
2245 jmethodID sign_holder_commitment_and_htlcs_meth;
2246 jmethodID sign_justice_revoked_output_meth;
2247 jmethodID sign_justice_revoked_htlc_meth;
2248 jmethodID sign_counterparty_htlc_transaction_meth;
2249 jmethodID sign_closing_transaction_meth;
2250 jmethodID sign_channel_announcement_meth;
2251 jmethodID ready_channel_meth;
2252 } LDKBaseSign_JCalls;
2253 static void LDKBaseSign_JCalls_free(void* this_arg) {
2254 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2255 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2257 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2258 if (get_jenv_res == JNI_EDETACHED) {
2259 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2261 DO_ASSERT(get_jenv_res == JNI_OK);
2263 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2264 if (get_jenv_res == JNI_EDETACHED) {
2265 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2270 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2271 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2273 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2274 if (get_jenv_res == JNI_EDETACHED) {
2275 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2277 DO_ASSERT(get_jenv_res == JNI_OK);
2279 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2281 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2282 if ((*env)->ExceptionCheck(env)) {
2283 (*env)->ExceptionDescribe(env);
2284 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2286 LDKPublicKey ret_ref;
2287 CHECK((*env)->GetArrayLength(env, ret) == 33);
2288 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2289 if (get_jenv_res == JNI_EDETACHED) {
2290 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2294 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2295 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2297 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2298 if (get_jenv_res == JNI_EDETACHED) {
2299 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2301 DO_ASSERT(get_jenv_res == JNI_OK);
2303 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2305 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2306 if ((*env)->ExceptionCheck(env)) {
2307 (*env)->ExceptionDescribe(env);
2308 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2310 LDKThirtyTwoBytes ret_ref;
2311 CHECK((*env)->GetArrayLength(env, ret) == 32);
2312 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2313 if (get_jenv_res == JNI_EDETACHED) {
2314 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2318 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
2319 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2321 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2322 if (get_jenv_res == JNI_EDETACHED) {
2323 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2325 DO_ASSERT(get_jenv_res == JNI_OK);
2327 LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2328 holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
2329 CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2330 CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2331 uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
2332 if (holder_tx_var.is_owned) {
2335 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2337 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
2338 if ((*env)->ExceptionCheck(env)) {
2339 (*env)->ExceptionDescribe(env);
2340 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
2342 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2343 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2344 if (get_jenv_res == JNI_EDETACHED) {
2345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2349 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2350 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2353 if (get_jenv_res == JNI_EDETACHED) {
2354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2356 DO_ASSERT(get_jenv_res == JNI_OK);
2358 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2360 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2361 if ((*env)->ExceptionCheck(env)) {
2362 (*env)->ExceptionDescribe(env);
2363 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2365 LDKThirtyTwoBytes ret_ref;
2366 CHECK((*env)->GetArrayLength(env, ret) == 32);
2367 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2368 if (get_jenv_res == JNI_EDETACHED) {
2369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2373 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2374 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2376 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2377 if (get_jenv_res == JNI_EDETACHED) {
2378 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2380 DO_ASSERT(get_jenv_res == JNI_OK);
2382 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2383 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2384 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2385 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2386 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2387 if (commitment_tx_var.is_owned) {
2388 commitment_tx_ref |= 1;
2390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2392 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2393 if ((*env)->ExceptionCheck(env)) {
2394 (*env)->ExceptionDescribe(env);
2395 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2397 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2398 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2399 if (get_jenv_res == JNI_EDETACHED) {
2400 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2404 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2405 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2407 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2408 if (get_jenv_res == JNI_EDETACHED) {
2409 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2411 DO_ASSERT(get_jenv_res == JNI_OK);
2413 int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
2414 (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
2415 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2417 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
2418 if ((*env)->ExceptionCheck(env)) {
2419 (*env)->ExceptionDescribe(env);
2420 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
2422 LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
2423 ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
2424 if (get_jenv_res == JNI_EDETACHED) {
2425 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2429 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2430 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2432 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2433 if (get_jenv_res == JNI_EDETACHED) {
2434 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2436 DO_ASSERT(get_jenv_res == JNI_OK);
2438 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2439 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2440 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2441 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2442 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2443 if (commitment_tx_var.is_owned) {
2444 commitment_tx_ref |= 1;
2446 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2448 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2449 if ((*env)->ExceptionCheck(env)) {
2450 (*env)->ExceptionDescribe(env);
2451 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2453 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2454 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2455 if (get_jenv_res == JNI_EDETACHED) {
2456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2460 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]) {
2461 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2463 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2464 if (get_jenv_res == JNI_EDETACHED) {
2465 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2467 DO_ASSERT(get_jenv_res == JNI_OK);
2469 LDKTransaction justice_tx_var = justice_tx;
2470 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2471 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2472 Transaction_free(justice_tx_var);
2473 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2474 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2477 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2478 if ((*env)->ExceptionCheck(env)) {
2479 (*env)->ExceptionDescribe(env);
2480 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2482 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2483 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2484 if (get_jenv_res == JNI_EDETACHED) {
2485 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2489 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) {
2490 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2493 if (get_jenv_res == JNI_EDETACHED) {
2494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2496 DO_ASSERT(get_jenv_res == JNI_OK);
2498 LDKTransaction justice_tx_var = justice_tx;
2499 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2500 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2501 Transaction_free(justice_tx_var);
2502 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2503 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2504 LDKHTLCOutputInCommitment htlc_var = *htlc;
2505 htlc_var = HTLCOutputInCommitment_clone(htlc);
2506 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2507 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2508 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2509 if (htlc_var.is_owned) {
2512 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2514 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2515 if ((*env)->ExceptionCheck(env)) {
2516 (*env)->ExceptionDescribe(env);
2517 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2519 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2520 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2521 if (get_jenv_res == JNI_EDETACHED) {
2522 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2526 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) {
2527 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2529 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2530 if (get_jenv_res == JNI_EDETACHED) {
2531 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2533 DO_ASSERT(get_jenv_res == JNI_OK);
2535 LDKTransaction htlc_tx_var = htlc_tx;
2536 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2537 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2538 Transaction_free(htlc_tx_var);
2539 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2540 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2541 LDKHTLCOutputInCommitment htlc_var = *htlc;
2542 htlc_var = HTLCOutputInCommitment_clone(htlc);
2543 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2544 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2545 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2546 if (htlc_var.is_owned) {
2549 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2551 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2552 if ((*env)->ExceptionCheck(env)) {
2553 (*env)->ExceptionDescribe(env);
2554 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2556 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2557 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2558 if (get_jenv_res == JNI_EDETACHED) {
2559 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2563 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2564 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2566 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2567 if (get_jenv_res == JNI_EDETACHED) {
2568 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2570 DO_ASSERT(get_jenv_res == JNI_OK);
2572 LDKClosingTransaction closing_tx_var = *closing_tx;
2573 // Warning: we may need a move here but no clone is available for LDKClosingTransaction
2574 CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2575 CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2576 uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
2577 if (closing_tx_var.is_owned) {
2578 closing_tx_ref |= 1;
2580 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2582 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2583 if ((*env)->ExceptionCheck(env)) {
2584 (*env)->ExceptionDescribe(env);
2585 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2587 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2588 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2589 if (get_jenv_res == JNI_EDETACHED) {
2590 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2594 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2595 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2597 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2598 if (get_jenv_res == JNI_EDETACHED) {
2599 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2601 DO_ASSERT(get_jenv_res == JNI_OK);
2603 LDKUnsignedChannelAnnouncement msg_var = *msg;
2604 msg_var = UnsignedChannelAnnouncement_clone(msg);
2605 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2606 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2607 uint64_t msg_ref = (uint64_t)msg_var.inner;
2608 if (msg_var.is_owned) {
2611 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2613 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2614 if ((*env)->ExceptionCheck(env)) {
2615 (*env)->ExceptionDescribe(env);
2616 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2618 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2619 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2620 if (get_jenv_res == JNI_EDETACHED) {
2621 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2625 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2626 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2628 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2629 if (get_jenv_res == JNI_EDETACHED) {
2630 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2632 DO_ASSERT(get_jenv_res == JNI_OK);
2634 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2635 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2636 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2637 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2638 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2639 if (channel_parameters_var.is_owned) {
2640 channel_parameters_ref |= 1;
2642 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2644 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2645 if ((*env)->ExceptionCheck(env)) {
2646 (*env)->ExceptionDescribe(env);
2647 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2649 if (get_jenv_res == JNI_EDETACHED) {
2650 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2653 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2654 jclass c = (*env)->GetObjectClass(env, o);
2656 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2657 atomic_init(&calls->refcnt, 1);
2658 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2659 calls->o = (*env)->NewWeakGlobalRef(env, o);
2660 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2661 CHECK(calls->get_per_commitment_point_meth != NULL);
2662 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2663 CHECK(calls->release_commitment_secret_meth != NULL);
2664 calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
2665 CHECK(calls->validate_holder_commitment_meth != NULL);
2666 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2667 CHECK(calls->channel_keys_id_meth != NULL);
2668 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2669 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2670 calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
2671 CHECK(calls->validate_counterparty_revocation_meth != NULL);
2672 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2673 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2674 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2675 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2676 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2677 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2678 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2679 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2680 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2681 CHECK(calls->sign_closing_transaction_meth != NULL);
2682 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2683 CHECK(calls->sign_channel_announcement_meth != NULL);
2684 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2685 CHECK(calls->ready_channel_meth != NULL);
2687 LDKChannelPublicKeys pubkeys_conv;
2688 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2689 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2690 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2693 .this_arg = (void*) calls,
2694 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2695 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2696 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
2697 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2698 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2699 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
2700 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2701 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2702 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2703 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2704 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2705 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2706 .ready_channel = ready_channel_LDKBaseSign_jcall,
2707 .free = LDKBaseSign_JCalls_free,
2708 .pubkeys = pubkeys_conv,
2709 .set_pubkeys = NULL,
2713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2714 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2715 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2716 return (uint64_t)res_ptr;
2718 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) {
2719 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2720 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2721 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2726 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2727 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2728 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
2733 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2734 LDKHolderCommitmentTransaction holder_tx_conv;
2735 holder_tx_conv.inner = (void*)(holder_tx & (~1));
2736 holder_tx_conv.is_owned = false;
2737 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2738 *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
2739 return (uint64_t)ret_conv;
2742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2743 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2744 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2745 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2749 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) {
2750 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2751 LDKCommitmentTransaction commitment_tx_conv;
2752 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2753 commitment_tx_conv.is_owned = false;
2754 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2755 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2756 return (uint64_t)ret_conv;
2759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
2760 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2761 unsigned char secret_arr[32];
2762 CHECK((*env)->GetArrayLength(env, secret) == 32);
2763 (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
2764 unsigned char (*secret_ref)[32] = &secret_arr;
2765 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2766 *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2767 return (uint64_t)ret_conv;
2770 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) {
2771 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2772 LDKHolderCommitmentTransaction commitment_tx_conv;
2773 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2774 commitment_tx_conv.is_owned = false;
2775 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2776 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2777 return (uint64_t)ret_conv;
2780 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) {
2781 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2782 LDKTransaction justice_tx_ref;
2783 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2784 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2785 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2786 justice_tx_ref.data_is_owned = true;
2787 unsigned char per_commitment_key_arr[32];
2788 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2789 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2790 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2791 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2792 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2793 return (uint64_t)ret_conv;
2796 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) {
2797 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2798 LDKTransaction justice_tx_ref;
2799 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2800 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2801 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2802 justice_tx_ref.data_is_owned = true;
2803 unsigned char per_commitment_key_arr[32];
2804 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2805 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2806 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2807 LDKHTLCOutputInCommitment htlc_conv;
2808 htlc_conv.inner = (void*)(htlc & (~1));
2809 htlc_conv.is_owned = false;
2810 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2811 *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);
2812 return (uint64_t)ret_conv;
2815 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) {
2816 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2817 LDKTransaction htlc_tx_ref;
2818 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2819 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2820 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2821 htlc_tx_ref.data_is_owned = true;
2822 LDKPublicKey per_commitment_point_ref;
2823 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2824 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2825 LDKHTLCOutputInCommitment htlc_conv;
2826 htlc_conv.inner = (void*)(htlc & (~1));
2827 htlc_conv.is_owned = false;
2828 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2829 *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);
2830 return (uint64_t)ret_conv;
2833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
2834 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2835 LDKClosingTransaction closing_tx_conv;
2836 closing_tx_conv.inner = (void*)(closing_tx & (~1));
2837 closing_tx_conv.is_owned = false;
2838 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2839 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2840 return (uint64_t)ret_conv;
2843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2844 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2845 LDKUnsignedChannelAnnouncement msg_conv;
2846 msg_conv.inner = (void*)(msg & (~1));
2847 msg_conv.is_owned = false;
2848 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2849 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2850 return (uint64_t)ret_conv;
2853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2854 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2855 LDKChannelTransactionParameters channel_parameters_conv;
2856 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2857 channel_parameters_conv.is_owned = false;
2858 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2861 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2862 if (this_arg->set_pubkeys != NULL)
2863 this_arg->set_pubkeys(this_arg);
2864 return this_arg->pubkeys;
2866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2867 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2868 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2871 uint64_t ret_ref = (uint64_t)ret_var.inner;
2872 if (ret_var.is_owned) {
2878 typedef struct LDKSign_JCalls {
2879 atomic_size_t refcnt;
2882 LDKBaseSign_JCalls* BaseSign;
2883 jmethodID write_meth;
2885 static void LDKSign_JCalls_free(void* this_arg) {
2886 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2887 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2889 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2890 if (get_jenv_res == JNI_EDETACHED) {
2891 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2893 DO_ASSERT(get_jenv_res == JNI_OK);
2895 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2896 if (get_jenv_res == JNI_EDETACHED) {
2897 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2902 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2903 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2905 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2906 if (get_jenv_res == JNI_EDETACHED) {
2907 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2909 DO_ASSERT(get_jenv_res == JNI_OK);
2911 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2913 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2914 if ((*env)->ExceptionCheck(env)) {
2915 (*env)->ExceptionDescribe(env);
2916 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2918 LDKCVec_u8Z ret_ref;
2919 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2920 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2921 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2922 if (get_jenv_res == JNI_EDETACHED) {
2923 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2927 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2928 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2929 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2930 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2932 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2933 jclass c = (*env)->GetObjectClass(env, o);
2935 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2936 atomic_init(&calls->refcnt, 1);
2937 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2938 calls->o = (*env)->NewWeakGlobalRef(env, o);
2939 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2940 CHECK(calls->write_meth != NULL);
2942 LDKChannelPublicKeys pubkeys_conv;
2943 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2944 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2945 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2948 .this_arg = (void*) calls,
2949 .write = write_LDKSign_jcall,
2950 .cloned = LDKSign_JCalls_cloned,
2951 .free = LDKSign_JCalls_free,
2952 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2954 calls->BaseSign = ret.BaseSign.this_arg;
2957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2958 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2959 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2960 return (uint64_t)res_ptr;
2962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2963 LDKSign *inp = (LDKSign *)(arg & ~1);
2964 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2965 DO_ASSERT((res_ptr & 1) == 0);
2966 return (int64_t)(res_ptr | 1);
2968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2969 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2970 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2973 CVec_u8Z_free(ret_var);
2977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2978 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2981 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2982 CHECK(val->result_ok);
2983 LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
2984 *res_ret = Sign_clone(&(*val->contents.result));
2985 return (uint64_t)res_ret;
2987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2988 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2989 CHECK(!val->result_ok);
2990 LDKDecodeError err_var = (*val->contents.err);
2991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2993 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2997 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3000 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3001 CHECK(val->result_ok);
3002 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
3003 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
3006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3007 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
3008 CHECK(!val->result_ok);
3009 return *val->contents.err;
3011 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
3012 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
3013 for (size_t i = 0; i < ret.datalen; i++) {
3014 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
3018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3019 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
3021 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3022 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3023 CHECK(val->result_ok);
3024 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
3025 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3027 for (size_t i = 0; i < res_var.datalen; i++) {
3028 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
3029 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
3030 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
3031 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
3035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3036 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
3037 CHECK(!val->result_ok);
3038 return *val->contents.err;
3040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3041 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
3043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3044 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3045 CHECK(val->result_ok);
3046 LDKInMemorySigner res_var = (*val->contents.result);
3047 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3048 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3049 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
3052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3053 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
3054 CHECK(!val->result_ok);
3055 LDKDecodeError err_var = (*val->contents.err);
3056 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3057 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3058 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
3061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3062 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
3063 ret->datalen = (*env)->GetArrayLength(env, elems);
3064 if (ret->datalen == 0) {
3067 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
3068 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3069 for (size_t i = 0; i < ret->datalen; i++) {
3070 int64_t arr_elem = java_elems[i];
3071 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
3072 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
3073 ret->data[i] = arr_elem_conv;
3075 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3077 return (uint64_t)ret;
3079 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3080 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3081 for (size_t i = 0; i < ret.datalen; i++) {
3082 ret.data[i] = TxOut_clone(&orig->data[i]);
3086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3087 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3090 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3091 CHECK(val->result_ok);
3092 LDKTransaction res_var = (*val->contents.result);
3093 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3094 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3098 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3099 CHECK(!val->result_ok);
3100 return *val->contents.err;
3102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3103 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3104 LDKThirtyTwoBytes a_ref;
3105 CHECK((*env)->GetArrayLength(env, a) == 32);
3106 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3108 LDKChannelMonitor b_conv;
3109 b_conv.inner = (void*)(b & (~1));
3110 b_conv.is_owned = (b & 1) || (b == 0);
3111 b_conv = ChannelMonitor_clone(&b_conv);
3113 return (uint64_t)ret;
3115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3116 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3117 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3118 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3122 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3123 LDKChannelMonitor b_var = tuple->b;
3124 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3125 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3126 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3130 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3131 ret->datalen = (*env)->GetArrayLength(env, elems);
3132 if (ret->datalen == 0) {
3135 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3136 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3137 for (size_t i = 0; i < ret->datalen; i++) {
3138 int64_t arr_elem = java_elems[i];
3139 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3140 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
3141 ret->data[i] = arr_elem_conv;
3143 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3145 return (uint64_t)ret;
3147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3148 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3150 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3151 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3152 CHECK(val->result_ok);
3153 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3154 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3155 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3156 for (size_t i = 0; i < res_var.datalen; i++) {
3157 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
3158 res_arr_ptr[i] = res_conv_34_ref;
3160 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3163 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3164 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3165 CHECK(!val->result_ok);
3166 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3169 static jclass LDKCOption_u16Z_Some_class = NULL;
3170 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3171 static jclass LDKCOption_u16Z_None_class = NULL;
3172 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3174 LDKCOption_u16Z_Some_class =
3175 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3176 CHECK(LDKCOption_u16Z_Some_class != NULL);
3177 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3178 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3179 LDKCOption_u16Z_None_class =
3180 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3181 CHECK(LDKCOption_u16Z_None_class != NULL);
3182 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3183 CHECK(LDKCOption_u16Z_None_meth != NULL);
3185 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3186 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3188 case LDKCOption_u16Z_Some: {
3189 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3191 case LDKCOption_u16Z_None: {
3192 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3197 static jclass LDKAPIError_APIMisuseError_class = NULL;
3198 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3199 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3200 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3201 static jclass LDKAPIError_RouteError_class = NULL;
3202 static jmethodID LDKAPIError_RouteError_meth = NULL;
3203 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3204 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3205 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3206 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3207 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3208 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3210 LDKAPIError_APIMisuseError_class =
3211 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3212 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3213 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3214 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3215 LDKAPIError_FeeRateTooHigh_class =
3216 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3217 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3218 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3219 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3220 LDKAPIError_RouteError_class =
3221 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3222 CHECK(LDKAPIError_RouteError_class != NULL);
3223 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3224 CHECK(LDKAPIError_RouteError_meth != NULL);
3225 LDKAPIError_ChannelUnavailable_class =
3226 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3227 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3228 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3229 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3230 LDKAPIError_MonitorUpdateFailed_class =
3231 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3232 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3233 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3234 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3235 LDKAPIError_IncompatibleShutdownScript_class =
3236 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3237 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3238 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3239 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3241 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3242 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3244 case LDKAPIError_APIMisuseError: {
3245 LDKStr err_str = obj->api_misuse_error.err;
3246 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3247 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3249 case LDKAPIError_FeeRateTooHigh: {
3250 LDKStr err_str = obj->fee_rate_too_high.err;
3251 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3252 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3254 case LDKAPIError_RouteError: {
3255 LDKStr err_str = obj->route_error.err;
3256 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3257 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3259 case LDKAPIError_ChannelUnavailable: {
3260 LDKStr err_str = obj->channel_unavailable.err;
3261 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3262 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3264 case LDKAPIError_MonitorUpdateFailed: {
3265 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3267 case LDKAPIError_IncompatibleShutdownScript: {
3268 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3269 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3270 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3271 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3272 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3278 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3281 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3282 CHECK(val->result_ok);
3283 return *val->contents.result;
3285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3286 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3287 CHECK(!val->result_ok);
3288 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3292 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3293 ret->datalen = (*env)->GetArrayLength(env, elems);
3294 if (ret->datalen == 0) {
3297 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3298 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3299 for (size_t i = 0; i < ret->datalen; i++) {
3300 int64_t arr_elem = java_elems[i];
3301 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3302 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3303 ret->data[i] = arr_elem_conv;
3305 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3307 return (uint64_t)ret;
3309 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3310 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3311 for (size_t i = 0; i < ret.datalen; i++) {
3312 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3317 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3318 ret->datalen = (*env)->GetArrayLength(env, elems);
3319 if (ret->datalen == 0) {
3322 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3323 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3324 for (size_t i = 0; i < ret->datalen; i++) {
3325 int64_t arr_elem = java_elems[i];
3326 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3327 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3328 ret->data[i] = arr_elem_conv;
3330 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3332 return (uint64_t)ret;
3334 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3335 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3336 for (size_t i = 0; i < ret.datalen; i++) {
3337 ret.data[i] = APIError_clone(&orig->data[i]);
3341 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3342 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3343 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3344 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3345 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3346 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3347 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3348 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3350 LDKPaymentSendFailure_ParameterError_class =
3351 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3352 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3353 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3354 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3355 LDKPaymentSendFailure_PathParameterError_class =
3356 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3357 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3358 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3359 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3360 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3361 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3362 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3363 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3364 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3365 LDKPaymentSendFailure_PartialFailure_class =
3366 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3367 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3368 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3369 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3371 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3372 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3374 case LDKPaymentSendFailure_ParameterError: {
3375 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3376 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3378 case LDKPaymentSendFailure_PathParameterError: {
3379 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3380 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3381 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3382 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3383 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3384 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3385 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3386 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3388 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3389 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3391 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3392 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3393 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3394 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3395 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3396 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3397 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3399 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3400 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3402 case LDKPaymentSendFailure_PartialFailure: {
3403 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3404 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3405 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3406 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3407 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3408 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3409 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3410 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3412 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3413 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3419 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3422 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3423 CHECK(val->result_ok);
3424 return *val->contents.result;
3426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3427 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3428 CHECK(!val->result_ok);
3429 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3432 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3433 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3436 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3437 CHECK(val->result_ok);
3438 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3439 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3443 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3444 CHECK(!val->result_ok);
3445 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3448 static jclass LDKNetAddress_IPv4_class = NULL;
3449 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3450 static jclass LDKNetAddress_IPv6_class = NULL;
3451 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3452 static jclass LDKNetAddress_OnionV2_class = NULL;
3453 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3454 static jclass LDKNetAddress_OnionV3_class = NULL;
3455 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3457 LDKNetAddress_IPv4_class =
3458 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3459 CHECK(LDKNetAddress_IPv4_class != NULL);
3460 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3461 CHECK(LDKNetAddress_IPv4_meth != NULL);
3462 LDKNetAddress_IPv6_class =
3463 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3464 CHECK(LDKNetAddress_IPv6_class != NULL);
3465 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3466 CHECK(LDKNetAddress_IPv6_meth != NULL);
3467 LDKNetAddress_OnionV2_class =
3468 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3469 CHECK(LDKNetAddress_OnionV2_class != NULL);
3470 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3471 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3472 LDKNetAddress_OnionV3_class =
3473 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3474 CHECK(LDKNetAddress_OnionV3_class != NULL);
3475 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3476 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3478 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3479 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3481 case LDKNetAddress_IPv4: {
3482 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3483 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3484 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3486 case LDKNetAddress_IPv6: {
3487 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3488 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3489 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3491 case LDKNetAddress_OnionV2: {
3492 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3493 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3494 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3496 case LDKNetAddress_OnionV3: {
3497 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3498 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3499 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);
3504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3505 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3506 ret->datalen = (*env)->GetArrayLength(env, elems);
3507 if (ret->datalen == 0) {
3510 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3511 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3512 for (size_t i = 0; i < ret->datalen; i++) {
3513 int64_t arr_elem = java_elems[i];
3514 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3515 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3516 ret->data[i] = arr_elem_conv;
3518 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3520 return (uint64_t)ret;
3522 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3523 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3524 for (size_t i = 0; i < ret.datalen; i++) {
3525 ret.data[i] = NetAddress_clone(&orig->data[i]);
3529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3530 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3531 LDKThirtyTwoBytes a_ref;
3532 CHECK((*env)->GetArrayLength(env, a) == 32);
3533 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3535 LDKThirtyTwoBytes b_ref;
3536 CHECK((*env)->GetArrayLength(env, b) == 32);
3537 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3539 return (uint64_t)ret;
3541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3542 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3543 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3544 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3548 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3549 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3550 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3554 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3557 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3558 CHECK(val->result_ok);
3559 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3560 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3564 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3565 CHECK(!val->result_ok);
3566 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3570 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3571 ret->datalen = (*env)->GetArrayLength(env, elems);
3572 if (ret->datalen == 0) {
3575 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3576 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3577 for (size_t i = 0; i < ret->datalen; i++) {
3578 int64_t arr_elem = java_elems[i];
3579 LDKChannelMonitor arr_elem_conv;
3580 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3581 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3582 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3583 ret->data[i] = arr_elem_conv;
3585 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3587 return (uint64_t)ret;
3589 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3590 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3591 for (size_t i = 0; i < ret.datalen; i++) {
3592 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3596 typedef struct LDKWatch_JCalls {
3597 atomic_size_t refcnt;
3600 jmethodID watch_channel_meth;
3601 jmethodID update_channel_meth;
3602 jmethodID release_pending_monitor_events_meth;
3604 static void LDKWatch_JCalls_free(void* this_arg) {
3605 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3606 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3608 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3609 if (get_jenv_res == JNI_EDETACHED) {
3610 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3612 DO_ASSERT(get_jenv_res == JNI_OK);
3614 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3615 if (get_jenv_res == JNI_EDETACHED) {
3616 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3621 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3622 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3624 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3625 if (get_jenv_res == JNI_EDETACHED) {
3626 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3628 DO_ASSERT(get_jenv_res == JNI_OK);
3630 LDKOutPoint funding_txo_var = funding_txo;
3631 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3632 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3633 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3634 if (funding_txo_var.is_owned) {
3635 funding_txo_ref |= 1;
3637 LDKChannelMonitor monitor_var = monitor;
3638 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3639 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3640 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3641 if (monitor_var.is_owned) {
3644 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3646 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3647 if ((*env)->ExceptionCheck(env)) {
3648 (*env)->ExceptionDescribe(env);
3649 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3651 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3652 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3653 if (get_jenv_res == JNI_EDETACHED) {
3654 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3658 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3659 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3661 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3662 if (get_jenv_res == JNI_EDETACHED) {
3663 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3665 DO_ASSERT(get_jenv_res == JNI_OK);
3667 LDKOutPoint funding_txo_var = funding_txo;
3668 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3669 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3670 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3671 if (funding_txo_var.is_owned) {
3672 funding_txo_ref |= 1;
3674 LDKChannelMonitorUpdate update_var = update;
3675 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3676 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3677 uint64_t update_ref = (uint64_t)update_var.inner;
3678 if (update_var.is_owned) {
3681 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3683 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3684 if ((*env)->ExceptionCheck(env)) {
3685 (*env)->ExceptionDescribe(env);
3686 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3688 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3689 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3690 if (get_jenv_res == JNI_EDETACHED) {
3691 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3695 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3696 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3698 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3699 if (get_jenv_res == JNI_EDETACHED) {
3700 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3702 DO_ASSERT(get_jenv_res == JNI_OK);
3704 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3706 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3707 if ((*env)->ExceptionCheck(env)) {
3708 (*env)->ExceptionDescribe(env);
3709 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3711 LDKCVec_MonitorEventZ ret_constr;
3712 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3713 if (ret_constr.datalen > 0)
3714 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3716 ret_constr.data = NULL;
3717 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3718 for (size_t o = 0; o < ret_constr.datalen; o++) {
3719 int64_t ret_conv_14 = ret_vals[o];
3720 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3721 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3722 ret_constr.data[o] = ret_conv_14_conv;
3724 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3725 if (get_jenv_res == JNI_EDETACHED) {
3726 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3730 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3731 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3732 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3734 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3735 jclass c = (*env)->GetObjectClass(env, o);
3737 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3738 atomic_init(&calls->refcnt, 1);
3739 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3740 calls->o = (*env)->NewWeakGlobalRef(env, o);
3741 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3742 CHECK(calls->watch_channel_meth != NULL);
3743 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3744 CHECK(calls->update_channel_meth != NULL);
3745 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3746 CHECK(calls->release_pending_monitor_events_meth != NULL);
3749 .this_arg = (void*) calls,
3750 .watch_channel = watch_channel_LDKWatch_jcall,
3751 .update_channel = update_channel_LDKWatch_jcall,
3752 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3753 .free = LDKWatch_JCalls_free,
3757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3758 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3759 *res_ptr = LDKWatch_init(env, clz, o);
3760 return (uint64_t)res_ptr;
3762 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) {
3763 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3764 LDKOutPoint funding_txo_conv;
3765 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3766 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3767 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3768 LDKChannelMonitor monitor_conv;
3769 monitor_conv.inner = (void*)(monitor & (~1));
3770 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3771 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3772 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3773 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3774 return (uint64_t)ret_conv;
3777 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) {
3778 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3779 LDKOutPoint funding_txo_conv;
3780 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3781 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3782 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3783 LDKChannelMonitorUpdate update_conv;
3784 update_conv.inner = (void*)(update & (~1));
3785 update_conv.is_owned = (update & 1) || (update == 0);
3786 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3787 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3788 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3789 return (uint64_t)ret_conv;
3792 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3793 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3794 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3795 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3796 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3797 for (size_t o = 0; o < ret_var.datalen; o++) {
3798 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3799 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3800 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3801 ret_arr_ptr[o] = ret_conv_14_ref;
3803 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3808 typedef struct LDKBroadcasterInterface_JCalls {
3809 atomic_size_t refcnt;
3812 jmethodID broadcast_transaction_meth;
3813 } LDKBroadcasterInterface_JCalls;
3814 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3815 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3816 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3818 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3819 if (get_jenv_res == JNI_EDETACHED) {
3820 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3822 DO_ASSERT(get_jenv_res == JNI_OK);
3824 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3825 if (get_jenv_res == JNI_EDETACHED) {
3826 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3831 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3832 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3834 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3835 if (get_jenv_res == JNI_EDETACHED) {
3836 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3838 DO_ASSERT(get_jenv_res == JNI_OK);
3840 LDKTransaction tx_var = tx;
3841 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3842 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3843 Transaction_free(tx_var);
3844 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3846 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3847 if ((*env)->ExceptionCheck(env)) {
3848 (*env)->ExceptionDescribe(env);
3849 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3851 if (get_jenv_res == JNI_EDETACHED) {
3852 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3855 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3856 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3857 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3859 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3860 jclass c = (*env)->GetObjectClass(env, o);
3862 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3863 atomic_init(&calls->refcnt, 1);
3864 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3865 calls->o = (*env)->NewWeakGlobalRef(env, o);
3866 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3867 CHECK(calls->broadcast_transaction_meth != NULL);
3869 LDKBroadcasterInterface ret = {
3870 .this_arg = (void*) calls,
3871 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3872 .free = LDKBroadcasterInterface_JCalls_free,
3876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3877 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3878 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3879 return (uint64_t)res_ptr;
3881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3882 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3883 LDKTransaction tx_ref;
3884 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3885 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3886 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3887 tx_ref.data_is_owned = true;
3888 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3891 typedef struct LDKKeysInterface_JCalls {
3892 atomic_size_t refcnt;
3895 jmethodID get_node_secret_meth;
3896 jmethodID get_destination_script_meth;
3897 jmethodID get_shutdown_scriptpubkey_meth;
3898 jmethodID get_channel_signer_meth;
3899 jmethodID get_secure_random_bytes_meth;
3900 jmethodID read_chan_signer_meth;
3901 jmethodID sign_invoice_meth;
3902 } LDKKeysInterface_JCalls;
3903 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3904 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3905 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3907 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3908 if (get_jenv_res == JNI_EDETACHED) {
3909 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3911 DO_ASSERT(get_jenv_res == JNI_OK);
3913 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3914 if (get_jenv_res == JNI_EDETACHED) {
3915 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3920 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3921 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3923 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3924 if (get_jenv_res == JNI_EDETACHED) {
3925 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3927 DO_ASSERT(get_jenv_res == JNI_OK);
3929 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3931 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3932 if ((*env)->ExceptionCheck(env)) {
3933 (*env)->ExceptionDescribe(env);
3934 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3936 LDKSecretKey ret_ref;
3937 CHECK((*env)->GetArrayLength(env, ret) == 32);
3938 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3939 if (get_jenv_res == JNI_EDETACHED) {
3940 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3944 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3945 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3948 if (get_jenv_res == JNI_EDETACHED) {
3949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3951 DO_ASSERT(get_jenv_res == JNI_OK);
3953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3955 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3956 if ((*env)->ExceptionCheck(env)) {
3957 (*env)->ExceptionDescribe(env);
3958 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
3960 LDKCVec_u8Z ret_ref;
3961 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3962 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3963 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3964 if (get_jenv_res == JNI_EDETACHED) {
3965 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3969 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3970 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3972 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3973 if (get_jenv_res == JNI_EDETACHED) {
3974 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3976 DO_ASSERT(get_jenv_res == JNI_OK);
3978 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3980 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
3981 if ((*env)->ExceptionCheck(env)) {
3982 (*env)->ExceptionDescribe(env);
3983 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
3985 LDKShutdownScript ret_conv;
3986 ret_conv.inner = (void*)(ret & (~1));
3987 ret_conv.is_owned = (ret & 1) || (ret == 0);
3988 ret_conv = ShutdownScript_clone(&ret_conv);
3989 if (get_jenv_res == JNI_EDETACHED) {
3990 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3994 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3995 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3997 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3998 if (get_jenv_res == JNI_EDETACHED) {
3999 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4001 DO_ASSERT(get_jenv_res == JNI_OK);
4003 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4005 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
4006 if ((*env)->ExceptionCheck(env)) {
4007 (*env)->ExceptionDescribe(env);
4008 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
4010 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
4011 ret_conv = Sign_clone(&ret_conv);
4012 if (get_jenv_res == JNI_EDETACHED) {
4013 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4017 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
4018 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4020 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4021 if (get_jenv_res == JNI_EDETACHED) {
4022 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4024 DO_ASSERT(get_jenv_res == JNI_OK);
4026 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4028 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
4029 if ((*env)->ExceptionCheck(env)) {
4030 (*env)->ExceptionDescribe(env);
4031 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
4033 LDKThirtyTwoBytes ret_ref;
4034 CHECK((*env)->GetArrayLength(env, ret) == 32);
4035 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
4036 if (get_jenv_res == JNI_EDETACHED) {
4037 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4041 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
4042 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4045 if (get_jenv_res == JNI_EDETACHED) {
4046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4048 DO_ASSERT(get_jenv_res == JNI_OK);
4050 LDKu8slice reader_var = reader;
4051 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
4052 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
4053 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4055 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
4056 if ((*env)->ExceptionCheck(env)) {
4057 (*env)->ExceptionDescribe(env);
4058 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
4060 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
4061 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
4062 if (get_jenv_res == JNI_EDETACHED) {
4063 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4067 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
4068 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
4070 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4071 if (get_jenv_res == JNI_EDETACHED) {
4072 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4074 DO_ASSERT(get_jenv_res == JNI_OK);
4076 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
4077 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
4078 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
4079 CVec_u8Z_free(invoice_preimage_var);
4080 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4082 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
4083 if ((*env)->ExceptionCheck(env)) {
4084 (*env)->ExceptionDescribe(env);
4085 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
4087 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
4088 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
4089 if (get_jenv_res == JNI_EDETACHED) {
4090 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4094 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4095 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4096 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4098 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4099 jclass c = (*env)->GetObjectClass(env, o);
4101 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4102 atomic_init(&calls->refcnt, 1);
4103 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4104 calls->o = (*env)->NewWeakGlobalRef(env, o);
4105 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4106 CHECK(calls->get_node_secret_meth != NULL);
4107 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4108 CHECK(calls->get_destination_script_meth != NULL);
4109 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
4110 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
4111 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4112 CHECK(calls->get_channel_signer_meth != NULL);
4113 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4114 CHECK(calls->get_secure_random_bytes_meth != NULL);
4115 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4116 CHECK(calls->read_chan_signer_meth != NULL);
4117 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4118 CHECK(calls->sign_invoice_meth != NULL);
4120 LDKKeysInterface ret = {
4121 .this_arg = (void*) calls,
4122 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4123 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4124 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
4125 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4126 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4127 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4128 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4129 .free = LDKKeysInterface_JCalls_free,
4133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4134 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4135 *res_ptr = LDKKeysInterface_init(env, clz, o);
4136 return (uint64_t)res_ptr;
4138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4139 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4140 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4141 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4146 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4147 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4148 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4149 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4150 CVec_u8Z_free(ret_var);
4154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4155 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4156 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4159 uint64_t ret_ref = (uint64_t)ret_var.inner;
4160 if (ret_var.is_owned) {
4166 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) {
4167 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4168 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
4169 *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4170 return (uint64_t)ret_ret;
4173 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4174 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4175 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4181 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4182 LDKu8slice reader_ref;
4183 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4184 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4185 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4186 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4187 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4188 return (uint64_t)ret_conv;
4191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4192 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4193 LDKCVec_u8Z invoice_preimage_ref;
4194 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4195 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4196 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4197 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4198 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4199 return (uint64_t)ret_conv;
4202 typedef struct LDKFeeEstimator_JCalls {
4203 atomic_size_t refcnt;
4206 jmethodID get_est_sat_per_1000_weight_meth;
4207 } LDKFeeEstimator_JCalls;
4208 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4209 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4210 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4212 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4213 if (get_jenv_res == JNI_EDETACHED) {
4214 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4216 DO_ASSERT(get_jenv_res == JNI_OK);
4218 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4219 if (get_jenv_res == JNI_EDETACHED) {
4220 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4225 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4226 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4228 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4229 if (get_jenv_res == JNI_EDETACHED) {
4230 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4232 DO_ASSERT(get_jenv_res == JNI_OK);
4234 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4235 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4237 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4238 if ((*env)->ExceptionCheck(env)) {
4239 (*env)->ExceptionDescribe(env);
4240 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4242 if (get_jenv_res == JNI_EDETACHED) {
4243 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4247 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4248 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4249 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4251 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4252 jclass c = (*env)->GetObjectClass(env, o);
4254 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4255 atomic_init(&calls->refcnt, 1);
4256 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4257 calls->o = (*env)->NewWeakGlobalRef(env, o);
4258 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4259 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4261 LDKFeeEstimator ret = {
4262 .this_arg = (void*) calls,
4263 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4264 .free = LDKFeeEstimator_JCalls_free,
4268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4269 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4270 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4271 return (uint64_t)res_ptr;
4273 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) {
4274 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4275 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4276 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4280 typedef struct LDKLogger_JCalls {
4281 atomic_size_t refcnt;
4286 static void LDKLogger_JCalls_free(void* this_arg) {
4287 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4288 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4290 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4291 if (get_jenv_res == JNI_EDETACHED) {
4292 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4294 DO_ASSERT(get_jenv_res == JNI_OK);
4296 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4297 if (get_jenv_res == JNI_EDETACHED) {
4298 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4303 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4304 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4306 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4307 if (get_jenv_res == JNI_EDETACHED) {
4308 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4310 DO_ASSERT(get_jenv_res == JNI_OK);
4312 const char* record_str = record;
4313 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4314 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4316 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4317 if ((*env)->ExceptionCheck(env)) {
4318 (*env)->ExceptionDescribe(env);
4319 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4321 if (get_jenv_res == JNI_EDETACHED) {
4322 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4325 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4326 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4327 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4329 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4330 jclass c = (*env)->GetObjectClass(env, o);
4332 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4333 atomic_init(&calls->refcnt, 1);
4334 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4335 calls->o = (*env)->NewWeakGlobalRef(env, o);
4336 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4337 CHECK(calls->log_meth != NULL);
4340 .this_arg = (void*) calls,
4341 .log = log_LDKLogger_jcall,
4342 .free = LDKLogger_JCalls_free,
4346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4347 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4348 *res_ptr = LDKLogger_init(env, clz, o);
4349 return (uint64_t)res_ptr;
4351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4352 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4353 LDKThirtyTwoBytes a_ref;
4354 CHECK((*env)->GetArrayLength(env, a) == 32);
4355 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4357 LDKChannelManager b_conv;
4358 b_conv.inner = (void*)(b & (~1));
4359 b_conv.is_owned = (b & 1) || (b == 0);
4360 // Warning: we need a move here but no clone is available for LDKChannelManager
4362 return (uint64_t)ret;
4364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4365 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4366 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4367 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4371 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4372 LDKChannelManager b_var = tuple->b;
4373 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4374 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4375 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4379 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4382 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4383 CHECK(val->result_ok);
4384 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4388 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4389 CHECK(!val->result_ok);
4390 LDKDecodeError err_var = (*val->contents.err);
4391 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4392 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4393 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4397 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4400 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4401 CHECK(val->result_ok);
4402 LDKChannelConfig res_var = (*val->contents.result);
4403 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4404 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4405 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4409 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4410 CHECK(!val->result_ok);
4411 LDKDecodeError err_var = (*val->contents.err);
4412 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4413 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4414 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4417 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4418 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4421 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4422 CHECK(val->result_ok);
4423 LDKOutPoint res_var = (*val->contents.result);
4424 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4425 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4426 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4430 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4431 CHECK(!val->result_ok);
4432 LDKDecodeError err_var = (*val->contents.err);
4433 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4438 typedef struct LDKType_JCalls {
4439 atomic_size_t refcnt;
4442 jmethodID type_id_meth;
4443 jmethodID debug_str_meth;
4444 jmethodID write_meth;
4446 static void LDKType_JCalls_free(void* this_arg) {
4447 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4448 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4450 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4451 if (get_jenv_res == JNI_EDETACHED) {
4452 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4454 DO_ASSERT(get_jenv_res == JNI_OK);
4456 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4457 if (get_jenv_res == JNI_EDETACHED) {
4458 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4463 uint16_t type_id_LDKType_jcall(const void* this_arg) {
4464 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4466 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4467 if (get_jenv_res == JNI_EDETACHED) {
4468 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4470 DO_ASSERT(get_jenv_res == JNI_OK);
4472 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4474 int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
4475 if ((*env)->ExceptionCheck(env)) {
4476 (*env)->ExceptionDescribe(env);
4477 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
4479 if (get_jenv_res == JNI_EDETACHED) {
4480 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4484 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
4485 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4487 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4488 if (get_jenv_res == JNI_EDETACHED) {
4489 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4491 DO_ASSERT(get_jenv_res == JNI_OK);
4493 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4495 jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
4496 if ((*env)->ExceptionCheck(env)) {
4497 (*env)->ExceptionDescribe(env);
4498 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
4500 LDKStr ret_conv = java_to_owned_str(env, ret);
4501 if (get_jenv_res == JNI_EDETACHED) {
4502 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4506 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
4507 LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
4509 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4510 if (get_jenv_res == JNI_EDETACHED) {
4511 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4513 DO_ASSERT(get_jenv_res == JNI_OK);
4515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4517 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4518 if ((*env)->ExceptionCheck(env)) {
4519 (*env)->ExceptionDescribe(env);
4520 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
4522 LDKCVec_u8Z ret_ref;
4523 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4524 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4525 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4526 if (get_jenv_res == JNI_EDETACHED) {
4527 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4531 static void LDKType_JCalls_cloned(LDKType* new_obj) {
4532 LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
4533 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4535 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
4536 jclass c = (*env)->GetObjectClass(env, o);
4538 LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
4539 atomic_init(&calls->refcnt, 1);
4540 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4541 calls->o = (*env)->NewWeakGlobalRef(env, o);
4542 calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
4543 CHECK(calls->type_id_meth != NULL);
4544 calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
4545 CHECK(calls->debug_str_meth != NULL);
4546 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4547 CHECK(calls->write_meth != NULL);
4550 .this_arg = (void*) calls,
4551 .type_id = type_id_LDKType_jcall,
4552 .debug_str = debug_str_LDKType_jcall,
4553 .write = write_LDKType_jcall,
4554 .cloned = LDKType_JCalls_cloned,
4555 .free = LDKType_JCalls_free,
4559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
4560 LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
4561 *res_ptr = LDKType_init(env, clz, o);
4562 return (uint64_t)res_ptr;
4564 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
4565 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4566 int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
4570 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
4571 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4572 LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
4573 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
4578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4579 LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
4580 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4581 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4582 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4583 CVec_u8Z_free(ret_var);
4587 static jclass LDKCOption_TypeZ_Some_class = NULL;
4588 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
4589 static jclass LDKCOption_TypeZ_None_class = NULL;
4590 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
4591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
4592 LDKCOption_TypeZ_Some_class =
4593 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
4594 CHECK(LDKCOption_TypeZ_Some_class != NULL);
4595 LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
4596 CHECK(LDKCOption_TypeZ_Some_meth != NULL);
4597 LDKCOption_TypeZ_None_class =
4598 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
4599 CHECK(LDKCOption_TypeZ_None_class != NULL);
4600 LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
4601 CHECK(LDKCOption_TypeZ_None_meth != NULL);
4603 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4604 LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
4606 case LDKCOption_TypeZ_Some: {
4607 LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
4608 *some_ret = Type_clone(&obj->some);
4609 return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
4611 case LDKCOption_TypeZ_None: {
4612 return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
4617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4618 return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
4620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4621 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4622 CHECK(val->result_ok);
4623 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
4626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4627 LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
4628 CHECK(!val->result_ok);
4629 LDKDecodeError err_var = (*val->contents.err);
4630 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4631 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4632 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4636 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4638 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4639 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4640 CHECK(val->result_ok);
4641 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4645 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4646 CHECK(!val->result_ok);
4647 return *val->contents.err;
4649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4650 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4653 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4654 CHECK(val->result_ok);
4655 LDKInvoice res_var = (*val->contents.result);
4656 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4657 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4658 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4662 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4663 CHECK(!val->result_ok);
4664 return *val->contents.err;
4666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4667 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4670 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4671 CHECK(val->result_ok);
4672 LDKSignedRawInvoice res_var = (*val->contents.result);
4673 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4674 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4675 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4679 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4680 CHECK(!val->result_ok);
4681 return *val->contents.err;
4683 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) {
4684 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4685 LDKRawInvoice a_conv;
4686 a_conv.inner = (void*)(a & (~1));
4687 a_conv.is_owned = (a & 1) || (a == 0);
4688 a_conv = RawInvoice_clone(&a_conv);
4690 LDKThirtyTwoBytes b_ref;
4691 CHECK((*env)->GetArrayLength(env, b) == 32);
4692 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4694 LDKInvoiceSignature c_conv;
4695 c_conv.inner = (void*)(c & (~1));
4696 c_conv.is_owned = (c & 1) || (c == 0);
4697 c_conv = InvoiceSignature_clone(&c_conv);
4699 return (uint64_t)ret;
4701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4702 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4703 LDKRawInvoice a_var = tuple->a;
4704 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4705 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4706 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4710 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4711 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4712 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4716 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4717 LDKInvoiceSignature c_var = tuple->c;
4718 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4719 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4720 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4724 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4727 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4728 CHECK(val->result_ok);
4729 LDKPayeePubKey res_var = (*val->contents.result);
4730 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4731 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4732 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4735 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4736 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4737 CHECK(!val->result_ok);
4738 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4742 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4743 ret->datalen = (*env)->GetArrayLength(env, elems);
4744 if (ret->datalen == 0) {
4747 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4748 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4749 for (size_t i = 0; i < ret->datalen; i++) {
4750 int64_t arr_elem = java_elems[i];
4751 LDKPrivateRoute arr_elem_conv;
4752 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4753 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4754 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4755 ret->data[i] = arr_elem_conv;
4757 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4759 return (uint64_t)ret;
4761 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4762 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4763 for (size_t i = 0; i < ret.datalen; i++) {
4764 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4769 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4772 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4773 CHECK(val->result_ok);
4774 LDKPositiveTimestamp res_var = (*val->contents.result);
4775 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4776 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4777 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4780 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4781 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4782 CHECK(!val->result_ok);
4783 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4787 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4790 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4791 CHECK(val->result_ok);
4792 return *val->contents.result;
4794 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4795 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4796 CHECK(!val->result_ok);
4797 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4801 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4804 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4805 CHECK(val->result_ok);
4806 LDKInvoice res_var = (*val->contents.result);
4807 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4808 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4809 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4812 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4813 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4814 CHECK(!val->result_ok);
4815 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4819 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4822 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4823 CHECK(val->result_ok);
4824 LDKDescription res_var = (*val->contents.result);
4825 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4826 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4827 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4830 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4831 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4832 CHECK(!val->result_ok);
4833 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4837 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4840 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4841 CHECK(val->result_ok);
4842 LDKExpiryTime res_var = (*val->contents.result);
4843 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4844 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4845 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4848 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4849 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4850 CHECK(!val->result_ok);
4851 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4855 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4858 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4859 CHECK(val->result_ok);
4860 LDKPrivateRoute res_var = (*val->contents.result);
4861 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4862 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4863 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4866 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4867 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4868 CHECK(!val->result_ok);
4869 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4873 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4875 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4876 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4877 CHECK(val->result_ok);
4878 LDKStr res_str = (*val->contents.result);
4879 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4882 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4883 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4884 CHECK(!val->result_ok);
4885 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4889 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4892 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4893 CHECK(val->result_ok);
4894 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4895 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4901 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4902 CHECK(!val->result_ok);
4903 LDKDecodeError err_var = (*val->contents.err);
4904 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4905 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4906 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4909 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4910 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4913 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4914 CHECK(val->result_ok);
4915 LDKHTLCUpdate res_var = (*val->contents.result);
4916 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4917 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4918 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4922 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4923 CHECK(!val->result_ok);
4924 LDKDecodeError err_var = (*val->contents.err);
4925 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4926 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4927 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4930 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4931 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4934 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4935 CHECK(val->result_ok);
4936 return *val->contents.result;
4938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4939 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4940 CHECK(!val->result_ok);
4941 LDKMonitorUpdateError err_var = (*val->contents.err);
4942 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4943 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4944 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4948 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4950 a_conv.inner = (void*)(a & (~1));
4951 a_conv.is_owned = (a & 1) || (a == 0);
4952 a_conv = OutPoint_clone(&a_conv);
4955 b_ref.datalen = (*env)->GetArrayLength(env, b);
4956 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4957 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4959 return (uint64_t)ret;
4961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4962 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4963 LDKOutPoint a_var = tuple->a;
4964 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4965 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4966 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4970 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4971 LDKCVec_u8Z b_var = tuple->b;
4972 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4973 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4977 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4980 b_ref.datalen = (*env)->GetArrayLength(env, b);
4981 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4982 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4984 return (uint64_t)ret;
4986 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4987 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4991 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4992 LDKCVec_u8Z b_var = tuple->b;
4993 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4994 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4998 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4999 ret->datalen = (*env)->GetArrayLength(env, elems);
5000 if (ret->datalen == 0) {
5003 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
5004 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5005 for (size_t i = 0; i < ret->datalen; i++) {
5006 int64_t arr_elem = java_elems[i];
5007 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
5008 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
5009 ret->data[i] = arr_elem_conv;
5011 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5013 return (uint64_t)ret;
5015 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
5016 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
5017 for (size_t i = 0; i < ret.datalen; i++) {
5018 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
5022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5023 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
5024 LDKThirtyTwoBytes a_ref;
5025 CHECK((*env)->GetArrayLength(env, a) == 32);
5026 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5028 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
5029 b_constr.datalen = (*env)->GetArrayLength(env, b);
5030 if (b_constr.datalen > 0)
5031 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
5033 b_constr.data = NULL;
5034 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5035 for (size_t b = 0; b < b_constr.datalen; b++) {
5036 int64_t b_conv_27 = b_vals[b];
5037 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
5038 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
5039 b_constr.data[b] = b_conv_27_conv;
5041 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5043 return (uint64_t)ret;
5045 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5046 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
5047 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
5048 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
5051 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5052 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
5053 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
5054 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
5055 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
5056 for (size_t b = 0; b < b_var.datalen; b++) {
5057 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
5058 b_arr_ptr[b] = b_conv_27_ref;
5060 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
5063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5064 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
5065 ret->datalen = (*env)->GetArrayLength(env, elems);
5066 if (ret->datalen == 0) {
5069 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
5070 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5071 for (size_t i = 0; i < ret->datalen; i++) {
5072 int64_t arr_elem = java_elems[i];
5073 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
5074 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
5075 ret->data[i] = arr_elem_conv;
5077 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5079 return (uint64_t)ret;
5081 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
5082 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 };
5083 for (size_t i = 0; i < ret.datalen; i++) {
5084 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
5088 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
5089 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
5090 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
5091 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
5092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
5093 LDKPaymentPurpose_InvoicePayment_class =
5094 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
5095 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
5096 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
5097 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
5098 LDKPaymentPurpose_SpontaneousPayment_class =
5099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
5100 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
5101 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
5102 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
5104 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5105 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
5107 case LDKPaymentPurpose_InvoicePayment: {
5108 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5109 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
5110 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
5111 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
5112 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
5114 case LDKPaymentPurpose_SpontaneousPayment: {
5115 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
5116 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
5117 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
5122 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5123 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5124 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5125 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5126 static jclass LDKClosureReason_CooperativeClosure_class = NULL;
5127 static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
5128 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5129 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5130 static jclass LDKClosureReason_ProcessingError_class = NULL;
5131 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5132 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5133 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5134 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5135 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5137 LDKClosureReason_CounterpartyForceClosed_class =
5138 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
5139 CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5140 LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
5141 CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5142 LDKClosureReason_HolderForceClosed_class =
5143 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
5144 CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5145 LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5146 CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5147 LDKClosureReason_CooperativeClosure_class =
5148 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
5149 CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
5150 LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
5151 CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
5152 LDKClosureReason_CommitmentTxConfirmed_class =
5153 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
5154 CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5155 LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5156 CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5157 LDKClosureReason_ProcessingError_class =
5158 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
5159 CHECK(LDKClosureReason_ProcessingError_class != NULL);
5160 LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5161 CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5162 LDKClosureReason_DisconnectedPeer_class =
5163 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
5164 CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5165 LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5166 CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5167 LDKClosureReason_OutdatedChannelManager_class =
5168 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
5169 CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5170 LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5171 CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5173 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5174 LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
5176 case LDKClosureReason_CounterpartyForceClosed: {
5177 LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
5178 jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
5179 return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
5181 case LDKClosureReason_HolderForceClosed: {
5182 return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5184 case LDKClosureReason_CooperativeClosure: {
5185 return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
5187 case LDKClosureReason_CommitmentTxConfirmed: {
5188 return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5190 case LDKClosureReason_ProcessingError: {
5191 LDKStr err_str = obj->processing_error.err;
5192 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5193 return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5195 case LDKClosureReason_DisconnectedPeer: {
5196 return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5198 case LDKClosureReason_OutdatedChannelManager: {
5199 return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5204 static jclass LDKEvent_FundingGenerationReady_class = NULL;
5205 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
5206 static jclass LDKEvent_PaymentReceived_class = NULL;
5207 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
5208 static jclass LDKEvent_PaymentSent_class = NULL;
5209 static jmethodID LDKEvent_PaymentSent_meth = NULL;
5210 static jclass LDKEvent_PaymentPathFailed_class = NULL;
5211 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
5212 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
5213 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
5214 static jclass LDKEvent_SpendableOutputs_class = NULL;
5215 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
5216 static jclass LDKEvent_PaymentForwarded_class = NULL;
5217 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
5218 static jclass LDKEvent_ChannelClosed_class = NULL;
5219 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
5220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
5221 LDKEvent_FundingGenerationReady_class =
5222 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
5223 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
5224 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
5225 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
5226 LDKEvent_PaymentReceived_class =
5227 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
5228 CHECK(LDKEvent_PaymentReceived_class != NULL);
5229 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
5230 CHECK(LDKEvent_PaymentReceived_meth != NULL);
5231 LDKEvent_PaymentSent_class =
5232 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
5233 CHECK(LDKEvent_PaymentSent_class != NULL);
5234 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
5235 CHECK(LDKEvent_PaymentSent_meth != NULL);
5236 LDKEvent_PaymentPathFailed_class =
5237 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
5238 CHECK(LDKEvent_PaymentPathFailed_class != NULL);
5239 LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[J)V");
5240 CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
5241 LDKEvent_PendingHTLCsForwardable_class =
5242 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
5243 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
5244 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
5245 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
5246 LDKEvent_SpendableOutputs_class =
5247 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
5248 CHECK(LDKEvent_SpendableOutputs_class != NULL);
5249 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
5250 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
5251 LDKEvent_PaymentForwarded_class =
5252 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
5253 CHECK(LDKEvent_PaymentForwarded_class != NULL);
5254 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
5255 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
5256 LDKEvent_ChannelClosed_class =
5257 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
5258 CHECK(LDKEvent_ChannelClosed_class != NULL);
5259 LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJ)V");
5260 CHECK(LDKEvent_ChannelClosed_meth != NULL);
5262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5263 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
5265 case LDKEvent_FundingGenerationReady: {
5266 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
5267 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
5268 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
5269 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
5270 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
5271 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);
5273 case LDKEvent_PaymentReceived: {
5274 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5275 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
5276 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
5277 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
5279 case LDKEvent_PaymentSent: {
5280 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
5281 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
5282 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
5284 case LDKEvent_PaymentPathFailed: {
5285 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
5286 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
5287 uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
5288 LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
5289 int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
5290 int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
5291 for (size_t k = 0; k < path_var.datalen; k++) {
5292 LDKRouteHop path_conv_10_var = path_var.data[k];
5293 CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5294 CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5295 uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
5296 path_arr_ptr[k] = path_conv_10_ref;
5298 (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
5299 return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr);
5301 case LDKEvent_PendingHTLCsForwardable: {
5302 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
5304 case LDKEvent_SpendableOutputs: {
5305 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
5306 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
5307 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
5308 for (size_t b = 0; b < outputs_var.datalen; b++) {
5309 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
5310 outputs_arr_ptr[b] = outputs_conv_27_ref;
5312 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
5313 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
5315 case LDKEvent_PaymentForwarded: {
5316 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
5317 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
5319 case LDKEvent_ChannelClosed: {
5320 int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
5321 (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
5322 uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
5323 return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref);
5328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5329 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5330 ret->datalen = (*env)->GetArrayLength(env, elems);
5331 if (ret->datalen == 0) {
5334 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
5335 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5336 for (size_t i = 0; i < ret->datalen; i++) {
5337 int64_t arr_elem = java_elems[i];
5338 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
5339 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
5340 ret->data[i] = arr_elem_conv;
5342 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5344 return (uint64_t)ret;
5346 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
5347 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
5348 for (size_t i = 0; i < ret.datalen; i++) {
5349 ret.data[i] = Event_clone(&orig->data[i]);
5353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5354 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5356 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5357 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
5359 return (uint64_t)ret;
5361 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5362 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
5365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5366 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
5367 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
5368 return (uint64_t)b_ref;
5370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5371 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
5372 ret->datalen = (*env)->GetArrayLength(env, elems);
5373 if (ret->datalen == 0) {
5376 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
5377 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5378 for (size_t i = 0; i < ret->datalen; i++) {
5379 int64_t arr_elem = java_elems[i];
5380 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
5381 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
5382 ret->data[i] = arr_elem_conv;
5384 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5386 return (uint64_t)ret;
5388 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
5389 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
5390 for (size_t i = 0; i < ret.datalen; i++) {
5391 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
5395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5396 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5397 LDKThirtyTwoBytes a_ref;
5398 CHECK((*env)->GetArrayLength(env, a) == 32);
5399 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5401 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5402 b_constr.datalen = (*env)->GetArrayLength(env, b);
5403 if (b_constr.datalen > 0)
5404 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5406 b_constr.data = NULL;
5407 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5408 for (size_t a = 0; a < b_constr.datalen; a++) {
5409 int64_t b_conv_26 = b_vals[a];
5410 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
5411 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
5412 b_constr.data[a] = b_conv_26_conv;
5414 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5416 return (uint64_t)ret;
5418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5419 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5420 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
5421 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
5424 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5425 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5426 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
5427 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
5428 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
5429 for (size_t a = 0; a < b_var.datalen; a++) {
5430 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
5431 b_arr_ptr[a] = b_conv_26_ref;
5433 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
5436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5437 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5438 ret->datalen = (*env)->GetArrayLength(env, elems);
5439 if (ret->datalen == 0) {
5442 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5443 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5444 for (size_t i = 0; i < ret->datalen; i++) {
5445 int64_t arr_elem = java_elems[i];
5446 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
5447 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5448 ret->data[i] = arr_elem_conv;
5450 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5452 return (uint64_t)ret;
5454 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5455 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 };
5456 for (size_t i = 0; i < ret.datalen; i++) {
5457 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5461 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
5462 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
5463 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
5464 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
5465 static jclass LDKBalance_ContentiousClaimable_class = NULL;
5466 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
5467 static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
5468 static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
5469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
5470 LDKBalance_ClaimableOnChannelClose_class =
5471 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
5472 CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
5473 LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
5474 CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
5475 LDKBalance_ClaimableAwaitingConfirmations_class =
5476 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
5477 CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
5478 LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
5479 CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
5480 LDKBalance_ContentiousClaimable_class =
5481 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
5482 CHECK(LDKBalance_ContentiousClaimable_class != NULL);
5483 LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
5484 CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
5485 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
5486 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
5487 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
5488 LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
5489 CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
5491 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5492 LDKBalance *obj = (LDKBalance*)(ptr & ~1);
5494 case LDKBalance_ClaimableOnChannelClose: {
5495 return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
5497 case LDKBalance_ClaimableAwaitingConfirmations: {
5498 return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
5500 case LDKBalance_ContentiousClaimable: {
5501 return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
5503 case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
5504 return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
5509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5510 LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
5511 ret->datalen = (*env)->GetArrayLength(env, elems);
5512 if (ret->datalen == 0) {
5515 ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
5516 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5517 for (size_t i = 0; i < ret->datalen; i++) {
5518 int64_t arr_elem = java_elems[i];
5519 LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
5520 arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
5521 ret->data[i] = arr_elem_conv;
5523 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5525 return (uint64_t)ret;
5527 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
5528 LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
5529 for (size_t i = 0; i < ret.datalen; i++) {
5530 ret.data[i] = Balance_clone(&orig->data[i]);
5534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5535 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5538 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5539 CHECK(val->result_ok);
5540 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
5543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5544 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5545 CHECK(!val->result_ok);
5546 LDKDecodeError err_var = (*val->contents.err);
5547 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5548 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5549 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5553 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5556 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5557 CHECK(val->result_ok);
5558 return *val->contents.result;
5560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5561 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5562 CHECK(!val->result_ok);
5563 LDKLightningError 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 int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5570 LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
5572 CHECK((*env)->GetArrayLength(env, a) == 33);
5573 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
5575 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
5576 b_conv = Type_clone(&b_conv);
5578 return (uint64_t)ret;
5580 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5581 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
5582 int8_tArray a_arr = (*env)->NewByteArray(env, 33);
5583 (*env)->SetByteArrayRegion(env, a_arr, 0, 33, tuple->a.compressed_form);
5586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5587 LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
5588 LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
5589 *b_ret = Type_clone(&tuple->b);
5590 return (uint64_t)b_ret;
5592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5593 LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
5594 ret->datalen = (*env)->GetArrayLength(env, elems);
5595 if (ret->datalen == 0) {
5598 ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
5599 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5600 for (size_t i = 0; i < ret->datalen; i++) {
5601 int64_t arr_elem = java_elems[i];
5602 LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
5603 arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
5604 ret->data[i] = arr_elem_conv;
5606 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5608 return (uint64_t)ret;
5610 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
5611 LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
5612 for (size_t i = 0; i < ret.datalen; i++) {
5613 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
5617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5618 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5620 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5621 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5622 CHECK(val->result_ok);
5623 return *val->contents.result;
5625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5626 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5627 CHECK(!val->result_ok);
5628 LDKLightningError err_var = (*val->contents.err);
5629 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5630 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5631 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5634 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) {
5635 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5636 LDKChannelAnnouncement a_conv;
5637 a_conv.inner = (void*)(a & (~1));
5638 a_conv.is_owned = (a & 1) || (a == 0);
5639 a_conv = ChannelAnnouncement_clone(&a_conv);
5641 LDKChannelUpdate b_conv;
5642 b_conv.inner = (void*)(b & (~1));
5643 b_conv.is_owned = (b & 1) || (b == 0);
5644 b_conv = ChannelUpdate_clone(&b_conv);
5646 LDKChannelUpdate c_conv;
5647 c_conv.inner = (void*)(c & (~1));
5648 c_conv.is_owned = (c & 1) || (c == 0);
5649 c_conv = ChannelUpdate_clone(&c_conv);
5651 return (uint64_t)ret;
5653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5654 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5655 LDKChannelAnnouncement a_var = tuple->a;
5656 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5657 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5658 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
5661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5662 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5663 LDKChannelUpdate b_var = tuple->b;
5664 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5665 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5666 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
5669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
5670 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5671 LDKChannelUpdate c_var = tuple->c;
5672 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5673 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5674 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
5677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5678 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5679 ret->datalen = (*env)->GetArrayLength(env, elems);
5680 if (ret->datalen == 0) {
5683 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5684 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5685 for (size_t i = 0; i < ret->datalen; i++) {
5686 int64_t arr_elem = java_elems[i];
5687 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5688 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5689 ret->data[i] = arr_elem_conv;
5691 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5693 return (uint64_t)ret;
5695 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5696 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5697 for (size_t i = 0; i < ret.datalen; i++) {
5698 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5703 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5704 ret->datalen = (*env)->GetArrayLength(env, elems);
5705 if (ret->datalen == 0) {
5708 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5709 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5710 for (size_t i = 0; i < ret->datalen; i++) {
5711 int64_t arr_elem = java_elems[i];
5712 LDKNodeAnnouncement arr_elem_conv;
5713 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5714 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5715 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5716 ret->data[i] = arr_elem_conv;
5718 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5720 return (uint64_t)ret;
5722 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5723 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5724 for (size_t i = 0; i < ret.datalen; i++) {
5725 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5729 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5730 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5733 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5734 CHECK(val->result_ok);
5735 LDKCVec_u8Z res_var = (*val->contents.result);
5736 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5737 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5741 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5742 CHECK(!val->result_ok);
5743 LDKPeerHandleError err_var = (*val->contents.err);
5744 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5745 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5746 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5750 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5753 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5754 CHECK(val->result_ok);
5755 return *val->contents.result;
5757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5758 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5759 CHECK(!val->result_ok);
5760 LDKPeerHandleError err_var = (*val->contents.err);
5761 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5762 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5763 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5767 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5770 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5771 CHECK(val->result_ok);
5772 return *val->contents.result;
5774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5775 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5776 CHECK(!val->result_ok);
5777 LDKPeerHandleError err_var = (*val->contents.err);
5778 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5779 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5780 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5783 typedef struct LDKAccess_JCalls {
5784 atomic_size_t refcnt;
5787 jmethodID get_utxo_meth;
5789 static void LDKAccess_JCalls_free(void* this_arg) {
5790 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5791 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5793 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5794 if (get_jenv_res == JNI_EDETACHED) {
5795 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5797 DO_ASSERT(get_jenv_res == JNI_OK);
5799 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5800 if (get_jenv_res == JNI_EDETACHED) {
5801 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5806 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5807 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
5809 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5810 if (get_jenv_res == JNI_EDETACHED) {
5811 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5813 DO_ASSERT(get_jenv_res == JNI_OK);
5815 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
5816 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
5817 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5819 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
5820 if ((*env)->ExceptionCheck(env)) {
5821 (*env)->ExceptionDescribe(env);
5822 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
5824 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
5825 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
5826 if (get_jenv_res == JNI_EDETACHED) {
5827 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5831 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
5832 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
5833 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5835 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
5836 jclass c = (*env)->GetObjectClass(env, o);
5838 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
5839 atomic_init(&calls->refcnt, 1);
5840 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5841 calls->o = (*env)->NewWeakGlobalRef(env, o);
5842 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
5843 CHECK(calls->get_utxo_meth != NULL);
5846 .this_arg = (void*) calls,
5847 .get_utxo = get_utxo_LDKAccess_jcall,
5848 .free = LDKAccess_JCalls_free,
5852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
5853 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
5854 *res_ptr = LDKAccess_init(env, clz, o);
5855 return (uint64_t)res_ptr;
5857 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) {
5858 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
5859 unsigned char genesis_hash_arr[32];
5860 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
5861 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
5862 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
5863 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5864 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5865 return (uint64_t)ret_conv;
5868 static jclass LDKCOption_AccessZ_Some_class = NULL;
5869 static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
5870 static jclass LDKCOption_AccessZ_None_class = NULL;
5871 static jmethodID LDKCOption_AccessZ_None_meth = NULL;
5872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
5873 LDKCOption_AccessZ_Some_class =
5874 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
5875 CHECK(LDKCOption_AccessZ_Some_class != NULL);
5876 LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
5877 CHECK(LDKCOption_AccessZ_Some_meth != NULL);
5878 LDKCOption_AccessZ_None_class =
5879 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
5880 CHECK(LDKCOption_AccessZ_None_class != NULL);
5881 LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
5882 CHECK(LDKCOption_AccessZ_None_meth != NULL);
5884 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5885 LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
5887 case LDKCOption_AccessZ_Some: {
5888 LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
5889 *some_ret = obj->some;
5890 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
5891 if ((*some_ret).free == LDKAccess_JCalls_free) {
5892 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5893 LDKAccess_JCalls_cloned(&(*some_ret));
5895 return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
5897 case LDKCOption_AccessZ_None: {
5898 return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
5903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5904 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5907 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5908 CHECK(val->result_ok);
5909 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5916 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5917 CHECK(!val->result_ok);
5918 LDKDecodeError err_var = (*val->contents.err);
5919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5925 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5928 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5929 CHECK(val->result_ok);
5930 LDKChannelInfo res_var = (*val->contents.result);
5931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5937 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5938 CHECK(!val->result_ok);
5939 LDKDecodeError err_var = (*val->contents.err);
5940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5946 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5949 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5950 CHECK(val->result_ok);
5951 LDKRoutingFees res_var = (*val->contents.result);
5952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5958 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5959 CHECK(!val->result_ok);
5960 LDKDecodeError err_var = (*val->contents.err);
5961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5967 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5970 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5971 CHECK(val->result_ok);
5972 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5979 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5980 CHECK(!val->result_ok);
5981 LDKDecodeError err_var = (*val->contents.err);
5982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5988 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5989 ret->datalen = (*env)->GetArrayLength(env, elems);
5990 if (ret->datalen == 0) {
5993 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5994 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5995 for (size_t i = 0; i < ret->datalen; i++) {
5996 ret->data[i] = java_elems[i];
5998 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6000 return (uint64_t)ret;
6002 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
6003 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
6004 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
6007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6008 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
6010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6011 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6012 CHECK(val->result_ok);
6013 LDKNodeInfo res_var = (*val->contents.result);
6014 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6015 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6016 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6020 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
6021 CHECK(!val->result_ok);
6022 LDKDecodeError err_var = (*val->contents.err);
6023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6029 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
6031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6032 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6033 CHECK(val->result_ok);
6034 LDKNetworkGraph res_var = (*val->contents.result);
6035 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6036 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6037 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6041 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
6042 CHECK(!val->result_ok);
6043 LDKDecodeError err_var = (*val->contents.err);
6044 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6045 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6046 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6050 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
6052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6053 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6054 CHECK(val->result_ok);
6055 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6058 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6059 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
6060 CHECK(!val->result_ok);
6061 return *val->contents.err;
6063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6064 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
6066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6067 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6068 CHECK(val->result_ok);
6069 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6070 *res_conv = (*val->contents.result);
6071 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
6072 return (uint64_t)res_conv;
6074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6075 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
6076 CHECK(!val->result_ok);
6077 LDKDecodeError err_var = (*val->contents.err);
6078 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6079 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6080 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6084 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
6086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6087 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6088 CHECK(val->result_ok);
6089 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
6092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6093 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
6094 CHECK(!val->result_ok);
6095 LDKDecodeError err_var = (*val->contents.err);
6096 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6097 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6098 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6102 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
6103 ret->datalen = (*env)->GetArrayLength(env, elems);
6104 if (ret->datalen == 0) {
6107 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
6108 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6109 for (size_t i = 0; i < ret->datalen; i++) {
6110 int64_t arr_elem = java_elems[i];
6111 LDKUpdateAddHTLC arr_elem_conv;
6112 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6113 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6114 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
6115 ret->data[i] = arr_elem_conv;
6117 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6119 return (uint64_t)ret;
6121 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6122 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6123 for (size_t i = 0; i < ret.datalen; i++) {
6124 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6129 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
6130 ret->datalen = (*env)->GetArrayLength(env, elems);
6131 if (ret->datalen == 0) {
6134 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
6135 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6136 for (size_t i = 0; i < ret->datalen; i++) {
6137 int64_t arr_elem = java_elems[i];
6138 LDKUpdateFulfillHTLC arr_elem_conv;
6139 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6140 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6141 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
6142 ret->data[i] = arr_elem_conv;
6144 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6146 return (uint64_t)ret;
6148 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6149 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6150 for (size_t i = 0; i < ret.datalen; i++) {
6151 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6156 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
6157 ret->datalen = (*env)->GetArrayLength(env, elems);
6158 if (ret->datalen == 0) {
6161 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
6162 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6163 for (size_t i = 0; i < ret->datalen; i++) {
6164 int64_t arr_elem = java_elems[i];
6165 LDKUpdateFailHTLC arr_elem_conv;
6166 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6167 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6168 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
6169 ret->data[i] = arr_elem_conv;
6171 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6173 return (uint64_t)ret;
6175 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6176 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6177 for (size_t i = 0; i < ret.datalen; i++) {
6178 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
6183 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
6184 ret->datalen = (*env)->GetArrayLength(env, elems);
6185 if (ret->datalen == 0) {
6188 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
6189 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
6190 for (size_t i = 0; i < ret->datalen; i++) {
6191 int64_t arr_elem = java_elems[i];
6192 LDKUpdateFailMalformedHTLC arr_elem_conv;
6193 arr_elem_conv.inner = (void*)(arr_elem & (~1));
6194 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
6195 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
6196 ret->data[i] = arr_elem_conv;
6198 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
6200 return (uint64_t)ret;
6202 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6203 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6204 for (size_t i = 0; i < ret.datalen; i++) {
6205 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6210 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
6212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6213 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6214 CHECK(val->result_ok);
6215 LDKAcceptChannel res_var = (*val->contents.result);
6216 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6217 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6218 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6222 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
6223 CHECK(!val->result_ok);
6224 LDKDecodeError err_var = (*val->contents.err);
6225 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6226 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6227 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6231 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
6233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6234 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6235 CHECK(val->result_ok);
6236 LDKAnnouncementSignatures res_var = (*val->contents.result);
6237 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6238 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6239 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6243 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
6244 CHECK(!val->result_ok);
6245 LDKDecodeError err_var = (*val->contents.err);
6246 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6247 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6248 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6251 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6252 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
6254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6255 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6256 CHECK(val->result_ok);
6257 LDKChannelReestablish res_var = (*val->contents.result);
6258 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6259 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6260 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6264 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
6265 CHECK(!val->result_ok);
6266 LDKDecodeError err_var = (*val->contents.err);
6267 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6268 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6269 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6273 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
6275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6276 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6277 CHECK(val->result_ok);
6278 LDKClosingSigned res_var = (*val->contents.result);
6279 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6280 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6281 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6285 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
6286 CHECK(!val->result_ok);
6287 LDKDecodeError err_var = (*val->contents.err);
6288 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6289 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6290 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6294 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
6296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6297 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6298 CHECK(val->result_ok);
6299 LDKClosingSignedFeeRange res_var = (*val->contents.result);
6300 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6301 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6302 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6306 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
6307 CHECK(!val->result_ok);
6308 LDKDecodeError err_var = (*val->contents.err);
6309 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6310 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6311 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6315 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
6317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6318 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6319 CHECK(val->result_ok);
6320 LDKCommitmentSigned res_var = (*val->contents.result);
6321 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6322 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6323 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6327 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
6328 CHECK(!val->result_ok);
6329 LDKDecodeError err_var = (*val->contents.err);
6330 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6331 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6332 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6336 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
6338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6339 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6340 CHECK(val->result_ok);
6341 LDKFundingCreated res_var = (*val->contents.result);
6342 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6343 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6344 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6348 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
6349 CHECK(!val->result_ok);
6350 LDKDecodeError err_var = (*val->contents.err);
6351 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6352 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6353 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6357 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
6359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6360 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6361 CHECK(val->result_ok);
6362 LDKFundingSigned res_var = (*val->contents.result);
6363 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6364 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6365 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6369 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
6370 CHECK(!val->result_ok);
6371 LDKDecodeError err_var = (*val->contents.err);
6372 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6373 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6374 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6378 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
6380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6381 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6382 CHECK(val->result_ok);
6383 LDKFundingLocked res_var = (*val->contents.result);
6384 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6385 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6386 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6390 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
6391 CHECK(!val->result_ok);
6392 LDKDecodeError err_var = (*val->contents.err);
6393 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6394 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6395 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6399 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
6401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6402 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6403 CHECK(val->result_ok);
6404 LDKInit res_var = (*val->contents.result);
6405 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6406 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6407 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6411 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
6412 CHECK(!val->result_ok);
6413 LDKDecodeError err_var = (*val->contents.err);
6414 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6415 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6416 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6420 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
6422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6423 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6424 CHECK(val->result_ok);
6425 LDKOpenChannel res_var = (*val->contents.result);
6426 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6427 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6428 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6432 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
6433 CHECK(!val->result_ok);
6434 LDKDecodeError err_var = (*val->contents.err);
6435 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6436 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6437 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6441 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
6443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6444 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6445 CHECK(val->result_ok);
6446 LDKRevokeAndACK res_var = (*val->contents.result);
6447 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6448 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6449 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6453 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
6454 CHECK(!val->result_ok);
6455 LDKDecodeError err_var = (*val->contents.err);
6456 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6457 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6458 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6462 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
6464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6465 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6466 CHECK(val->result_ok);
6467 LDKShutdown res_var = (*val->contents.result);
6468 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6469 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6470 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6474 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
6475 CHECK(!val->result_ok);
6476 LDKDecodeError err_var = (*val->contents.err);
6477 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6478 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6479 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6483 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
6485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6486 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6487 CHECK(val->result_ok);
6488 LDKUpdateFailHTLC res_var = (*val->contents.result);
6489 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6490 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6491 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6495 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
6496 CHECK(!val->result_ok);
6497 LDKDecodeError err_var = (*val->contents.err);
6498 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6499 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6500 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6504 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
6506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6507 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6508 CHECK(val->result_ok);
6509 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
6510 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6511 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6512 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6516 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
6517 CHECK(!val->result_ok);
6518 LDKDecodeError err_var = (*val->contents.err);
6519 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6520 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6521 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6525 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
6527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6528 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6529 CHECK(val->result_ok);
6530 LDKUpdateFee res_var = (*val->contents.result);
6531 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6532 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6533 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6537 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
6538 CHECK(!val->result_ok);
6539 LDKDecodeError err_var = (*val->contents.err);
6540 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6541 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6542 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6546 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
6548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6549 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6550 CHECK(val->result_ok);
6551 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
6552 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6553 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6554 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6558 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
6559 CHECK(!val->result_ok);
6560 LDKDecodeError err_var = (*val->contents.err);
6561 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6562 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6563 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6567 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
6569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6570 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6571 CHECK(val->result_ok);
6572 LDKUpdateAddHTLC res_var = (*val->contents.result);
6573 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6574 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6575 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6579 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
6580 CHECK(!val->result_ok);
6581 LDKDecodeError err_var = (*val->contents.err);
6582 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6583 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6584 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6588 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
6590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6591 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6592 CHECK(val->result_ok);
6593 LDKPing res_var = (*val->contents.result);
6594 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6595 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6596 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6600 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
6601 CHECK(!val->result_ok);
6602 LDKDecodeError err_var = (*val->contents.err);
6603 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6604 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6605 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6609 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
6611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6612 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6613 CHECK(val->result_ok);
6614 LDKPong res_var = (*val->contents.result);
6615 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6616 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6617 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6621 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
6622 CHECK(!val->result_ok);
6623 LDKDecodeError err_var = (*val->contents.err);
6624 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6625 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6626 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6630 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6633 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6634 CHECK(val->result_ok);
6635 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
6636 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6637 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6638 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6642 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6643 CHECK(!val->result_ok);
6644 LDKDecodeError err_var = (*val->contents.err);
6645 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6646 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6647 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6651 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
6653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6654 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6655 CHECK(val->result_ok);
6656 LDKChannelAnnouncement res_var = (*val->contents.result);
6657 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6658 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6659 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6663 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
6664 CHECK(!val->result_ok);
6665 LDKDecodeError err_var = (*val->contents.err);
6666 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6667 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6668 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6671 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6672 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
6674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6675 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6676 CHECK(val->result_ok);
6677 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
6678 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6679 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6680 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6684 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6685 CHECK(!val->result_ok);
6686 LDKDecodeError err_var = (*val->contents.err);
6687 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6688 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6689 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6693 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6696 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6697 CHECK(val->result_ok);
6698 LDKChannelUpdate res_var = (*val->contents.result);
6699 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6700 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6701 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6705 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6706 CHECK(!val->result_ok);
6707 LDKDecodeError err_var = (*val->contents.err);
6708 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6709 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6710 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6713 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6714 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6717 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6718 CHECK(val->result_ok);
6719 LDKErrorMessage res_var = (*val->contents.result);
6720 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6721 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6722 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6726 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6727 CHECK(!val->result_ok);
6728 LDKDecodeError err_var = (*val->contents.err);
6729 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6730 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6731 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6735 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6738 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6739 CHECK(val->result_ok);
6740 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6741 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6742 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6743 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6747 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6748 CHECK(!val->result_ok);
6749 LDKDecodeError err_var = (*val->contents.err);
6750 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6751 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6752 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6755 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6756 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6759 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6760 CHECK(val->result_ok);
6761 LDKNodeAnnouncement res_var = (*val->contents.result);
6762 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6763 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6764 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6768 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6769 CHECK(!val->result_ok);
6770 LDKDecodeError err_var = (*val->contents.err);
6771 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6772 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6773 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6777 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6780 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6781 CHECK(val->result_ok);
6782 LDKQueryShortChannelIds res_var = (*val->contents.result);
6783 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6784 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6785 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6789 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6790 CHECK(!val->result_ok);
6791 LDKDecodeError err_var = (*val->contents.err);
6792 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6793 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6794 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6797 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6798 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6801 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6802 CHECK(val->result_ok);
6803 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6804 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6805 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6806 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6810 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6811 CHECK(!val->result_ok);
6812 LDKDecodeError err_var = (*val->contents.err);
6813 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6814 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6815 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6819 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6822 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6823 CHECK(val->result_ok);
6824 LDKQueryChannelRange res_var = (*val->contents.result);
6825 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6826 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6827 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6831 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6832 CHECK(!val->result_ok);
6833 LDKDecodeError err_var = (*val->contents.err);
6834 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6835 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6836 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6840 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
6842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6843 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6844 CHECK(val->result_ok);
6845 LDKReplyChannelRange res_var = (*val->contents.result);
6846 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6847 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6848 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6852 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6853 CHECK(!val->result_ok);
6854 LDKDecodeError err_var = (*val->contents.err);
6855 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6856 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6857 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6861 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
6863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6864 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6865 CHECK(val->result_ok);
6866 LDKGossipTimestampFilter res_var = (*val->contents.result);
6867 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6868 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6869 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6873 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6874 CHECK(!val->result_ok);
6875 LDKDecodeError err_var = (*val->contents.err);
6876 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6877 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6878 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6881 static jclass LDKSignOrCreationError_SignError_class = NULL;
6882 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
6883 static jclass LDKSignOrCreationError_CreationError_class = NULL;
6884 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
6885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
6886 LDKSignOrCreationError_SignError_class =
6887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
6888 CHECK(LDKSignOrCreationError_SignError_class != NULL);
6889 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
6890 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
6891 LDKSignOrCreationError_CreationError_class =
6892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6893 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6894 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6895 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6897 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6898 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6900 case LDKSignOrCreationError_SignError: {
6901 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6903 case LDKSignOrCreationError_CreationError: {
6904 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6905 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6911 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6914 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6915 CHECK(val->result_ok);
6916 LDKInvoice res_var = (*val->contents.result);
6917 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6918 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6919 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6923 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6924 CHECK(!val->result_ok);
6925 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6928 typedef struct LDKFilter_JCalls {
6929 atomic_size_t refcnt;
6932 jmethodID register_tx_meth;
6933 jmethodID register_output_meth;
6935 static void LDKFilter_JCalls_free(void* this_arg) {
6936 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6937 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6940 if (get_jenv_res == JNI_EDETACHED) {
6941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6943 DO_ASSERT(get_jenv_res == JNI_OK);
6945 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6946 if (get_jenv_res == JNI_EDETACHED) {
6947 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6952 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6953 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6955 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6956 if (get_jenv_res == JNI_EDETACHED) {
6957 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6959 DO_ASSERT(get_jenv_res == JNI_OK);
6961 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6962 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6963 LDKu8slice script_pubkey_var = script_pubkey;
6964 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6965 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6966 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6968 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6969 if ((*env)->ExceptionCheck(env)) {
6970 (*env)->ExceptionDescribe(env);
6971 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
6973 if (get_jenv_res == JNI_EDETACHED) {
6974 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6977 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6978 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6980 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6981 if (get_jenv_res == JNI_EDETACHED) {
6982 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6984 DO_ASSERT(get_jenv_res == JNI_OK);
6986 LDKWatchedOutput output_var = output;
6987 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6988 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6989 uint64_t output_ref = (uint64_t)output_var.inner;
6990 if (output_var.is_owned) {
6993 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6995 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6996 if ((*env)->ExceptionCheck(env)) {
6997 (*env)->ExceptionDescribe(env);
6998 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7000 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
7001 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7002 if (get_jenv_res == JNI_EDETACHED) {
7003 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7007 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7008 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7009 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7011 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7012 jclass c = (*env)->GetObjectClass(env, o);
7014 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7015 atomic_init(&calls->refcnt, 1);
7016 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7017 calls->o = (*env)->NewWeakGlobalRef(env, o);
7018 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7019 CHECK(calls->register_tx_meth != NULL);
7020 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7021 CHECK(calls->register_output_meth != NULL);
7024 .this_arg = (void*) calls,
7025 .register_tx = register_tx_LDKFilter_jcall,
7026 .register_output = register_output_LDKFilter_jcall,
7027 .free = LDKFilter_JCalls_free,
7031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7032 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7033 *res_ptr = LDKFilter_init(env, clz, o);
7034 return (uint64_t)res_ptr;
7036 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) {
7037 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7038 unsigned char txid_arr[32];
7039 CHECK((*env)->GetArrayLength(env, txid) == 32);
7040 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7041 unsigned char (*txid_ref)[32] = &txid_arr;
7042 LDKu8slice script_pubkey_ref;
7043 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7044 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7045 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7046 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7050 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7051 LDKWatchedOutput output_conv;
7052 output_conv.inner = (void*)(output & (~1));
7053 output_conv.is_owned = (output & 1) || (output == 0);
7054 output_conv = WatchedOutput_clone(&output_conv);
7055 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7056 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7057 uint64_t ret_ref = (uint64_t)ret_copy;
7061 static jclass LDKCOption_FilterZ_Some_class = NULL;
7062 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
7063 static jclass LDKCOption_FilterZ_None_class = NULL;
7064 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
7065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
7066 LDKCOption_FilterZ_Some_class =
7067 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
7068 CHECK(LDKCOption_FilterZ_Some_class != NULL);
7069 LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
7070 CHECK(LDKCOption_FilterZ_Some_meth != NULL);
7071 LDKCOption_FilterZ_None_class =
7072 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
7073 CHECK(LDKCOption_FilterZ_None_class != NULL);
7074 LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
7075 CHECK(LDKCOption_FilterZ_None_meth != NULL);
7077 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7078 LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
7080 case LDKCOption_FilterZ_Some: {
7081 LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
7082 *some_ret = obj->some;
7083 // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
7084 if ((*some_ret).free == LDKFilter_JCalls_free) {
7085 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7086 LDKFilter_JCalls_cloned(&(*some_ret));
7088 return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
7090 case LDKCOption_FilterZ_None: {
7091 return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
7096 typedef struct LDKMessageSendEventsProvider_JCalls {
7097 atomic_size_t refcnt;
7100 jmethodID get_and_clear_pending_msg_events_meth;
7101 } LDKMessageSendEventsProvider_JCalls;
7102 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7103 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7104 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7106 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7107 if (get_jenv_res == JNI_EDETACHED) {
7108 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7110 DO_ASSERT(get_jenv_res == JNI_OK);
7112 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7113 if (get_jenv_res == JNI_EDETACHED) {
7114 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7119 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7120 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7122 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7123 if (get_jenv_res == JNI_EDETACHED) {
7124 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7126 DO_ASSERT(get_jenv_res == JNI_OK);
7128 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7130 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
7131 if ((*env)->ExceptionCheck(env)) {
7132 (*env)->ExceptionDescribe(env);
7133 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
7135 LDKCVec_MessageSendEventZ ret_constr;
7136 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7137 if (ret_constr.datalen > 0)
7138 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7140 ret_constr.data = NULL;
7141 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7142 for (size_t s = 0; s < ret_constr.datalen; s++) {
7143 int64_t ret_conv_18 = ret_vals[s];
7144 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
7145 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
7146 ret_constr.data[s] = ret_conv_18_conv;
7148 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7149 if (get_jenv_res == JNI_EDETACHED) {
7150 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7154 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7155 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7156 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7158 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7159 jclass c = (*env)->GetObjectClass(env, o);
7161 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7162 atomic_init(&calls->refcnt, 1);
7163 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7164 calls->o = (*env)->NewWeakGlobalRef(env, o);
7165 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
7166 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
7168 LDKMessageSendEventsProvider ret = {
7169 .this_arg = (void*) calls,
7170 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7171 .free = LDKMessageSendEventsProvider_JCalls_free,
7175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7176 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7177 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
7178 return (uint64_t)res_ptr;
7180 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
7181 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
7182 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7183 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7184 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7185 for (size_t s = 0; s < ret_var.datalen; s++) {
7186 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7187 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
7188 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
7189 ret_arr_ptr[s] = ret_conv_18_ref;
7191 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7196 typedef struct LDKEventHandler_JCalls {
7197 atomic_size_t refcnt;
7200 jmethodID handle_event_meth;
7201 } LDKEventHandler_JCalls;
7202 static void LDKEventHandler_JCalls_free(void* this_arg) {
7203 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7204 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7206 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7207 if (get_jenv_res == JNI_EDETACHED) {
7208 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7210 DO_ASSERT(get_jenv_res == JNI_OK);
7212 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7213 if (get_jenv_res == JNI_EDETACHED) {
7214 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7219 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
7220 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
7222 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7223 if (get_jenv_res == JNI_EDETACHED) {
7224 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7226 DO_ASSERT(get_jenv_res == JNI_OK);
7228 LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
7229 *ret_event = Event_clone(event);
7230 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7232 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
7233 if ((*env)->ExceptionCheck(env)) {
7234 (*env)->ExceptionDescribe(env);
7235 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
7237 if (get_jenv_res == JNI_EDETACHED) {
7238 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7241 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
7242 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
7243 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7245 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
7246 jclass c = (*env)->GetObjectClass(env, o);
7248 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
7249 atomic_init(&calls->refcnt, 1);
7250 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7251 calls->o = (*env)->NewWeakGlobalRef(env, o);
7252 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
7253 CHECK(calls->handle_event_meth != NULL);
7255 LDKEventHandler ret = {
7256 .this_arg = (void*) calls,
7257 .handle_event = handle_event_LDKEventHandler_jcall,
7258 .free = LDKEventHandler_JCalls_free,
7262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
7263 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7264 *res_ptr = LDKEventHandler_init(env, clz, o);
7265 return (uint64_t)res_ptr;
7267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
7268 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
7269 LDKEvent* event_conv = (LDKEvent*)event;
7270 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
7273 typedef struct LDKEventsProvider_JCalls {
7274 atomic_size_t refcnt;
7277 jmethodID process_pending_events_meth;
7278 } LDKEventsProvider_JCalls;
7279 static void LDKEventsProvider_JCalls_free(void* this_arg) {
7280 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7281 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7283 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7284 if (get_jenv_res == JNI_EDETACHED) {
7285 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7287 DO_ASSERT(get_jenv_res == JNI_OK);
7289 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7290 if (get_jenv_res == JNI_EDETACHED) {
7291 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7296 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
7297 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
7299 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7300 if (get_jenv_res == JNI_EDETACHED) {
7301 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7303 DO_ASSERT(get_jenv_res == JNI_OK);
7305 LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
7306 *handler_ret = handler;
7307 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7309 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
7310 if ((*env)->ExceptionCheck(env)) {
7311 (*env)->ExceptionDescribe(env);
7312 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
7314 if (get_jenv_res == JNI_EDETACHED) {
7315 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7318 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
7319 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
7320 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7322 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
7323 jclass c = (*env)->GetObjectClass(env, o);
7325 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
7326 atomic_init(&calls->refcnt, 1);
7327 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7328 calls->o = (*env)->NewWeakGlobalRef(env, o);
7329 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
7330 CHECK(calls->process_pending_events_meth != NULL);
7332 LDKEventsProvider ret = {
7333 .this_arg = (void*) calls,
7334 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
7335 .free = LDKEventsProvider_JCalls_free,
7339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
7340 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7341 *res_ptr = LDKEventsProvider_init(env, clz, o);
7342 return (uint64_t)res_ptr;
7344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
7345 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
7346 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
7347 if (handler_conv.free == LDKEventHandler_JCalls_free) {
7348 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7349 LDKEventHandler_JCalls_cloned(&handler_conv);
7351 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
7354 typedef struct LDKListen_JCalls {
7355 atomic_size_t refcnt;
7358 jmethodID block_connected_meth;
7359 jmethodID block_disconnected_meth;
7361 static void LDKListen_JCalls_free(void* this_arg) {
7362 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7363 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7365 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7366 if (get_jenv_res == JNI_EDETACHED) {
7367 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7369 DO_ASSERT(get_jenv_res == JNI_OK);
7371 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7372 if (get_jenv_res == JNI_EDETACHED) {
7373 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7378 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
7379 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7381 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7382 if (get_jenv_res == JNI_EDETACHED) {
7383 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7385 DO_ASSERT(get_jenv_res == JNI_OK);
7387 LDKu8slice block_var = block;
7388 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
7389 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
7390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7392 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
7393 if ((*env)->ExceptionCheck(env)) {
7394 (*env)->ExceptionDescribe(env);
7395 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
7397 if (get_jenv_res == JNI_EDETACHED) {
7398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7401 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7402 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
7404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7405 if (get_jenv_res == JNI_EDETACHED) {
7406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7408 DO_ASSERT(get_jenv_res == JNI_OK);
7410 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7411 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7412 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7414 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
7415 if ((*env)->ExceptionCheck(env)) {
7416 (*env)->ExceptionDescribe(env);
7417 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
7419 if (get_jenv_res == JNI_EDETACHED) {
7420 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7423 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
7424 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
7425 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7427 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
7428 jclass c = (*env)->GetObjectClass(env, o);
7430 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
7431 atomic_init(&calls->refcnt, 1);
7432 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7433 calls->o = (*env)->NewWeakGlobalRef(env, o);
7434 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
7435 CHECK(calls->block_connected_meth != NULL);
7436 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
7437 CHECK(calls->block_disconnected_meth != NULL);
7440 .this_arg = (void*) calls,
7441 .block_connected = block_connected_LDKListen_jcall,
7442 .block_disconnected = block_disconnected_LDKListen_jcall,
7443 .free = LDKListen_JCalls_free,
7447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
7448 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
7449 *res_ptr = LDKListen_init(env, clz, o);
7450 return (uint64_t)res_ptr;
7452 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) {
7453 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7454 LDKu8slice block_ref;
7455 block_ref.datalen = (*env)->GetArrayLength(env, block);
7456 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
7457 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
7458 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
7461 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) {
7462 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
7463 unsigned char header_arr[80];
7464 CHECK((*env)->GetArrayLength(env, header) == 80);
7465 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7466 unsigned char (*header_ref)[80] = &header_arr;
7467 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
7470 typedef struct LDKConfirm_JCalls {
7471 atomic_size_t refcnt;
7474 jmethodID transactions_confirmed_meth;
7475 jmethodID transaction_unconfirmed_meth;
7476 jmethodID best_block_updated_meth;
7477 jmethodID get_relevant_txids_meth;
7478 } LDKConfirm_JCalls;
7479 static void LDKConfirm_JCalls_free(void* this_arg) {
7480 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7481 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7483 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7484 if (get_jenv_res == JNI_EDETACHED) {
7485 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7487 DO_ASSERT(get_jenv_res == JNI_OK);
7489 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7490 if (get_jenv_res == JNI_EDETACHED) {
7491 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7496 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
7497 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7499 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7500 if (get_jenv_res == JNI_EDETACHED) {
7501 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7503 DO_ASSERT(get_jenv_res == JNI_OK);
7505 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7506 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7507 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
7508 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
7509 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
7510 for (size_t y = 0; y < txdata_var.datalen; y++) {
7511 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
7512 *txdata_conv_24_ref = txdata_var.data[y];
7513 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
7515 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
7516 FREE(txdata_var.data);
7517 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7519 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
7520 if ((*env)->ExceptionCheck(env)) {
7521 (*env)->ExceptionDescribe(env);
7522 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
7524 if (get_jenv_res == JNI_EDETACHED) {
7525 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7528 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
7529 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7531 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7532 if (get_jenv_res == JNI_EDETACHED) {
7533 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7535 DO_ASSERT(get_jenv_res == JNI_OK);
7537 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
7538 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
7539 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7541 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
7542 if ((*env)->ExceptionCheck(env)) {
7543 (*env)->ExceptionDescribe(env);
7544 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
7546 if (get_jenv_res == JNI_EDETACHED) {
7547 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7550 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
7551 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7553 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7554 if (get_jenv_res == JNI_EDETACHED) {
7555 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7557 DO_ASSERT(get_jenv_res == JNI_OK);
7559 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
7560 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
7561 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7563 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
7564 if ((*env)->ExceptionCheck(env)) {
7565 (*env)->ExceptionDescribe(env);
7566 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
7568 if (get_jenv_res == JNI_EDETACHED) {
7569 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7572 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
7573 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
7575 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7576 if (get_jenv_res == JNI_EDETACHED) {
7577 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7579 DO_ASSERT(get_jenv_res == JNI_OK);
7581 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7583 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
7584 if ((*env)->ExceptionCheck(env)) {
7585 (*env)->ExceptionDescribe(env);
7586 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
7588 LDKCVec_TxidZ ret_constr;
7589 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7590 if (ret_constr.datalen > 0)
7591 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
7593 ret_constr.data = NULL;
7594 for (size_t i = 0; i < ret_constr.datalen; i++) {
7595 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
7596 LDKThirtyTwoBytes ret_conv_8_ref;
7597 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
7598 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
7599 ret_constr.data[i] = ret_conv_8_ref;
7601 if (get_jenv_res == JNI_EDETACHED) {
7602 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7606 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
7607 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
7608 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7610 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
7611 jclass c = (*env)->GetObjectClass(env, o);
7613 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
7614 atomic_init(&calls->refcnt, 1);
7615 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7616 calls->o = (*env)->NewWeakGlobalRef(env, o);
7617 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
7618 CHECK(calls->transactions_confirmed_meth != NULL);
7619 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
7620 CHECK(calls->transaction_unconfirmed_meth != NULL);
7621 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
7622 CHECK(calls->best_block_updated_meth != NULL);
7623 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
7624 CHECK(calls->get_relevant_txids_meth != NULL);
7627 .this_arg = (void*) calls,
7628 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
7629 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
7630 .best_block_updated = best_block_updated_LDKConfirm_jcall,
7631 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
7632 .free = LDKConfirm_JCalls_free,
7636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
7637 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
7638 *res_ptr = LDKConfirm_init(env, clz, o);
7639 return (uint64_t)res_ptr;
7641 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) {
7642 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7643 unsigned char header_arr[80];
7644 CHECK((*env)->GetArrayLength(env, header) == 80);
7645 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7646 unsigned char (*header_ref)[80] = &header_arr;
7647 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7648 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7649 if (txdata_constr.datalen > 0)
7650 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7652 txdata_constr.data = NULL;
7653 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7654 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7655 int64_t txdata_conv_24 = txdata_vals[y];
7656 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
7657 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
7658 txdata_constr.data[y] = txdata_conv_24_conv;
7660 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7661 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
7664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
7665 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7666 unsigned char txid_arr[32];
7667 CHECK((*env)->GetArrayLength(env, txid) == 32);
7668 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7669 unsigned char (*txid_ref)[32] = &txid_arr;
7670 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
7673 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) {
7674 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7675 unsigned char header_arr[80];
7676 CHECK((*env)->GetArrayLength(env, header) == 80);
7677 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7678 unsigned char (*header_ref)[80] = &header_arr;
7679 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
7682 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
7683 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
7684 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
7685 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
7687 for (size_t i = 0; i < ret_var.datalen; i++) {
7688 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
7689 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
7690 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
7696 typedef struct LDKPersist_JCalls {
7697 atomic_size_t refcnt;
7700 jmethodID persist_new_channel_meth;
7701 jmethodID update_persisted_channel_meth;
7702 } LDKPersist_JCalls;
7703 static void LDKPersist_JCalls_free(void* this_arg) {
7704 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7705 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7707 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7708 if (get_jenv_res == JNI_EDETACHED) {
7709 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7711 DO_ASSERT(get_jenv_res == JNI_OK);
7713 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7714 if (get_jenv_res == JNI_EDETACHED) {
7715 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7720 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7721 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7723 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7724 if (get_jenv_res == JNI_EDETACHED) {
7725 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7727 DO_ASSERT(get_jenv_res == JNI_OK);
7729 LDKOutPoint id_var = id;
7730 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7731 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7732 uint64_t id_ref = (uint64_t)id_var.inner;
7733 if (id_var.is_owned) {
7736 LDKChannelMonitor data_var = *data;
7737 data_var = ChannelMonitor_clone(data);
7738 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7739 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7740 uint64_t data_ref = (uint64_t)data_var.inner;
7741 if (data_var.is_owned) {
7744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7746 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7747 if ((*env)->ExceptionCheck(env)) {
7748 (*env)->ExceptionDescribe(env);
7749 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7751 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7752 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7753 if (get_jenv_res == JNI_EDETACHED) {
7754 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7758 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7759 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7761 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7762 if (get_jenv_res == JNI_EDETACHED) {
7763 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7765 DO_ASSERT(get_jenv_res == JNI_OK);
7767 LDKOutPoint id_var = id;
7768 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7769 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7770 uint64_t id_ref = (uint64_t)id_var.inner;
7771 if (id_var.is_owned) {
7774 LDKChannelMonitorUpdate update_var = *update;
7775 update_var = ChannelMonitorUpdate_clone(update);
7776 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7777 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7778 uint64_t update_ref = (uint64_t)update_var.inner;
7779 if (update_var.is_owned) {
7782 LDKChannelMonitor data_var = *data;
7783 data_var = ChannelMonitor_clone(data);
7784 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7785 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7786 uint64_t data_ref = (uint64_t)data_var.inner;
7787 if (data_var.is_owned) {
7790 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7792 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7793 if ((*env)->ExceptionCheck(env)) {
7794 (*env)->ExceptionDescribe(env);
7795 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7797 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7798 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7799 if (get_jenv_res == JNI_EDETACHED) {
7800 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7804 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7805 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7806 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7808 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7809 jclass c = (*env)->GetObjectClass(env, o);
7811 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7812 atomic_init(&calls->refcnt, 1);
7813 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7814 calls->o = (*env)->NewWeakGlobalRef(env, o);
7815 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7816 CHECK(calls->persist_new_channel_meth != NULL);
7817 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7818 CHECK(calls->update_persisted_channel_meth != NULL);
7821 .this_arg = (void*) calls,
7822 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7823 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7824 .free = LDKPersist_JCalls_free,
7828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7829 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7830 *res_ptr = LDKPersist_init(env, clz, o);
7831 return (uint64_t)res_ptr;
7833 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) {
7834 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7835 LDKOutPoint id_conv;
7836 id_conv.inner = (void*)(id & (~1));
7837 id_conv.is_owned = (id & 1) || (id == 0);
7838 id_conv = OutPoint_clone(&id_conv);
7839 LDKChannelMonitor data_conv;
7840 data_conv.inner = (void*)(data & (~1));
7841 data_conv.is_owned = false;
7842 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7843 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7844 return (uint64_t)ret_conv;
7847 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) {
7848 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7849 LDKOutPoint id_conv;
7850 id_conv.inner = (void*)(id & (~1));
7851 id_conv.is_owned = (id & 1) || (id == 0);
7852 id_conv = OutPoint_clone(&id_conv);
7853 LDKChannelMonitorUpdate update_conv;
7854 update_conv.inner = (void*)(update & (~1));
7855 update_conv.is_owned = false;
7856 LDKChannelMonitor data_conv;
7857 data_conv.inner = (void*)(data & (~1));
7858 data_conv.is_owned = false;
7859 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7860 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7861 return (uint64_t)ret_conv;
7864 typedef struct LDKChannelMessageHandler_JCalls {
7865 atomic_size_t refcnt;
7868 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7869 jmethodID handle_open_channel_meth;
7870 jmethodID handle_accept_channel_meth;
7871 jmethodID handle_funding_created_meth;
7872 jmethodID handle_funding_signed_meth;
7873 jmethodID handle_funding_locked_meth;
7874 jmethodID handle_shutdown_meth;
7875 jmethodID handle_closing_signed_meth;
7876 jmethodID handle_update_add_htlc_meth;
7877 jmethodID handle_update_fulfill_htlc_meth;
7878 jmethodID handle_update_fail_htlc_meth;
7879 jmethodID handle_update_fail_malformed_htlc_meth;
7880 jmethodID handle_commitment_signed_meth;
7881 jmethodID handle_revoke_and_ack_meth;
7882 jmethodID handle_update_fee_meth;
7883 jmethodID handle_announcement_signatures_meth;
7884 jmethodID peer_disconnected_meth;
7885 jmethodID peer_connected_meth;
7886 jmethodID handle_channel_reestablish_meth;
7887 jmethodID handle_channel_update_meth;
7888 jmethodID handle_error_meth;
7889 } LDKChannelMessageHandler_JCalls;
7890 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7891 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7892 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7894 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7895 if (get_jenv_res == JNI_EDETACHED) {
7896 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7898 DO_ASSERT(get_jenv_res == JNI_OK);
7900 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7901 if (get_jenv_res == JNI_EDETACHED) {
7902 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7907 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7908 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7910 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7911 if (get_jenv_res == JNI_EDETACHED) {
7912 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7914 DO_ASSERT(get_jenv_res == JNI_OK);
7916 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7917 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7918 LDKInitFeatures their_features_var = their_features;
7919 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7920 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7921 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7922 if (their_features_var.is_owned) {
7923 their_features_ref |= 1;
7925 LDKOpenChannel msg_var = *msg;
7926 msg_var = OpenChannel_clone(msg);
7927 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7928 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7929 uint64_t msg_ref = (uint64_t)msg_var.inner;
7930 if (msg_var.is_owned) {
7933 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7935 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7936 if ((*env)->ExceptionCheck(env)) {
7937 (*env)->ExceptionDescribe(env);
7938 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
7940 if (get_jenv_res == JNI_EDETACHED) {
7941 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7944 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7945 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7947 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7948 if (get_jenv_res == JNI_EDETACHED) {
7949 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7951 DO_ASSERT(get_jenv_res == JNI_OK);
7953 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7954 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7955 LDKInitFeatures their_features_var = their_features;
7956 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7957 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7958 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7959 if (their_features_var.is_owned) {
7960 their_features_ref |= 1;
7962 LDKAcceptChannel msg_var = *msg;
7963 msg_var = AcceptChannel_clone(msg);
7964 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7965 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7966 uint64_t msg_ref = (uint64_t)msg_var.inner;
7967 if (msg_var.is_owned) {
7970 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7972 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7973 if ((*env)->ExceptionCheck(env)) {
7974 (*env)->ExceptionDescribe(env);
7975 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
7977 if (get_jenv_res == JNI_EDETACHED) {
7978 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7981 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7984 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7985 if (get_jenv_res == JNI_EDETACHED) {
7986 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7988 DO_ASSERT(get_jenv_res == JNI_OK);
7990 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7991 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7992 LDKFundingCreated msg_var = *msg;
7993 msg_var = FundingCreated_clone(msg);
7994 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7995 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7996 uint64_t msg_ref = (uint64_t)msg_var.inner;
7997 if (msg_var.is_owned) {
8000 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8002 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
8003 if ((*env)->ExceptionCheck(env)) {
8004 (*env)->ExceptionDescribe(env);
8005 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
8007 if (get_jenv_res == JNI_EDETACHED) {
8008 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8011 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
8012 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8014 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8015 if (get_jenv_res == JNI_EDETACHED) {
8016 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8018 DO_ASSERT(get_jenv_res == JNI_OK);
8020 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8021 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8022 LDKFundingSigned msg_var = *msg;
8023 msg_var = FundingSigned_clone(msg);
8024 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8025 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8026 uint64_t msg_ref = (uint64_t)msg_var.inner;
8027 if (msg_var.is_owned) {
8030 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8032 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
8033 if ((*env)->ExceptionCheck(env)) {
8034 (*env)->ExceptionDescribe(env);
8035 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
8037 if (get_jenv_res == JNI_EDETACHED) {
8038 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8041 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
8042 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8045 if (get_jenv_res == JNI_EDETACHED) {
8046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8048 DO_ASSERT(get_jenv_res == JNI_OK);
8050 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8051 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8052 LDKFundingLocked msg_var = *msg;
8053 msg_var = FundingLocked_clone(msg);
8054 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8055 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8056 uint64_t msg_ref = (uint64_t)msg_var.inner;
8057 if (msg_var.is_owned) {
8060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8062 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
8063 if ((*env)->ExceptionCheck(env)) {
8064 (*env)->ExceptionDescribe(env);
8065 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
8067 if (get_jenv_res == JNI_EDETACHED) {
8068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8071 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
8072 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8075 if (get_jenv_res == JNI_EDETACHED) {
8076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8078 DO_ASSERT(get_jenv_res == JNI_OK);
8080 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8081 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8082 LDKInitFeatures their_features_var = *their_features;
8083 their_features_var = InitFeatures_clone(their_features);
8084 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8085 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8086 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
8087 if (their_features_var.is_owned) {
8088 their_features_ref |= 1;
8090 LDKShutdown msg_var = *msg;
8091 msg_var = Shutdown_clone(msg);
8092 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8093 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8094 uint64_t msg_ref = (uint64_t)msg_var.inner;
8095 if (msg_var.is_owned) {
8098 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8100 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
8101 if ((*env)->ExceptionCheck(env)) {
8102 (*env)->ExceptionDescribe(env);
8103 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
8105 if (get_jenv_res == JNI_EDETACHED) {
8106 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8109 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
8110 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8113 if (get_jenv_res == JNI_EDETACHED) {
8114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8116 DO_ASSERT(get_jenv_res == JNI_OK);
8118 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8119 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8120 LDKClosingSigned msg_var = *msg;
8121 msg_var = ClosingSigned_clone(msg);
8122 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8123 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8124 uint64_t msg_ref = (uint64_t)msg_var.inner;
8125 if (msg_var.is_owned) {
8128 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8130 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
8131 if ((*env)->ExceptionCheck(env)) {
8132 (*env)->ExceptionDescribe(env);
8133 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
8135 if (get_jenv_res == JNI_EDETACHED) {
8136 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8139 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
8140 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8142 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8143 if (get_jenv_res == JNI_EDETACHED) {
8144 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8146 DO_ASSERT(get_jenv_res == JNI_OK);
8148 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8149 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8150 LDKUpdateAddHTLC msg_var = *msg;
8151 msg_var = UpdateAddHTLC_clone(msg);
8152 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8153 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8154 uint64_t msg_ref = (uint64_t)msg_var.inner;
8155 if (msg_var.is_owned) {
8158 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8160 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
8161 if ((*env)->ExceptionCheck(env)) {
8162 (*env)->ExceptionDescribe(env);
8163 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
8165 if (get_jenv_res == JNI_EDETACHED) {
8166 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8169 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
8170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8172 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8173 if (get_jenv_res == JNI_EDETACHED) {
8174 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8176 DO_ASSERT(get_jenv_res == JNI_OK);
8178 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8179 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8180 LDKUpdateFulfillHTLC msg_var = *msg;
8181 msg_var = UpdateFulfillHTLC_clone(msg);
8182 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8183 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8184 uint64_t msg_ref = (uint64_t)msg_var.inner;
8185 if (msg_var.is_owned) {
8188 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8190 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
8191 if ((*env)->ExceptionCheck(env)) {
8192 (*env)->ExceptionDescribe(env);
8193 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
8195 if (get_jenv_res == JNI_EDETACHED) {
8196 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8199 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
8200 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8202 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8203 if (get_jenv_res == JNI_EDETACHED) {
8204 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8206 DO_ASSERT(get_jenv_res == JNI_OK);
8208 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8209 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8210 LDKUpdateFailHTLC msg_var = *msg;
8211 msg_var = UpdateFailHTLC_clone(msg);
8212 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8213 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8214 uint64_t msg_ref = (uint64_t)msg_var.inner;
8215 if (msg_var.is_owned) {
8218 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8220 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
8221 if ((*env)->ExceptionCheck(env)) {
8222 (*env)->ExceptionDescribe(env);
8223 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
8225 if (get_jenv_res == JNI_EDETACHED) {
8226 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8229 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
8230 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8232 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8233 if (get_jenv_res == JNI_EDETACHED) {
8234 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8236 DO_ASSERT(get_jenv_res == JNI_OK);
8238 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8239 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8240 LDKUpdateFailMalformedHTLC msg_var = *msg;
8241 msg_var = UpdateFailMalformedHTLC_clone(msg);
8242 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8243 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8244 uint64_t msg_ref = (uint64_t)msg_var.inner;
8245 if (msg_var.is_owned) {
8248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8250 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
8251 if ((*env)->ExceptionCheck(env)) {
8252 (*env)->ExceptionDescribe(env);
8253 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
8255 if (get_jenv_res == JNI_EDETACHED) {
8256 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8259 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
8260 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8262 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8263 if (get_jenv_res == JNI_EDETACHED) {
8264 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8266 DO_ASSERT(get_jenv_res == JNI_OK);
8268 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8269 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8270 LDKCommitmentSigned msg_var = *msg;
8271 msg_var = CommitmentSigned_clone(msg);
8272 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8273 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8274 uint64_t msg_ref = (uint64_t)msg_var.inner;
8275 if (msg_var.is_owned) {
8278 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8280 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
8281 if ((*env)->ExceptionCheck(env)) {
8282 (*env)->ExceptionDescribe(env);
8283 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
8285 if (get_jenv_res == JNI_EDETACHED) {
8286 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8289 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
8290 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8292 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8293 if (get_jenv_res == JNI_EDETACHED) {
8294 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8296 DO_ASSERT(get_jenv_res == JNI_OK);
8298 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8299 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8300 LDKRevokeAndACK msg_var = *msg;
8301 msg_var = RevokeAndACK_clone(msg);
8302 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8303 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8304 uint64_t msg_ref = (uint64_t)msg_var.inner;
8305 if (msg_var.is_owned) {
8308 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8310 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
8311 if ((*env)->ExceptionCheck(env)) {
8312 (*env)->ExceptionDescribe(env);
8313 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
8315 if (get_jenv_res == JNI_EDETACHED) {
8316 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8319 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
8320 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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 LDKUpdateFee msg_var = *msg;
8331 msg_var = UpdateFee_clone(msg);
8332 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8333 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8334 uint64_t msg_ref = (uint64_t)msg_var.inner;
8335 if (msg_var.is_owned) {
8338 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8340 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
8341 if ((*env)->ExceptionCheck(env)) {
8342 (*env)->ExceptionDescribe(env);
8343 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
8345 if (get_jenv_res == JNI_EDETACHED) {
8346 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8349 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
8350 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8352 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8353 if (get_jenv_res == JNI_EDETACHED) {
8354 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8356 DO_ASSERT(get_jenv_res == JNI_OK);
8358 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8359 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8360 LDKAnnouncementSignatures msg_var = *msg;
8361 msg_var = AnnouncementSignatures_clone(msg);
8362 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8363 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8364 uint64_t msg_ref = (uint64_t)msg_var.inner;
8365 if (msg_var.is_owned) {
8368 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8370 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
8371 if ((*env)->ExceptionCheck(env)) {
8372 (*env)->ExceptionDescribe(env);
8373 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
8375 if (get_jenv_res == JNI_EDETACHED) {
8376 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8379 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
8380 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8382 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8383 if (get_jenv_res == JNI_EDETACHED) {
8384 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8386 DO_ASSERT(get_jenv_res == JNI_OK);
8388 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8389 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8390 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8392 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
8393 if ((*env)->ExceptionCheck(env)) {
8394 (*env)->ExceptionDescribe(env);
8395 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
8397 if (get_jenv_res == JNI_EDETACHED) {
8398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8401 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
8402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8404 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8405 if (get_jenv_res == JNI_EDETACHED) {
8406 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8408 DO_ASSERT(get_jenv_res == JNI_OK);
8410 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8411 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8412 LDKInit msg_var = *msg;
8413 msg_var = Init_clone(msg);
8414 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8415 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8416 uint64_t msg_ref = (uint64_t)msg_var.inner;
8417 if (msg_var.is_owned) {
8420 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8422 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
8423 if ((*env)->ExceptionCheck(env)) {
8424 (*env)->ExceptionDescribe(env);
8425 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
8427 if (get_jenv_res == JNI_EDETACHED) {
8428 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8431 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
8432 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8435 if (get_jenv_res == JNI_EDETACHED) {
8436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8438 DO_ASSERT(get_jenv_res == JNI_OK);
8440 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8441 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8442 LDKChannelReestablish msg_var = *msg;
8443 msg_var = ChannelReestablish_clone(msg);
8444 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8445 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8446 uint64_t msg_ref = (uint64_t)msg_var.inner;
8447 if (msg_var.is_owned) {
8450 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8452 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
8453 if ((*env)->ExceptionCheck(env)) {
8454 (*env)->ExceptionDescribe(env);
8455 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
8457 if (get_jenv_res == JNI_EDETACHED) {
8458 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8461 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
8462 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8464 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8465 if (get_jenv_res == JNI_EDETACHED) {
8466 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8468 DO_ASSERT(get_jenv_res == JNI_OK);
8470 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8471 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8472 LDKChannelUpdate msg_var = *msg;
8473 msg_var = ChannelUpdate_clone(msg);
8474 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8475 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8476 uint64_t msg_ref = (uint64_t)msg_var.inner;
8477 if (msg_var.is_owned) {
8480 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8482 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
8483 if ((*env)->ExceptionCheck(env)) {
8484 (*env)->ExceptionDescribe(env);
8485 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
8487 if (get_jenv_res == JNI_EDETACHED) {
8488 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8491 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
8492 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
8494 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8495 if (get_jenv_res == JNI_EDETACHED) {
8496 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8498 DO_ASSERT(get_jenv_res == JNI_OK);
8500 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8501 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8502 LDKErrorMessage msg_var = *msg;
8503 msg_var = ErrorMessage_clone(msg);
8504 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8505 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8506 uint64_t msg_ref = (uint64_t)msg_var.inner;
8507 if (msg_var.is_owned) {
8510 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8512 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
8513 if ((*env)->ExceptionCheck(env)) {
8514 (*env)->ExceptionDescribe(env);
8515 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
8517 if (get_jenv_res == JNI_EDETACHED) {
8518 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8521 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
8522 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
8523 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8524 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8526 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8527 jclass c = (*env)->GetObjectClass(env, o);
8529 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
8530 atomic_init(&calls->refcnt, 1);
8531 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8532 calls->o = (*env)->NewWeakGlobalRef(env, o);
8533 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
8534 CHECK(calls->handle_open_channel_meth != NULL);
8535 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
8536 CHECK(calls->handle_accept_channel_meth != NULL);
8537 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
8538 CHECK(calls->handle_funding_created_meth != NULL);
8539 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
8540 CHECK(calls->handle_funding_signed_meth != NULL);
8541 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
8542 CHECK(calls->handle_funding_locked_meth != NULL);
8543 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
8544 CHECK(calls->handle_shutdown_meth != NULL);
8545 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
8546 CHECK(calls->handle_closing_signed_meth != NULL);
8547 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
8548 CHECK(calls->handle_update_add_htlc_meth != NULL);
8549 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
8550 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
8551 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
8552 CHECK(calls->handle_update_fail_htlc_meth != NULL);
8553 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
8554 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
8555 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
8556 CHECK(calls->handle_commitment_signed_meth != NULL);
8557 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
8558 CHECK(calls->handle_revoke_and_ack_meth != NULL);
8559 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
8560 CHECK(calls->handle_update_fee_meth != NULL);
8561 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
8562 CHECK(calls->handle_announcement_signatures_meth != NULL);
8563 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
8564 CHECK(calls->peer_disconnected_meth != NULL);
8565 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
8566 CHECK(calls->peer_connected_meth != NULL);
8567 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
8568 CHECK(calls->handle_channel_reestablish_meth != NULL);
8569 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
8570 CHECK(calls->handle_channel_update_meth != NULL);
8571 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
8572 CHECK(calls->handle_error_meth != NULL);
8574 LDKChannelMessageHandler ret = {
8575 .this_arg = (void*) calls,
8576 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
8577 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
8578 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
8579 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
8580 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
8581 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
8582 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
8583 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
8584 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
8585 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
8586 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
8587 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
8588 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
8589 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
8590 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
8591 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
8592 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
8593 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
8594 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
8595 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
8596 .free = LDKChannelMessageHandler_JCalls_free,
8597 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8599 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8603 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
8604 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8605 return (uint64_t)res_ptr;
8607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8608 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
8609 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8610 DO_ASSERT((res_ptr & 1) == 0);
8611 return (int64_t)(res_ptr | 1);
8613 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) {
8614 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8615 LDKPublicKey their_node_id_ref;
8616 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8617 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8618 LDKInitFeatures their_features_conv;
8619 their_features_conv.inner = (void*)(their_features & (~1));
8620 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8621 their_features_conv = InitFeatures_clone(&their_features_conv);
8622 LDKOpenChannel msg_conv;
8623 msg_conv.inner = (void*)(msg & (~1));
8624 msg_conv.is_owned = false;
8625 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8628 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) {
8629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8630 LDKPublicKey their_node_id_ref;
8631 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8632 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8633 LDKInitFeatures their_features_conv;
8634 their_features_conv.inner = (void*)(their_features & (~1));
8635 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8636 their_features_conv = InitFeatures_clone(&their_features_conv);
8637 LDKAcceptChannel msg_conv;
8638 msg_conv.inner = (void*)(msg & (~1));
8639 msg_conv.is_owned = false;
8640 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8643 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) {
8644 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8645 LDKPublicKey their_node_id_ref;
8646 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8647 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8648 LDKFundingCreated msg_conv;
8649 msg_conv.inner = (void*)(msg & (~1));
8650 msg_conv.is_owned = false;
8651 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8654 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) {
8655 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8656 LDKPublicKey their_node_id_ref;
8657 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8658 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8659 LDKFundingSigned msg_conv;
8660 msg_conv.inner = (void*)(msg & (~1));
8661 msg_conv.is_owned = false;
8662 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8665 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) {
8666 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8667 LDKPublicKey their_node_id_ref;
8668 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8669 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8670 LDKFundingLocked msg_conv;
8671 msg_conv.inner = (void*)(msg & (~1));
8672 msg_conv.is_owned = false;
8673 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8676 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) {
8677 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8678 LDKPublicKey their_node_id_ref;
8679 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8680 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8681 LDKInitFeatures their_features_conv;
8682 their_features_conv.inner = (void*)(their_features & (~1));
8683 their_features_conv.is_owned = false;
8684 LDKShutdown msg_conv;
8685 msg_conv.inner = (void*)(msg & (~1));
8686 msg_conv.is_owned = false;
8687 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8690 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) {
8691 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8692 LDKPublicKey their_node_id_ref;
8693 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8694 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8695 LDKClosingSigned msg_conv;
8696 msg_conv.inner = (void*)(msg & (~1));
8697 msg_conv.is_owned = false;
8698 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8701 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) {
8702 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8703 LDKPublicKey their_node_id_ref;
8704 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8705 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8706 LDKUpdateAddHTLC msg_conv;
8707 msg_conv.inner = (void*)(msg & (~1));
8708 msg_conv.is_owned = false;
8709 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8712 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) {
8713 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8714 LDKPublicKey their_node_id_ref;
8715 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8716 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8717 LDKUpdateFulfillHTLC msg_conv;
8718 msg_conv.inner = (void*)(msg & (~1));
8719 msg_conv.is_owned = false;
8720 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8723 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) {
8724 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8725 LDKPublicKey their_node_id_ref;
8726 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8727 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8728 LDKUpdateFailHTLC msg_conv;
8729 msg_conv.inner = (void*)(msg & (~1));
8730 msg_conv.is_owned = false;
8731 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8734 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) {
8735 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8736 LDKPublicKey their_node_id_ref;
8737 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8738 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8739 LDKUpdateFailMalformedHTLC msg_conv;
8740 msg_conv.inner = (void*)(msg & (~1));
8741 msg_conv.is_owned = false;
8742 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8745 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) {
8746 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8747 LDKPublicKey their_node_id_ref;
8748 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8749 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8750 LDKCommitmentSigned msg_conv;
8751 msg_conv.inner = (void*)(msg & (~1));
8752 msg_conv.is_owned = false;
8753 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8756 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) {
8757 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8758 LDKPublicKey their_node_id_ref;
8759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8761 LDKRevokeAndACK msg_conv;
8762 msg_conv.inner = (void*)(msg & (~1));
8763 msg_conv.is_owned = false;
8764 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8767 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) {
8768 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8769 LDKPublicKey their_node_id_ref;
8770 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8771 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8772 LDKUpdateFee msg_conv;
8773 msg_conv.inner = (void*)(msg & (~1));
8774 msg_conv.is_owned = false;
8775 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8778 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) {
8779 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8780 LDKPublicKey their_node_id_ref;
8781 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8782 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8783 LDKAnnouncementSignatures msg_conv;
8784 msg_conv.inner = (void*)(msg & (~1));
8785 msg_conv.is_owned = false;
8786 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8789 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) {
8790 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8791 LDKPublicKey their_node_id_ref;
8792 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8793 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8794 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8797 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) {
8798 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8799 LDKPublicKey their_node_id_ref;
8800 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8801 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8803 msg_conv.inner = (void*)(msg & (~1));
8804 msg_conv.is_owned = false;
8805 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8808 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) {
8809 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8810 LDKPublicKey their_node_id_ref;
8811 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8812 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8813 LDKChannelReestablish msg_conv;
8814 msg_conv.inner = (void*)(msg & (~1));
8815 msg_conv.is_owned = false;
8816 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8819 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) {
8820 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8821 LDKPublicKey their_node_id_ref;
8822 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8823 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8824 LDKChannelUpdate msg_conv;
8825 msg_conv.inner = (void*)(msg & (~1));
8826 msg_conv.is_owned = false;
8827 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8830 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) {
8831 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8832 LDKPublicKey their_node_id_ref;
8833 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8834 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8835 LDKErrorMessage msg_conv;
8836 msg_conv.inner = (void*)(msg & (~1));
8837 msg_conv.is_owned = false;
8838 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8841 typedef struct LDKRoutingMessageHandler_JCalls {
8842 atomic_size_t refcnt;
8845 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8846 jmethodID handle_node_announcement_meth;
8847 jmethodID handle_channel_announcement_meth;
8848 jmethodID handle_channel_update_meth;
8849 jmethodID get_next_channel_announcements_meth;
8850 jmethodID get_next_node_announcements_meth;
8851 jmethodID sync_routing_table_meth;
8852 jmethodID handle_reply_channel_range_meth;
8853 jmethodID handle_reply_short_channel_ids_end_meth;
8854 jmethodID handle_query_channel_range_meth;
8855 jmethodID handle_query_short_channel_ids_meth;
8856 } LDKRoutingMessageHandler_JCalls;
8857 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8858 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8859 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8861 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8862 if (get_jenv_res == JNI_EDETACHED) {
8863 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8865 DO_ASSERT(get_jenv_res == JNI_OK);
8867 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8868 if (get_jenv_res == JNI_EDETACHED) {
8869 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8874 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8875 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8877 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8878 if (get_jenv_res == JNI_EDETACHED) {
8879 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8881 DO_ASSERT(get_jenv_res == JNI_OK);
8883 LDKNodeAnnouncement msg_var = *msg;
8884 msg_var = NodeAnnouncement_clone(msg);
8885 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8886 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8887 uint64_t msg_ref = (uint64_t)msg_var.inner;
8888 if (msg_var.is_owned) {
8891 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8893 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8894 if ((*env)->ExceptionCheck(env)) {
8895 (*env)->ExceptionDescribe(env);
8896 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8898 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8899 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8900 if (get_jenv_res == JNI_EDETACHED) {
8901 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8905 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8906 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8908 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8909 if (get_jenv_res == JNI_EDETACHED) {
8910 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8912 DO_ASSERT(get_jenv_res == JNI_OK);
8914 LDKChannelAnnouncement msg_var = *msg;
8915 msg_var = ChannelAnnouncement_clone(msg);
8916 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8917 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8918 uint64_t msg_ref = (uint64_t)msg_var.inner;
8919 if (msg_var.is_owned) {
8922 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8924 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8925 if ((*env)->ExceptionCheck(env)) {
8926 (*env)->ExceptionDescribe(env);
8927 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8929 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8930 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8931 if (get_jenv_res == JNI_EDETACHED) {
8932 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8936 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8937 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8939 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8940 if (get_jenv_res == JNI_EDETACHED) {
8941 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8943 DO_ASSERT(get_jenv_res == JNI_OK);
8945 LDKChannelUpdate msg_var = *msg;
8946 msg_var = ChannelUpdate_clone(msg);
8947 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8948 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8949 uint64_t msg_ref = (uint64_t)msg_var.inner;
8950 if (msg_var.is_owned) {
8953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8955 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8956 if ((*env)->ExceptionCheck(env)) {
8957 (*env)->ExceptionDescribe(env);
8958 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8960 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8961 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8962 if (get_jenv_res == JNI_EDETACHED) {
8963 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8967 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8968 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8970 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8971 if (get_jenv_res == JNI_EDETACHED) {
8972 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8974 DO_ASSERT(get_jenv_res == JNI_OK);
8976 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8978 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8979 if ((*env)->ExceptionCheck(env)) {
8980 (*env)->ExceptionDescribe(env);
8981 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8983 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8984 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8985 if (ret_constr.datalen > 0)
8986 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8988 ret_constr.data = NULL;
8989 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8990 for (size_t l = 0; l < ret_constr.datalen; l++) {
8991 int64_t ret_conv_63 = ret_vals[l];
8992 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8993 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8994 ret_constr.data[l] = ret_conv_63_conv;
8996 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8997 if (get_jenv_res == JNI_EDETACHED) {
8998 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9002 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
9003 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9005 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9006 if (get_jenv_res == JNI_EDETACHED) {
9007 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9009 DO_ASSERT(get_jenv_res == JNI_OK);
9011 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
9012 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
9013 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9015 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
9016 if ((*env)->ExceptionCheck(env)) {
9017 (*env)->ExceptionDescribe(env);
9018 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
9020 LDKCVec_NodeAnnouncementZ ret_constr;
9021 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9022 if (ret_constr.datalen > 0)
9023 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
9025 ret_constr.data = NULL;
9026 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9027 for (size_t s = 0; s < ret_constr.datalen; s++) {
9028 int64_t ret_conv_18 = ret_vals[s];
9029 LDKNodeAnnouncement ret_conv_18_conv;
9030 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
9031 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
9032 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
9033 ret_constr.data[s] = ret_conv_18_conv;
9035 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9036 if (get_jenv_res == JNI_EDETACHED) {
9037 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9041 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9042 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9044 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9045 if (get_jenv_res == JNI_EDETACHED) {
9046 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9048 DO_ASSERT(get_jenv_res == JNI_OK);
9050 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9051 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9052 LDKInit init_var = *init;
9053 init_var = Init_clone(init);
9054 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9055 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9056 uint64_t init_ref = (uint64_t)init_var.inner;
9057 if (init_var.is_owned) {
9060 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9062 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
9063 if ((*env)->ExceptionCheck(env)) {
9064 (*env)->ExceptionDescribe(env);
9065 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
9067 if (get_jenv_res == JNI_EDETACHED) {
9068 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9071 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9072 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9074 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9075 if (get_jenv_res == JNI_EDETACHED) {
9076 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9078 DO_ASSERT(get_jenv_res == JNI_OK);
9080 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9081 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9082 LDKReplyChannelRange msg_var = msg;
9083 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9084 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9085 uint64_t msg_ref = (uint64_t)msg_var.inner;
9086 if (msg_var.is_owned) {
9089 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9091 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
9092 if ((*env)->ExceptionCheck(env)) {
9093 (*env)->ExceptionDescribe(env);
9094 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9096 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9097 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9098 if (get_jenv_res == JNI_EDETACHED) {
9099 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9103 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9104 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9106 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9107 if (get_jenv_res == JNI_EDETACHED) {
9108 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9110 DO_ASSERT(get_jenv_res == JNI_OK);
9112 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9113 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9114 LDKReplyShortChannelIdsEnd msg_var = msg;
9115 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9116 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9117 uint64_t msg_ref = (uint64_t)msg_var.inner;
9118 if (msg_var.is_owned) {
9121 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9123 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
9124 if ((*env)->ExceptionCheck(env)) {
9125 (*env)->ExceptionDescribe(env);
9126 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
9128 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9129 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9130 if (get_jenv_res == JNI_EDETACHED) {
9131 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9135 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9136 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9138 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9139 if (get_jenv_res == JNI_EDETACHED) {
9140 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9142 DO_ASSERT(get_jenv_res == JNI_OK);
9144 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9145 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9146 LDKQueryChannelRange msg_var = msg;
9147 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9148 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9149 uint64_t msg_ref = (uint64_t)msg_var.inner;
9150 if (msg_var.is_owned) {
9153 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9155 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
9156 if ((*env)->ExceptionCheck(env)) {
9157 (*env)->ExceptionDescribe(env);
9158 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
9160 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9161 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9162 if (get_jenv_res == JNI_EDETACHED) {
9163 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9167 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9168 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9170 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9171 if (get_jenv_res == JNI_EDETACHED) {
9172 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9174 DO_ASSERT(get_jenv_res == JNI_OK);
9176 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
9177 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
9178 LDKQueryShortChannelIds msg_var = msg;
9179 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9180 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9181 uint64_t msg_ref = (uint64_t)msg_var.inner;
9182 if (msg_var.is_owned) {
9185 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9187 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
9188 if ((*env)->ExceptionCheck(env)) {
9189 (*env)->ExceptionDescribe(env);
9190 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
9192 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9193 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9194 if (get_jenv_res == JNI_EDETACHED) {
9195 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9199 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9200 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9201 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9202 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9204 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9205 jclass c = (*env)->GetObjectClass(env, o);
9207 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9208 atomic_init(&calls->refcnt, 1);
9209 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9210 calls->o = (*env)->NewWeakGlobalRef(env, o);
9211 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
9212 CHECK(calls->handle_node_announcement_meth != NULL);
9213 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
9214 CHECK(calls->handle_channel_announcement_meth != NULL);
9215 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
9216 CHECK(calls->handle_channel_update_meth != NULL);
9217 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
9218 CHECK(calls->get_next_channel_announcements_meth != NULL);
9219 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
9220 CHECK(calls->get_next_node_announcements_meth != NULL);
9221 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
9222 CHECK(calls->sync_routing_table_meth != NULL);
9223 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
9224 CHECK(calls->handle_reply_channel_range_meth != NULL);
9225 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
9226 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
9227 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
9228 CHECK(calls->handle_query_channel_range_meth != NULL);
9229 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
9230 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
9232 LDKRoutingMessageHandler ret = {
9233 .this_arg = (void*) calls,
9234 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9235 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9236 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9237 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
9238 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
9239 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
9240 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9241 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9242 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9243 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9244 .free = LDKRoutingMessageHandler_JCalls_free,
9245 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
9247 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
9251 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9252 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
9253 return (uint64_t)res_ptr;
9255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
9256 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
9257 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
9258 DO_ASSERT((res_ptr & 1) == 0);
9259 return (int64_t)(res_ptr | 1);
9261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9262 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9263 LDKNodeAnnouncement msg_conv;
9264 msg_conv.inner = (void*)(msg & (~1));
9265 msg_conv.is_owned = false;
9266 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9267 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9268 return (uint64_t)ret_conv;
9271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9272 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9273 LDKChannelAnnouncement msg_conv;
9274 msg_conv.inner = (void*)(msg & (~1));
9275 msg_conv.is_owned = false;
9276 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9277 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9278 return (uint64_t)ret_conv;
9281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9282 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9283 LDKChannelUpdate msg_conv;
9284 msg_conv.inner = (void*)(msg & (~1));
9285 msg_conv.is_owned = false;
9286 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9287 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9288 return (uint64_t)ret_conv;
9291 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) {
9292 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9293 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
9294 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9295 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9296 for (size_t l = 0; l < ret_var.datalen; l++) {
9297 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
9298 *ret_conv_63_ref = ret_var.data[l];
9299 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
9301 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9306 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) {
9307 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9308 LDKPublicKey starting_point_ref;
9309 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
9310 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
9311 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
9312 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9313 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9314 for (size_t s = 0; s < ret_var.datalen; s++) {
9315 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
9316 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9317 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9318 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
9319 if (ret_conv_18_var.is_owned) {
9320 ret_conv_18_ref |= 1;
9322 ret_arr_ptr[s] = ret_conv_18_ref;
9324 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9329 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) {
9330 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9331 LDKPublicKey their_node_id_ref;
9332 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9333 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9335 init_conv.inner = (void*)(init & (~1));
9336 init_conv.is_owned = false;
9337 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9340 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) {
9341 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9342 LDKPublicKey their_node_id_ref;
9343 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9344 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9345 LDKReplyChannelRange msg_conv;
9346 msg_conv.inner = (void*)(msg & (~1));
9347 msg_conv.is_owned = (msg & 1) || (msg == 0);
9348 msg_conv = ReplyChannelRange_clone(&msg_conv);
9349 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9350 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9351 return (uint64_t)ret_conv;
9354 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) {
9355 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9356 LDKPublicKey their_node_id_ref;
9357 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9358 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9359 LDKReplyShortChannelIdsEnd msg_conv;
9360 msg_conv.inner = (void*)(msg & (~1));
9361 msg_conv.is_owned = (msg & 1) || (msg == 0);
9362 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
9363 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9364 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9365 return (uint64_t)ret_conv;
9368 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) {
9369 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9370 LDKPublicKey their_node_id_ref;
9371 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9372 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9373 LDKQueryChannelRange msg_conv;
9374 msg_conv.inner = (void*)(msg & (~1));
9375 msg_conv.is_owned = (msg & 1) || (msg == 0);
9376 msg_conv = QueryChannelRange_clone(&msg_conv);
9377 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9378 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9379 return (uint64_t)ret_conv;
9382 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) {
9383 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
9384 LDKPublicKey their_node_id_ref;
9385 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
9386 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9387 LDKQueryShortChannelIds msg_conv;
9388 msg_conv.inner = (void*)(msg & (~1));
9389 msg_conv.is_owned = (msg & 1) || (msg == 0);
9390 msg_conv = QueryShortChannelIds_clone(&msg_conv);
9391 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9392 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9393 return (uint64_t)ret_conv;
9396 typedef struct LDKCustomMessageReader_JCalls {
9397 atomic_size_t refcnt;
9400 jmethodID read_meth;
9401 } LDKCustomMessageReader_JCalls;
9402 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
9403 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9404 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9406 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9407 if (get_jenv_res == JNI_EDETACHED) {
9408 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9410 DO_ASSERT(get_jenv_res == JNI_OK);
9412 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9413 if (get_jenv_res == JNI_EDETACHED) {
9414 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9419 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
9420 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
9422 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9423 if (get_jenv_res == JNI_EDETACHED) {
9424 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9426 DO_ASSERT(get_jenv_res == JNI_OK);
9428 LDKu8slice buffer_var = buffer;
9429 int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
9430 (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
9431 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9433 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
9434 if ((*env)->ExceptionCheck(env)) {
9435 (*env)->ExceptionDescribe(env);
9436 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
9438 LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
9439 ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
9440 if (get_jenv_res == JNI_EDETACHED) {
9441 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9445 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
9446 LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
9447 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9449 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
9450 jclass c = (*env)->GetObjectClass(env, o);
9452 LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
9453 atomic_init(&calls->refcnt, 1);
9454 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9455 calls->o = (*env)->NewWeakGlobalRef(env, o);
9456 calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
9457 CHECK(calls->read_meth != NULL);
9459 LDKCustomMessageReader ret = {
9460 .this_arg = (void*) calls,
9461 .read = read_LDKCustomMessageReader_jcall,
9462 .free = LDKCustomMessageReader_JCalls_free,
9466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
9467 LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
9468 *res_ptr = LDKCustomMessageReader_init(env, clz, o);
9469 return (uint64_t)res_ptr;
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
9472 LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
9473 LDKu8slice buffer_ref;
9474 buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
9475 buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
9476 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
9477 *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
9478 (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
9479 return (uint64_t)ret_conv;
9482 typedef struct LDKCustomMessageHandler_JCalls {
9483 atomic_size_t refcnt;
9486 LDKCustomMessageReader_JCalls* CustomMessageReader;
9487 jmethodID handle_custom_message_meth;
9488 jmethodID get_and_clear_pending_msg_meth;
9489 } LDKCustomMessageHandler_JCalls;
9490 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
9491 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9492 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9494 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9495 if (get_jenv_res == JNI_EDETACHED) {
9496 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9498 DO_ASSERT(get_jenv_res == JNI_OK);
9500 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9501 if (get_jenv_res == JNI_EDETACHED) {
9502 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9507 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
9508 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9510 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9511 if (get_jenv_res == JNI_EDETACHED) {
9512 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9514 DO_ASSERT(get_jenv_res == JNI_OK);
9516 LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
9518 int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
9519 (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
9520 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9522 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
9523 if ((*env)->ExceptionCheck(env)) {
9524 (*env)->ExceptionDescribe(env);
9525 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
9527 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
9528 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
9529 if (get_jenv_res == JNI_EDETACHED) {
9530 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9534 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
9535 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
9537 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9538 if (get_jenv_res == JNI_EDETACHED) {
9539 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9541 DO_ASSERT(get_jenv_res == JNI_OK);
9543 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9545 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
9546 if ((*env)->ExceptionCheck(env)) {
9547 (*env)->ExceptionDescribe(env);
9548 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
9550 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
9551 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9552 if (ret_constr.datalen > 0)
9553 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
9555 ret_constr.data = NULL;
9556 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9557 for (size_t y = 0; y < ret_constr.datalen; y++) {
9558 int64_t ret_conv_24 = ret_vals[y];
9559 LDKC2Tuple_PublicKeyTypeZ ret_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1);
9560 ret_conv_24_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1));
9561 ret_constr.data[y] = ret_conv_24_conv;
9563 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9564 if (get_jenv_res == JNI_EDETACHED) {
9565 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9569 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
9570 LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
9571 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9572 atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
9574 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9575 jclass c = (*env)->GetObjectClass(env, o);
9577 LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
9578 atomic_init(&calls->refcnt, 1);
9579 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9580 calls->o = (*env)->NewWeakGlobalRef(env, o);
9581 calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
9582 CHECK(calls->handle_custom_message_meth != NULL);
9583 calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
9584 CHECK(calls->get_and_clear_pending_msg_meth != NULL);
9586 LDKCustomMessageHandler ret = {
9587 .this_arg = (void*) calls,
9588 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
9589 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
9590 .free = LDKCustomMessageHandler_JCalls_free,
9591 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
9593 calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
9596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
9597 LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
9598 *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
9599 return (uint64_t)res_ptr;
9601 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
9602 LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
9603 uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
9604 DO_ASSERT((res_ptr & 1) == 0);
9605 return (int64_t)(res_ptr | 1);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
9608 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9609 LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
9610 if (msg_conv.free == LDKType_JCalls_free) {
9611 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9612 LDKType_JCalls_cloned(&msg_conv);
9614 LDKPublicKey sender_node_id_ref;
9615 CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
9616 (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
9617 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9618 *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
9619 return (uint64_t)ret_conv;
9622 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
9623 LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
9624 LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
9625 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9626 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9627 for (size_t y = 0; y < ret_var.datalen; y++) {
9628 LDKC2Tuple_PublicKeyTypeZ* ret_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
9629 *ret_conv_24_ref = ret_var.data[y];
9630 ret_arr_ptr[y] = (uint64_t)ret_conv_24_ref;
9632 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9637 typedef struct LDKSocketDescriptor_JCalls {
9638 atomic_size_t refcnt;
9641 jmethodID send_data_meth;
9642 jmethodID disconnect_socket_meth;
9644 jmethodID hash_meth;
9645 } LDKSocketDescriptor_JCalls;
9646 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
9647 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9648 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9650 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9651 if (get_jenv_res == JNI_EDETACHED) {
9652 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9654 DO_ASSERT(get_jenv_res == JNI_OK);
9656 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9657 if (get_jenv_res == JNI_EDETACHED) {
9658 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9663 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
9664 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9666 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9667 if (get_jenv_res == JNI_EDETACHED) {
9668 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9670 DO_ASSERT(get_jenv_res == JNI_OK);
9672 LDKu8slice data_var = data;
9673 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
9674 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
9675 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9677 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
9678 if ((*env)->ExceptionCheck(env)) {
9679 (*env)->ExceptionDescribe(env);
9680 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
9682 if (get_jenv_res == JNI_EDETACHED) {
9683 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9687 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
9688 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9690 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9691 if (get_jenv_res == JNI_EDETACHED) {
9692 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9694 DO_ASSERT(get_jenv_res == JNI_OK);
9696 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9698 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
9699 if ((*env)->ExceptionCheck(env)) {
9700 (*env)->ExceptionDescribe(env);
9701 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
9703 if (get_jenv_res == JNI_EDETACHED) {
9704 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9707 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
9708 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9710 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9711 if (get_jenv_res == JNI_EDETACHED) {
9712 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9714 DO_ASSERT(get_jenv_res == JNI_OK);
9716 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9717 *other_arg_clone = SocketDescriptor_clone(other_arg);
9718 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9720 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
9721 if ((*env)->ExceptionCheck(env)) {
9722 (*env)->ExceptionDescribe(env);
9723 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
9725 if (get_jenv_res == JNI_EDETACHED) {
9726 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9730 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
9731 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
9733 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9734 if (get_jenv_res == JNI_EDETACHED) {
9735 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9737 DO_ASSERT(get_jenv_res == JNI_OK);
9739 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9741 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
9742 if ((*env)->ExceptionCheck(env)) {
9743 (*env)->ExceptionDescribe(env);
9744 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
9746 if (get_jenv_res == JNI_EDETACHED) {
9747 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9751 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
9752 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
9753 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9755 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
9756 jclass c = (*env)->GetObjectClass(env, o);
9758 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
9759 atomic_init(&calls->refcnt, 1);
9760 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9761 calls->o = (*env)->NewWeakGlobalRef(env, o);
9762 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
9763 CHECK(calls->send_data_meth != NULL);
9764 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
9765 CHECK(calls->disconnect_socket_meth != NULL);
9766 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
9767 CHECK(calls->eq_meth != NULL);
9768 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
9769 CHECK(calls->hash_meth != NULL);
9771 LDKSocketDescriptor ret = {
9772 .this_arg = (void*) calls,
9773 .send_data = send_data_LDKSocketDescriptor_jcall,
9774 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
9775 .eq = eq_LDKSocketDescriptor_jcall,
9776 .hash = hash_LDKSocketDescriptor_jcall,
9777 .cloned = LDKSocketDescriptor_JCalls_cloned,
9778 .free = LDKSocketDescriptor_JCalls_free,
9782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
9783 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
9784 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
9785 return (uint64_t)res_ptr;
9787 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) {
9788 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9789 LDKu8slice data_ref;
9790 data_ref.datalen = (*env)->GetArrayLength(env, data);
9791 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
9792 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
9793 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
9797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
9798 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9799 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
9802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
9803 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
9804 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
9808 typedef struct LDKChannelManagerPersister_JCalls {
9809 atomic_size_t refcnt;
9812 jmethodID persist_manager_meth;
9813 } LDKChannelManagerPersister_JCalls;
9814 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
9815 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9816 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9818 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9819 if (get_jenv_res == JNI_EDETACHED) {
9820 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9822 DO_ASSERT(get_jenv_res == JNI_OK);
9824 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9825 if (get_jenv_res == JNI_EDETACHED) {
9826 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9831 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
9832 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
9834 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9835 if (get_jenv_res == JNI_EDETACHED) {
9836 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9838 DO_ASSERT(get_jenv_res == JNI_OK);
9840 LDKChannelManager channel_manager_var = *channel_manager;
9841 // Warning: we may need a move here but no clone is available for LDKChannelManager
9842 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9843 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9844 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
9845 if (channel_manager_var.is_owned) {
9846 channel_manager_ref |= 1;
9848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9850 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
9851 if ((*env)->ExceptionCheck(env)) {
9852 (*env)->ExceptionDescribe(env);
9853 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
9855 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
9856 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
9857 if (get_jenv_res == JNI_EDETACHED) {
9858 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9862 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
9863 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
9864 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9866 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
9867 jclass c = (*env)->GetObjectClass(env, o);
9869 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
9870 atomic_init(&calls->refcnt, 1);
9871 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9872 calls->o = (*env)->NewWeakGlobalRef(env, o);
9873 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
9874 CHECK(calls->persist_manager_meth != NULL);
9876 LDKChannelManagerPersister ret = {
9877 .this_arg = (void*) calls,
9878 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
9879 .free = LDKChannelManagerPersister_JCalls_free,
9883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
9884 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
9885 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
9886 return (uint64_t)res_ptr;
9888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
9889 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
9890 LDKChannelManager channel_manager_conv;
9891 channel_manager_conv.inner = (void*)(channel_manager & (~1));
9892 channel_manager_conv.is_owned = false;
9893 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9894 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9895 return (uint64_t)ret_conv;
9898 static jclass LDKFallback_SegWitProgram_class = NULL;
9899 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
9900 static jclass LDKFallback_PubKeyHash_class = NULL;
9901 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
9902 static jclass LDKFallback_ScriptHash_class = NULL;
9903 static jmethodID LDKFallback_ScriptHash_meth = NULL;
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
9905 LDKFallback_SegWitProgram_class =
9906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
9907 CHECK(LDKFallback_SegWitProgram_class != NULL);
9908 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
9909 CHECK(LDKFallback_SegWitProgram_meth != NULL);
9910 LDKFallback_PubKeyHash_class =
9911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
9912 CHECK(LDKFallback_PubKeyHash_class != NULL);
9913 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
9914 CHECK(LDKFallback_PubKeyHash_meth != NULL);
9915 LDKFallback_ScriptHash_class =
9916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
9917 CHECK(LDKFallback_ScriptHash_class != NULL);
9918 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
9919 CHECK(LDKFallback_ScriptHash_meth != NULL);
9921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9922 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9924 case LDKFallback_SegWitProgram: {
9925 uint8_t version_val = obj->seg_wit_program.version._0;
9926 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9927 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
9928 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
9929 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
9931 case LDKFallback_PubKeyHash: {
9932 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
9933 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
9934 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
9936 case LDKFallback_ScriptHash: {
9937 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
9938 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
9939 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
9944 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9945 LDKStr ret_str = _ldk_get_compiled_version();
9946 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9951 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9952 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
9953 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9959 LDKTransaction _res_ref;
9960 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9961 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
9962 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9963 _res_ref.data_is_owned = true;
9964 Transaction_free(_res_ref);
9967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
9968 LDKCVec_u8Z script_pubkey_ref;
9969 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9970 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
9971 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
9972 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9973 *ret_ref = TxOut_new(script_pubkey_ref, value);
9974 return (uint64_t)ret_ref;
9977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
9978 if ((_res & 1) != 0) return;
9979 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
9981 TxOut_free(_res_conv);
9984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9985 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
9986 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9987 *ret_ref = TxOut_clone(orig_conv);
9988 return (uint64_t)ret_ref;
9991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
9992 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
9996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9998 CHECK((*env)->GetArrayLength(env, o) == 32);
9999 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
10000 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10001 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
10002 return (uint64_t)ret_conv;
10005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10006 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10007 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
10008 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
10009 return (uint64_t)ret_conv;
10012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10013 if ((_res & 1) != 0) return;
10014 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
10016 CResult_SecretKeyErrorZ_free(_res_conv);
10019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10020 LDKPublicKey o_ref;
10021 CHECK((*env)->GetArrayLength(env, o) == 33);
10022 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
10023 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10024 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
10025 return (uint64_t)ret_conv;
10028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10029 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10030 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10031 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
10032 return (uint64_t)ret_conv;
10035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10036 if ((_res & 1) != 0) return;
10037 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
10039 CResult_PublicKeyErrorZ_free(_res_conv);
10042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10043 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
10044 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
10045 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
10046 return (uint64_t)ret_conv;
10049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10050 LDKTxCreationKeys o_conv;
10051 o_conv.inner = (void*)(o & (~1));
10052 o_conv.is_owned = (o & 1) || (o == 0);
10053 o_conv = TxCreationKeys_clone(&o_conv);
10054 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10055 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
10056 return (uint64_t)ret_conv;
10059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10060 LDKDecodeError e_conv;
10061 e_conv.inner = (void*)(e & (~1));
10062 e_conv.is_owned = (e & 1) || (e == 0);
10063 e_conv = DecodeError_clone(&e_conv);
10064 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10065 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
10066 return (uint64_t)ret_conv;
10069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10070 if ((_res & 1) != 0) return;
10071 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10073 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
10076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10077 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
10078 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
10079 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
10080 return (uint64_t)ret_conv;
10083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10084 LDKChannelPublicKeys o_conv;
10085 o_conv.inner = (void*)(o & (~1));
10086 o_conv.is_owned = (o & 1) || (o == 0);
10087 o_conv = ChannelPublicKeys_clone(&o_conv);
10088 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10089 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
10090 return (uint64_t)ret_conv;
10093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10094 LDKDecodeError e_conv;
10095 e_conv.inner = (void*)(e & (~1));
10096 e_conv.is_owned = (e & 1) || (e == 0);
10097 e_conv = DecodeError_clone(&e_conv);
10098 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10099 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
10100 return (uint64_t)ret_conv;
10103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10104 if ((_res & 1) != 0) return;
10105 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
10107 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
10110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10111 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
10112 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
10113 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
10114 return (uint64_t)ret_conv;
10117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10118 LDKTxCreationKeys o_conv;
10119 o_conv.inner = (void*)(o & (~1));
10120 o_conv.is_owned = (o & 1) || (o == 0);
10121 o_conv = TxCreationKeys_clone(&o_conv);
10122 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10123 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
10124 return (uint64_t)ret_conv;
10127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10128 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10129 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10130 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
10131 return (uint64_t)ret_conv;
10134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10135 if ((_res & 1) != 0) return;
10136 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
10138 CResult_TxCreationKeysErrorZ_free(_res_conv);
10141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10142 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
10143 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
10144 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
10145 return (uint64_t)ret_conv;
10148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
10149 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10150 *ret_copy = COption_u32Z_some(o);
10151 uint64_t ret_ref = (uint64_t)ret_copy;
10155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
10156 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10157 *ret_copy = COption_u32Z_none();
10158 uint64_t ret_ref = (uint64_t)ret_copy;
10162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10163 if ((_res & 1) != 0) return;
10164 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
10166 COption_u32Z_free(_res_conv);
10169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10170 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
10171 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
10172 *ret_copy = COption_u32Z_clone(orig_conv);
10173 uint64_t ret_ref = (uint64_t)ret_copy;
10177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10178 LDKHTLCOutputInCommitment o_conv;
10179 o_conv.inner = (void*)(o & (~1));
10180 o_conv.is_owned = (o & 1) || (o == 0);
10181 o_conv = HTLCOutputInCommitment_clone(&o_conv);
10182 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10183 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
10184 return (uint64_t)ret_conv;
10187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10188 LDKDecodeError e_conv;
10189 e_conv.inner = (void*)(e & (~1));
10190 e_conv.is_owned = (e & 1) || (e == 0);
10191 e_conv = DecodeError_clone(&e_conv);
10192 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10193 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
10194 return (uint64_t)ret_conv;
10197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10198 if ((_res & 1) != 0) return;
10199 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
10201 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
10204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10205 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
10206 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
10207 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
10208 return (uint64_t)ret_conv;
10211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10212 LDKCounterpartyChannelTransactionParameters o_conv;
10213 o_conv.inner = (void*)(o & (~1));
10214 o_conv.is_owned = (o & 1) || (o == 0);
10215 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
10216 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10217 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10218 return (uint64_t)ret_conv;
10221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10222 LDKDecodeError e_conv;
10223 e_conv.inner = (void*)(e & (~1));
10224 e_conv.is_owned = (e & 1) || (e == 0);
10225 e_conv = DecodeError_clone(&e_conv);
10226 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10227 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
10228 return (uint64_t)ret_conv;
10231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10232 if ((_res & 1) != 0) return;
10233 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10235 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10239 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10240 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
10241 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10242 return (uint64_t)ret_conv;
10245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10246 LDKChannelTransactionParameters o_conv;
10247 o_conv.inner = (void*)(o & (~1));
10248 o_conv.is_owned = (o & 1) || (o == 0);
10249 o_conv = ChannelTransactionParameters_clone(&o_conv);
10250 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10251 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
10252 return (uint64_t)ret_conv;
10255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10256 LDKDecodeError e_conv;
10257 e_conv.inner = (void*)(e & (~1));
10258 e_conv.is_owned = (e & 1) || (e == 0);
10259 e_conv = DecodeError_clone(&e_conv);
10260 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10261 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
10262 return (uint64_t)ret_conv;
10265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10266 if ((_res & 1) != 0) return;
10267 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
10269 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
10272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10273 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
10274 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
10275 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
10276 return (uint64_t)ret_conv;
10279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10280 LDKCVec_SignatureZ _res_constr;
10281 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10282 if (_res_constr.datalen > 0)
10283 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10285 _res_constr.data = NULL;
10286 for (size_t i = 0; i < _res_constr.datalen; i++) {
10287 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10288 LDKSignature _res_conv_8_ref;
10289 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
10290 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
10291 _res_constr.data[i] = _res_conv_8_ref;
10293 CVec_SignatureZ_free(_res_constr);
10296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10297 LDKHolderCommitmentTransaction o_conv;
10298 o_conv.inner = (void*)(o & (~1));
10299 o_conv.is_owned = (o & 1) || (o == 0);
10300 o_conv = HolderCommitmentTransaction_clone(&o_conv);
10301 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10302 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
10303 return (uint64_t)ret_conv;
10306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10307 LDKDecodeError e_conv;
10308 e_conv.inner = (void*)(e & (~1));
10309 e_conv.is_owned = (e & 1) || (e == 0);
10310 e_conv = DecodeError_clone(&e_conv);
10311 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10312 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
10313 return (uint64_t)ret_conv;
10316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10317 if ((_res & 1) != 0) return;
10318 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10320 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
10323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10324 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10325 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
10326 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10327 return (uint64_t)ret_conv;
10330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10331 LDKBuiltCommitmentTransaction o_conv;
10332 o_conv.inner = (void*)(o & (~1));
10333 o_conv.is_owned = (o & 1) || (o == 0);
10334 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
10335 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10336 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
10337 return (uint64_t)ret_conv;
10340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10341 LDKDecodeError e_conv;
10342 e_conv.inner = (void*)(e & (~1));
10343 e_conv.is_owned = (e & 1) || (e == 0);
10344 e_conv = DecodeError_clone(&e_conv);
10345 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10346 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
10347 return (uint64_t)ret_conv;
10350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10351 if ((_res & 1) != 0) return;
10352 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10354 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
10357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10358 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
10359 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
10360 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
10361 return (uint64_t)ret_conv;
10364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10365 LDKTrustedClosingTransaction o_conv;
10366 o_conv.inner = (void*)(o & (~1));
10367 o_conv.is_owned = (o & 1) || (o == 0);
10368 // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
10369 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10370 *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
10371 return (uint64_t)ret_conv;
10374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10375 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
10376 *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
10377 return (uint64_t)ret_conv;
10380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10381 if ((_res & 1) != 0) return;
10382 LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
10384 CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
10387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10388 LDKCommitmentTransaction o_conv;
10389 o_conv.inner = (void*)(o & (~1));
10390 o_conv.is_owned = (o & 1) || (o == 0);
10391 o_conv = CommitmentTransaction_clone(&o_conv);
10392 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10393 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
10394 return (uint64_t)ret_conv;
10397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10398 LDKDecodeError e_conv;
10399 e_conv.inner = (void*)(e & (~1));
10400 e_conv.is_owned = (e & 1) || (e == 0);
10401 e_conv = DecodeError_clone(&e_conv);
10402 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10403 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
10404 return (uint64_t)ret_conv;
10407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10408 if ((_res & 1) != 0) return;
10409 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
10411 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
10414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10415 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
10416 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
10417 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
10418 return (uint64_t)ret_conv;
10421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10422 LDKTrustedCommitmentTransaction o_conv;
10423 o_conv.inner = (void*)(o & (~1));
10424 o_conv.is_owned = (o & 1) || (o == 0);
10425 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
10426 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10427 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
10428 return (uint64_t)ret_conv;
10431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10432 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
10433 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
10434 return (uint64_t)ret_conv;
10437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10438 if ((_res & 1) != 0) return;
10439 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
10441 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
10444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10445 LDKCVec_SignatureZ o_constr;
10446 o_constr.datalen = (*env)->GetArrayLength(env, o);
10447 if (o_constr.datalen > 0)
10448 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10450 o_constr.data = NULL;
10451 for (size_t i = 0; i < o_constr.datalen; i++) {
10452 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10453 LDKSignature o_conv_8_ref;
10454 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
10455 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
10456 o_constr.data[i] = o_conv_8_ref;
10458 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10459 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
10460 return (uint64_t)ret_conv;
10463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
10464 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10465 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
10466 return (uint64_t)ret_conv;
10469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10470 if ((_res & 1) != 0) return;
10471 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
10473 CResult_CVec_SignatureZNoneZ_free(_res_conv);
10476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10477 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
10478 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10479 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
10480 return (uint64_t)ret_conv;
10483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10484 LDKShutdownScript o_conv;
10485 o_conv.inner = (void*)(o & (~1));
10486 o_conv.is_owned = (o & 1) || (o == 0);
10487 o_conv = ShutdownScript_clone(&o_conv);
10488 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10489 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
10490 return (uint64_t)ret_conv;
10493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10494 LDKDecodeError e_conv;
10495 e_conv.inner = (void*)(e & (~1));
10496 e_conv.is_owned = (e & 1) || (e == 0);
10497 e_conv = DecodeError_clone(&e_conv);
10498 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10499 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
10500 return (uint64_t)ret_conv;
10503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10504 if ((_res & 1) != 0) return;
10505 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
10507 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
10510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10511 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
10512 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
10513 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
10514 return (uint64_t)ret_conv;
10517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10518 LDKShutdownScript o_conv;
10519 o_conv.inner = (void*)(o & (~1));
10520 o_conv.is_owned = (o & 1) || (o == 0);
10521 o_conv = ShutdownScript_clone(&o_conv);
10522 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10523 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
10524 return (uint64_t)ret_conv;
10527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10528 LDKInvalidShutdownScript e_conv;
10529 e_conv.inner = (void*)(e & (~1));
10530 e_conv.is_owned = (e & 1) || (e == 0);
10531 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
10532 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
10533 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
10534 return (uint64_t)ret_conv;
10537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10538 if ((_res & 1) != 0) return;
10539 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
10541 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
10544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
10545 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10546 *ret_conv = CResult_NoneErrorZ_ok();
10547 return (uint64_t)ret_conv;
10550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10551 LDKIOError e_conv = LDKIOError_from_java(env, e);
10552 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10553 *ret_conv = CResult_NoneErrorZ_err(e_conv);
10554 return (uint64_t)ret_conv;
10557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10558 if ((_res & 1) != 0) return;
10559 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
10561 CResult_NoneErrorZ_free(_res_conv);
10564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10565 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
10566 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10567 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
10568 return (uint64_t)ret_conv;
10571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10572 LDKRouteHop o_conv;
10573 o_conv.inner = (void*)(o & (~1));
10574 o_conv.is_owned = (o & 1) || (o == 0);
10575 o_conv = RouteHop_clone(&o_conv);
10576 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10577 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
10578 return (uint64_t)ret_conv;
10581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10582 LDKDecodeError e_conv;
10583 e_conv.inner = (void*)(e & (~1));
10584 e_conv.is_owned = (e & 1) || (e == 0);
10585 e_conv = DecodeError_clone(&e_conv);
10586 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10587 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
10588 return (uint64_t)ret_conv;
10591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10592 if ((_res & 1) != 0) return;
10593 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
10595 CResult_RouteHopDecodeErrorZ_free(_res_conv);
10598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10599 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
10600 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
10601 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
10602 return (uint64_t)ret_conv;
10605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10606 LDKCVec_RouteHopZ _res_constr;
10607 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10608 if (_res_constr.datalen > 0)
10609 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10611 _res_constr.data = NULL;
10612 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10613 for (size_t k = 0; k < _res_constr.datalen; k++) {
10614 int64_t _res_conv_10 = _res_vals[k];
10615 LDKRouteHop _res_conv_10_conv;
10616 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
10617 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
10618 _res_constr.data[k] = _res_conv_10_conv;
10620 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10621 CVec_RouteHopZ_free(_res_constr);
10624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10625 LDKCVec_CVec_RouteHopZZ _res_constr;
10626 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10627 if (_res_constr.datalen > 0)
10628 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
10630 _res_constr.data = NULL;
10631 for (size_t m = 0; m < _res_constr.datalen; m++) {
10632 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
10633 LDKCVec_RouteHopZ _res_conv_12_constr;
10634 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
10635 if (_res_conv_12_constr.datalen > 0)
10636 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10638 _res_conv_12_constr.data = NULL;
10639 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
10640 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
10641 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
10642 LDKRouteHop _res_conv_12_conv_10_conv;
10643 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
10644 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
10645 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
10647 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
10648 _res_constr.data[m] = _res_conv_12_constr;
10650 CVec_CVec_RouteHopZZ_free(_res_constr);
10653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10655 o_conv.inner = (void*)(o & (~1));
10656 o_conv.is_owned = (o & 1) || (o == 0);
10657 o_conv = Route_clone(&o_conv);
10658 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10659 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
10660 return (uint64_t)ret_conv;
10663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10664 LDKDecodeError e_conv;
10665 e_conv.inner = (void*)(e & (~1));
10666 e_conv.is_owned = (e & 1) || (e == 0);
10667 e_conv = DecodeError_clone(&e_conv);
10668 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10669 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
10670 return (uint64_t)ret_conv;
10673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10674 if ((_res & 1) != 0) return;
10675 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
10677 CResult_RouteDecodeErrorZ_free(_res_conv);
10680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10681 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
10682 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
10683 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
10684 return (uint64_t)ret_conv;
10687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
10688 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10689 *ret_copy = COption_u64Z_some(o);
10690 uint64_t ret_ref = (uint64_t)ret_copy;
10694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
10695 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10696 *ret_copy = COption_u64Z_none();
10697 uint64_t ret_ref = (uint64_t)ret_copy;
10701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10702 if ((_res & 1) != 0) return;
10703 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
10705 COption_u64Z_free(_res_conv);
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10709 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
10710 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
10711 *ret_copy = COption_u64Z_clone(orig_conv);
10712 uint64_t ret_ref = (uint64_t)ret_copy;
10716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10717 LDKCVec_ChannelDetailsZ _res_constr;
10718 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10719 if (_res_constr.datalen > 0)
10720 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10722 _res_constr.data = NULL;
10723 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10724 for (size_t q = 0; q < _res_constr.datalen; q++) {
10725 int64_t _res_conv_16 = _res_vals[q];
10726 LDKChannelDetails _res_conv_16_conv;
10727 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10728 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10729 _res_constr.data[q] = _res_conv_16_conv;
10731 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10732 CVec_ChannelDetailsZ_free(_res_constr);
10735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10736 LDKCVec_RouteHintZ _res_constr;
10737 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10738 if (_res_constr.datalen > 0)
10739 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
10741 _res_constr.data = NULL;
10742 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10743 for (size_t l = 0; l < _res_constr.datalen; l++) {
10744 int64_t _res_conv_11 = _res_vals[l];
10745 LDKRouteHint _res_conv_11_conv;
10746 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
10747 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
10748 _res_constr.data[l] = _res_conv_11_conv;
10750 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10751 CVec_RouteHintZ_free(_res_constr);
10754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10756 o_conv.inner = (void*)(o & (~1));
10757 o_conv.is_owned = (o & 1) || (o == 0);
10758 o_conv = Route_clone(&o_conv);
10759 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10760 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
10761 return (uint64_t)ret_conv;
10764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10765 LDKLightningError e_conv;
10766 e_conv.inner = (void*)(e & (~1));
10767 e_conv.is_owned = (e & 1) || (e == 0);
10768 e_conv = LightningError_clone(&e_conv);
10769 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10770 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
10771 return (uint64_t)ret_conv;
10774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10775 if ((_res & 1) != 0) return;
10776 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
10778 CResult_RouteLightningErrorZ_free(_res_conv);
10781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10782 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
10783 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10784 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
10785 return (uint64_t)ret_conv;
10788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10789 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
10790 o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
10791 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10792 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
10793 return (uint64_t)ret_conv;
10796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10797 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
10798 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10799 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
10800 return (uint64_t)ret_conv;
10803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10804 if ((_res & 1) != 0) return;
10805 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
10807 CResult_TxOutAccessErrorZ_free(_res_conv);
10810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10811 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
10812 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
10813 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
10814 return (uint64_t)ret_conv;
10817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10818 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
10819 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10820 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
10821 return (uint64_t)ret_ref;
10824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10825 LDKTransaction b_ref;
10826 b_ref.datalen = (*env)->GetArrayLength(env, b);
10827 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
10828 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10829 b_ref.data_is_owned = true;
10830 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
10831 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
10832 return (uint64_t)ret_ref;
10835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10836 if ((_res & 1) != 0) return;
10837 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
10839 C2Tuple_usizeTransactionZ_free(_res_conv);
10842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10843 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
10844 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10845 if (_res_constr.datalen > 0)
10846 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
10848 _res_constr.data = NULL;
10849 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10850 for (size_t y = 0; y < _res_constr.datalen; y++) {
10851 int64_t _res_conv_24 = _res_vals[y];
10852 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
10853 FREE((void*)_res_conv_24);
10854 _res_constr.data[y] = _res_conv_24_conv;
10856 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10857 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
10860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10861 LDKCVec_TxidZ _res_constr;
10862 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10863 if (_res_constr.datalen > 0)
10864 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
10866 _res_constr.data = NULL;
10867 for (size_t i = 0; i < _res_constr.datalen; i++) {
10868 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10869 LDKThirtyTwoBytes _res_conv_8_ref;
10870 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
10871 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
10872 _res_constr.data[i] = _res_conv_8_ref;
10874 CVec_TxidZ_free(_res_constr);
10877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
10878 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10879 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
10880 return (uint64_t)ret_conv;
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
10884 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
10885 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10886 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
10887 return (uint64_t)ret_conv;
10890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10891 if ((_res & 1) != 0) return;
10892 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
10894 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
10897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10898 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
10899 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10900 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
10901 return (uint64_t)ret_conv;
10904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10905 LDKCVec_MonitorEventZ _res_constr;
10906 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10907 if (_res_constr.datalen > 0)
10908 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10910 _res_constr.data = NULL;
10911 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10912 for (size_t o = 0; o < _res_constr.datalen; o++) {
10913 int64_t _res_conv_14 = _res_vals[o];
10914 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
10915 FREE((void*)_res_conv_14);
10916 _res_constr.data[o] = _res_conv_14_conv;
10918 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10919 CVec_MonitorEventZ_free(_res_constr);
10922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10923 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
10924 o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
10925 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10926 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
10927 uint64_t ret_ref = (uint64_t)ret_copy;
10931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
10932 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10933 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
10934 uint64_t ret_ref = (uint64_t)ret_copy;
10938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10939 if ((_res & 1) != 0) return;
10940 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
10942 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
10945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10946 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
10947 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10948 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
10949 uint64_t ret_ref = (uint64_t)ret_copy;
10953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10954 LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
10955 o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
10956 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10957 *ret_copy = COption_NetworkUpdateZ_some(o_conv);
10958 uint64_t ret_ref = (uint64_t)ret_copy;
10962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
10963 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10964 *ret_copy = COption_NetworkUpdateZ_none();
10965 uint64_t ret_ref = (uint64_t)ret_copy;
10969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10970 if ((_res & 1) != 0) return;
10971 LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
10973 COption_NetworkUpdateZ_free(_res_conv);
10976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10977 LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
10978 LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
10979 *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
10980 uint64_t ret_ref = (uint64_t)ret_copy;
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10985 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10986 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10987 if (_res_constr.datalen > 0)
10988 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10990 _res_constr.data = NULL;
10991 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10992 for (size_t b = 0; b < _res_constr.datalen; b++) {
10993 int64_t _res_conv_27 = _res_vals[b];
10994 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
10995 FREE((void*)_res_conv_27);
10996 _res_constr.data[b] = _res_conv_27_conv;
10998 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10999 CVec_SpendableOutputDescriptorZ_free(_res_constr);
11002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11003 LDKCVec_MessageSendEventZ _res_constr;
11004 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11005 if (_res_constr.datalen > 0)
11006 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11008 _res_constr.data = NULL;
11009 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11010 for (size_t s = 0; s < _res_constr.datalen; s++) {
11011 int64_t _res_conv_18 = _res_vals[s];
11012 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
11013 FREE((void*)_res_conv_18);
11014 _res_constr.data[s] = _res_conv_18_conv;
11016 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11017 CVec_MessageSendEventZ_free(_res_constr);
11020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11021 LDKInitFeatures o_conv;
11022 o_conv.inner = (void*)(o & (~1));
11023 o_conv.is_owned = (o & 1) || (o == 0);
11024 o_conv = InitFeatures_clone(&o_conv);
11025 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11026 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
11027 return (uint64_t)ret_conv;
11030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11031 LDKDecodeError e_conv;
11032 e_conv.inner = (void*)(e & (~1));
11033 e_conv.is_owned = (e & 1) || (e == 0);
11034 e_conv = DecodeError_clone(&e_conv);
11035 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
11036 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
11037 return (uint64_t)ret_conv;
11040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11041 if ((_res & 1) != 0) return;
11042 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11044 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
11047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11048 LDKNodeFeatures o_conv;
11049 o_conv.inner = (void*)(o & (~1));
11050 o_conv.is_owned = (o & 1) || (o == 0);
11051 o_conv = NodeFeatures_clone(&o_conv);
11052 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11053 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
11054 return (uint64_t)ret_conv;
11057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11058 LDKDecodeError e_conv;
11059 e_conv.inner = (void*)(e & (~1));
11060 e_conv.is_owned = (e & 1) || (e == 0);
11061 e_conv = DecodeError_clone(&e_conv);
11062 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
11063 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
11064 return (uint64_t)ret_conv;
11067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11068 if ((_res & 1) != 0) return;
11069 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11071 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
11074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11075 LDKChannelFeatures o_conv;
11076 o_conv.inner = (void*)(o & (~1));
11077 o_conv.is_owned = (o & 1) || (o == 0);
11078 o_conv = ChannelFeatures_clone(&o_conv);
11079 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11080 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
11081 return (uint64_t)ret_conv;
11084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11085 LDKDecodeError e_conv;
11086 e_conv.inner = (void*)(e & (~1));
11087 e_conv.is_owned = (e & 1) || (e == 0);
11088 e_conv = DecodeError_clone(&e_conv);
11089 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
11090 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
11091 return (uint64_t)ret_conv;
11094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11095 if ((_res & 1) != 0) return;
11096 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11098 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
11101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11102 LDKInvoiceFeatures o_conv;
11103 o_conv.inner = (void*)(o & (~1));
11104 o_conv.is_owned = (o & 1) || (o == 0);
11105 o_conv = InvoiceFeatures_clone(&o_conv);
11106 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11107 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
11108 return (uint64_t)ret_conv;
11111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11112 LDKDecodeError e_conv;
11113 e_conv.inner = (void*)(e & (~1));
11114 e_conv.is_owned = (e & 1) || (e == 0);
11115 e_conv = DecodeError_clone(&e_conv);
11116 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
11117 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
11118 return (uint64_t)ret_conv;
11121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11122 if ((_res & 1) != 0) return;
11123 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11125 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
11128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11129 LDKDelayedPaymentOutputDescriptor o_conv;
11130 o_conv.inner = (void*)(o & (~1));
11131 o_conv.is_owned = (o & 1) || (o == 0);
11132 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
11133 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11134 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11135 return (uint64_t)ret_conv;
11138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11139 LDKDecodeError e_conv;
11140 e_conv.inner = (void*)(e & (~1));
11141 e_conv.is_owned = (e & 1) || (e == 0);
11142 e_conv = DecodeError_clone(&e_conv);
11143 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11144 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11145 return (uint64_t)ret_conv;
11148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11149 if ((_res & 1) != 0) return;
11150 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11152 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11156 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11157 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
11158 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11159 return (uint64_t)ret_conv;
11162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11163 LDKStaticPaymentOutputDescriptor o_conv;
11164 o_conv.inner = (void*)(o & (~1));
11165 o_conv.is_owned = (o & 1) || (o == 0);
11166 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
11167 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11168 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
11169 return (uint64_t)ret_conv;
11172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11173 LDKDecodeError e_conv;
11174 e_conv.inner = (void*)(e & (~1));
11175 e_conv.is_owned = (e & 1) || (e == 0);
11176 e_conv = DecodeError_clone(&e_conv);
11177 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11178 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
11179 return (uint64_t)ret_conv;
11182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11183 if ((_res & 1) != 0) return;
11184 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11186 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
11189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11190 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
11191 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
11192 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
11193 return (uint64_t)ret_conv;
11196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11197 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
11198 o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
11199 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11200 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
11201 return (uint64_t)ret_conv;
11204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11205 LDKDecodeError e_conv;
11206 e_conv.inner = (void*)(e & (~1));
11207 e_conv.is_owned = (e & 1) || (e == 0);
11208 e_conv = DecodeError_clone(&e_conv);
11209 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11210 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
11211 return (uint64_t)ret_conv;
11214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11215 if ((_res & 1) != 0) return;
11216 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
11218 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
11221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11222 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
11223 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
11224 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
11225 return (uint64_t)ret_conv;
11228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
11229 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11230 *ret_conv = CResult_NoneNoneZ_ok();
11231 return (uint64_t)ret_conv;
11234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
11235 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11236 *ret_conv = CResult_NoneNoneZ_err();
11237 return (uint64_t)ret_conv;
11240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11241 if ((_res & 1) != 0) return;
11242 LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
11244 CResult_NoneNoneZ_free(_res_conv);
11247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11248 LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
11249 LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11250 *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11251 return (uint64_t)ret_conv;
11254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11255 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
11256 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11257 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
11258 return (uint64_t)ret_ref;
11261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
11262 LDKSignature a_ref;
11263 CHECK((*env)->GetArrayLength(env, a) == 64);
11264 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
11265 LDKCVec_SignatureZ b_constr;
11266 b_constr.datalen = (*env)->GetArrayLength(env, b);
11267 if (b_constr.datalen > 0)
11268 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11270 b_constr.data = NULL;
11271 for (size_t i = 0; i < b_constr.datalen; i++) {
11272 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
11273 LDKSignature b_conv_8_ref;
11274 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
11275 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
11276 b_constr.data[i] = b_conv_8_ref;
11278 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
11279 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
11280 return (uint64_t)ret_ref;
11283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11284 if ((_res & 1) != 0) return;
11285 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
11287 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
11290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11291 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
11292 o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
11293 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11294 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
11295 return (uint64_t)ret_conv;
11298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
11299 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11300 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
11301 return (uint64_t)ret_conv;
11304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11305 if ((_res & 1) != 0) return;
11306 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
11308 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
11311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11312 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
11313 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
11314 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
11315 return (uint64_t)ret_conv;
11318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11319 LDKSignature o_ref;
11320 CHECK((*env)->GetArrayLength(env, o) == 64);
11321 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
11322 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11323 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
11324 return (uint64_t)ret_conv;
11327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11328 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11329 *ret_conv = CResult_SignatureNoneZ_err();
11330 return (uint64_t)ret_conv;
11333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11334 if ((_res & 1) != 0) return;
11335 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
11337 CResult_SignatureNoneZ_free(_res_conv);
11340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11341 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
11342 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
11343 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
11344 return (uint64_t)ret_conv;
11347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11348 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
11349 if (o_conv.free == LDKSign_JCalls_free) {
11350 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11351 LDKSign_JCalls_cloned(&o_conv);
11353 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11354 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
11355 return (uint64_t)ret_conv;
11358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11359 LDKDecodeError e_conv;
11360 e_conv.inner = (void*)(e & (~1));
11361 e_conv.is_owned = (e & 1) || (e == 0);
11362 e_conv = DecodeError_clone(&e_conv);
11363 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11364 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
11365 return (uint64_t)ret_conv;
11368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11369 if ((_res & 1) != 0) return;
11370 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
11372 CResult_SignDecodeErrorZ_free(_res_conv);
11375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11376 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
11377 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
11378 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
11379 return (uint64_t)ret_conv;
11382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
11383 LDKCVec_u8Z _res_ref;
11384 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
11385 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
11386 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
11387 CVec_u8Z_free(_res_ref);
11390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
11391 LDKRecoverableSignature arg_ref;
11392 CHECK((*env)->GetArrayLength(env, arg) == 68);
11393 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
11394 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11395 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
11396 return (uint64_t)ret_conv;
11399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
11400 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11401 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
11402 return (uint64_t)ret_conv;
11405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11406 if ((_res & 1) != 0) return;
11407 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
11409 CResult_RecoverableSignatureNoneZ_free(_res_conv);
11412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11413 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
11414 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
11415 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
11416 return (uint64_t)ret_conv;
11419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11420 LDKCVec_CVec_u8ZZ _res_constr;
11421 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11422 if (_res_constr.datalen > 0)
11423 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11425 _res_constr.data = NULL;
11426 for (size_t i = 0; i < _res_constr.datalen; i++) {
11427 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11428 LDKCVec_u8Z _res_conv_8_ref;
11429 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11430 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11431 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11432 _res_constr.data[i] = _res_conv_8_ref;
11434 CVec_CVec_u8ZZ_free(_res_constr);
11437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
11438 LDKCVec_CVec_u8ZZ o_constr;
11439 o_constr.datalen = (*env)->GetArrayLength(env, o);
11440 if (o_constr.datalen > 0)
11441 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
11443 o_constr.data = NULL;
11444 for (size_t i = 0; i < o_constr.datalen; i++) {
11445 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
11446 LDKCVec_u8Z o_conv_8_ref;
11447 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
11448 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
11449 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
11450 o_constr.data[i] = o_conv_8_ref;
11452 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11453 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
11454 return (uint64_t)ret_conv;
11457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
11458 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11459 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
11460 return (uint64_t)ret_conv;
11463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11464 if ((_res & 1) != 0) return;
11465 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
11467 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
11470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11471 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
11472 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
11473 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
11474 return (uint64_t)ret_conv;
11477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11478 LDKInMemorySigner o_conv;
11479 o_conv.inner = (void*)(o & (~1));
11480 o_conv.is_owned = (o & 1) || (o == 0);
11481 o_conv = InMemorySigner_clone(&o_conv);
11482 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11483 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
11484 return (uint64_t)ret_conv;
11487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11488 LDKDecodeError e_conv;
11489 e_conv.inner = (void*)(e & (~1));
11490 e_conv.is_owned = (e & 1) || (e == 0);
11491 e_conv = DecodeError_clone(&e_conv);
11492 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11493 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
11494 return (uint64_t)ret_conv;
11497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11498 if ((_res & 1) != 0) return;
11499 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
11501 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
11504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11505 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
11506 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
11507 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
11508 return (uint64_t)ret_conv;
11511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11512 LDKCVec_TxOutZ _res_constr;
11513 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11514 if (_res_constr.datalen > 0)
11515 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
11517 _res_constr.data = NULL;
11518 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11519 for (size_t h = 0; h < _res_constr.datalen; h++) {
11520 int64_t _res_conv_7 = _res_vals[h];
11521 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
11522 FREE((void*)_res_conv_7);
11523 _res_constr.data[h] = _res_conv_7_conv;
11525 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11526 CVec_TxOutZ_free(_res_constr);
11529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11530 LDKTransaction o_ref;
11531 o_ref.datalen = (*env)->GetArrayLength(env, o);
11532 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
11533 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11534 o_ref.data_is_owned = true;
11535 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11536 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
11537 return (uint64_t)ret_conv;
11540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
11541 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11542 *ret_conv = CResult_TransactionNoneZ_err();
11543 return (uint64_t)ret_conv;
11546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11547 if ((_res & 1) != 0) return;
11548 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
11550 CResult_TransactionNoneZ_free(_res_conv);
11553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11554 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
11555 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
11556 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
11557 return (uint64_t)ret_conv;
11560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
11561 LDKThirtyTwoBytes a_ref;
11562 CHECK((*env)->GetArrayLength(env, a) == 32);
11563 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11564 LDKChannelMonitor b_conv;
11565 b_conv.inner = (void*)(b & (~1));
11566 b_conv.is_owned = (b & 1) || (b == 0);
11567 b_conv = ChannelMonitor_clone(&b_conv);
11568 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
11569 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
11570 return (uint64_t)ret_ref;
11573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11574 if ((_res & 1) != 0) return;
11575 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
11577 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
11580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11581 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
11582 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11583 if (_res_constr.datalen > 0)
11584 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11586 _res_constr.data = NULL;
11587 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11588 for (size_t i = 0; i < _res_constr.datalen; i++) {
11589 int64_t _res_conv_34 = _res_vals[i];
11590 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
11591 FREE((void*)_res_conv_34);
11592 _res_constr.data[i] = _res_conv_34_conv;
11594 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11595 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
11598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
11599 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
11600 o_constr.datalen = (*env)->GetArrayLength(env, o);
11601 if (o_constr.datalen > 0)
11602 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
11604 o_constr.data = NULL;
11605 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
11606 for (size_t i = 0; i < o_constr.datalen; i++) {
11607 int64_t o_conv_34 = o_vals[i];
11608 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
11609 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
11610 o_constr.data[i] = o_conv_34_conv;
11612 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
11613 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11614 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
11615 return (uint64_t)ret_conv;
11618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11619 LDKIOError e_conv = LDKIOError_from_java(env, e);
11620 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
11621 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
11622 return (uint64_t)ret_conv;
11625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11626 if ((_res & 1) != 0) return;
11627 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
11629 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
11632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
11633 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11634 *ret_copy = COption_u16Z_some(o);
11635 uint64_t ret_ref = (uint64_t)ret_copy;
11639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
11640 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11641 *ret_copy = COption_u16Z_none();
11642 uint64_t ret_ref = (uint64_t)ret_copy;
11646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11647 if ((_res & 1) != 0) return;
11648 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
11650 COption_u16Z_free(_res_conv);
11653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11654 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
11655 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
11656 *ret_copy = COption_u16Z_clone(orig_conv);
11657 uint64_t ret_ref = (uint64_t)ret_copy;
11661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
11662 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11663 *ret_conv = CResult_NoneAPIErrorZ_ok();
11664 return (uint64_t)ret_conv;
11667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11668 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
11669 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11670 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11671 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
11672 return (uint64_t)ret_conv;
11675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11676 if ((_res & 1) != 0) return;
11677 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
11679 CResult_NoneAPIErrorZ_free(_res_conv);
11682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11683 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
11684 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
11685 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
11686 return (uint64_t)ret_conv;
11689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11690 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
11691 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11692 if (_res_constr.datalen > 0)
11693 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
11695 _res_constr.data = NULL;
11696 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11697 for (size_t w = 0; w < _res_constr.datalen; w++) {
11698 int64_t _res_conv_22 = _res_vals[w];
11699 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
11700 FREE((void*)_res_conv_22);
11701 _res_constr.data[w] = _res_conv_22_conv;
11703 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11704 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
11707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11708 LDKCVec_APIErrorZ _res_constr;
11709 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11710 if (_res_constr.datalen > 0)
11711 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
11713 _res_constr.data = NULL;
11714 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11715 for (size_t k = 0; k < _res_constr.datalen; k++) {
11716 int64_t _res_conv_10 = _res_vals[k];
11717 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
11718 FREE((void*)_res_conv_10);
11719 _res_constr.data[k] = _res_conv_10_conv;
11721 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11722 CVec_APIErrorZ_free(_res_constr);
11725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
11726 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11727 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
11728 return (uint64_t)ret_conv;
11731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11732 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11733 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11734 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11735 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
11736 return (uint64_t)ret_conv;
11739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11740 if ((_res & 1) != 0) return;
11741 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11743 CResult_NonePaymentSendFailureZ_free(_res_conv);
11746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11747 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
11748 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11749 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
11750 return (uint64_t)ret_conv;
11753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11754 LDKThirtyTwoBytes o_ref;
11755 CHECK((*env)->GetArrayLength(env, o) == 32);
11756 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
11757 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11758 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
11759 return (uint64_t)ret_conv;
11762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11763 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
11764 e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
11765 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11766 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
11767 return (uint64_t)ret_conv;
11770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11771 if ((_res & 1) != 0) return;
11772 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
11774 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
11777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11778 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
11779 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
11780 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
11781 return (uint64_t)ret_conv;
11784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11785 LDKCVec_NetAddressZ _res_constr;
11786 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11787 if (_res_constr.datalen > 0)
11788 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11790 _res_constr.data = NULL;
11791 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11792 for (size_t m = 0; m < _res_constr.datalen; m++) {
11793 int64_t _res_conv_12 = _res_vals[m];
11794 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
11795 FREE((void*)_res_conv_12);
11796 _res_constr.data[m] = _res_conv_12_conv;
11798 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11799 CVec_NetAddressZ_free(_res_constr);
11802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11803 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
11804 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11805 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
11806 return (uint64_t)ret_ref;
11809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
11810 LDKThirtyTwoBytes a_ref;
11811 CHECK((*env)->GetArrayLength(env, a) == 32);
11812 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11813 LDKThirtyTwoBytes b_ref;
11814 CHECK((*env)->GetArrayLength(env, b) == 32);
11815 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11816 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
11817 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
11818 return (uint64_t)ret_ref;
11821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11822 if ((_res & 1) != 0) return;
11823 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
11825 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
11828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11829 LDKThirtyTwoBytes o_ref;
11830 CHECK((*env)->GetArrayLength(env, o) == 32);
11831 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
11832 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11833 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
11834 return (uint64_t)ret_conv;
11837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11838 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
11839 e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
11840 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11841 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
11842 return (uint64_t)ret_conv;
11845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11846 if ((_res & 1) != 0) return;
11847 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
11849 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
11852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11853 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
11854 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
11855 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
11856 return (uint64_t)ret_conv;
11859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11860 LDKCVec_ChannelMonitorZ _res_constr;
11861 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11862 if (_res_constr.datalen > 0)
11863 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
11865 _res_constr.data = NULL;
11866 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11867 for (size_t q = 0; q < _res_constr.datalen; q++) {
11868 int64_t _res_conv_16 = _res_vals[q];
11869 LDKChannelMonitor _res_conv_16_conv;
11870 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11871 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11872 _res_constr.data[q] = _res_conv_16_conv;
11874 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11875 CVec_ChannelMonitorZ_free(_res_constr);
11878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
11879 LDKThirtyTwoBytes a_ref;
11880 CHECK((*env)->GetArrayLength(env, a) == 32);
11881 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11882 LDKChannelManager b_conv;
11883 b_conv.inner = (void*)(b & (~1));
11884 b_conv.is_owned = (b & 1) || (b == 0);
11885 // Warning: we need a move here but no clone is available for LDKChannelManager
11886 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
11887 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
11888 return (uint64_t)ret_ref;
11891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11892 if ((_res & 1) != 0) return;
11893 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
11895 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
11898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11899 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
11900 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
11901 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11902 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
11903 return (uint64_t)ret_conv;
11906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11907 LDKDecodeError e_conv;
11908 e_conv.inner = (void*)(e & (~1));
11909 e_conv.is_owned = (e & 1) || (e == 0);
11910 e_conv = DecodeError_clone(&e_conv);
11911 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
11912 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
11913 return (uint64_t)ret_conv;
11916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11917 if ((_res & 1) != 0) return;
11918 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11920 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
11923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11924 LDKChannelConfig o_conv;
11925 o_conv.inner = (void*)(o & (~1));
11926 o_conv.is_owned = (o & 1) || (o == 0);
11927 o_conv = ChannelConfig_clone(&o_conv);
11928 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11929 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
11930 return (uint64_t)ret_conv;
11933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11934 LDKDecodeError e_conv;
11935 e_conv.inner = (void*)(e & (~1));
11936 e_conv.is_owned = (e & 1) || (e == 0);
11937 e_conv = DecodeError_clone(&e_conv);
11938 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11939 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
11940 return (uint64_t)ret_conv;
11943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11944 if ((_res & 1) != 0) return;
11945 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
11947 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11951 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11952 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11953 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11954 return (uint64_t)ret_conv;
11957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11958 LDKOutPoint o_conv;
11959 o_conv.inner = (void*)(o & (~1));
11960 o_conv.is_owned = (o & 1) || (o == 0);
11961 o_conv = OutPoint_clone(&o_conv);
11962 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11963 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11964 return (uint64_t)ret_conv;
11967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11968 LDKDecodeError e_conv;
11969 e_conv.inner = (void*)(e & (~1));
11970 e_conv.is_owned = (e & 1) || (e == 0);
11971 e_conv = DecodeError_clone(&e_conv);
11972 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11973 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11974 return (uint64_t)ret_conv;
11977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11978 if ((_res & 1) != 0) return;
11979 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
11981 CResult_OutPointDecodeErrorZ_free(_res_conv);
11984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11985 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11986 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11987 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11988 return (uint64_t)ret_conv;
11991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
11992 LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
11993 if (o_conv.free == LDKType_JCalls_free) {
11994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11995 LDKType_JCalls_cloned(&o_conv);
11997 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11998 *ret_copy = COption_TypeZ_some(o_conv);
11999 uint64_t ret_ref = (uint64_t)ret_copy;
12003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
12004 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12005 *ret_copy = COption_TypeZ_none();
12006 uint64_t ret_ref = (uint64_t)ret_copy;
12010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12011 if ((_res & 1) != 0) return;
12012 LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
12014 COption_TypeZ_free(_res_conv);
12017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12018 LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
12019 LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
12020 *ret_copy = COption_TypeZ_clone(orig_conv);
12021 uint64_t ret_ref = (uint64_t)ret_copy;
12025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12026 LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
12027 o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
12028 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12029 *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
12030 return (uint64_t)ret_conv;
12033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12034 LDKDecodeError e_conv;
12035 e_conv.inner = (void*)(e & (~1));
12036 e_conv.is_owned = (e & 1) || (e == 0);
12037 e_conv = DecodeError_clone(&e_conv);
12038 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12039 *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
12040 return (uint64_t)ret_conv;
12043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12044 if ((_res & 1) != 0) return;
12045 LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12047 CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
12050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12051 LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
12052 LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
12053 *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
12054 return (uint64_t)ret_conv;
12057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
12058 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
12059 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12060 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
12061 return (uint64_t)ret_conv;
12064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
12065 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12066 *ret_conv = CResult_SiPrefixNoneZ_err();
12067 return (uint64_t)ret_conv;
12070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12071 if ((_res & 1) != 0) return;
12072 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
12074 CResult_SiPrefixNoneZ_free(_res_conv);
12077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12078 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
12079 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
12080 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
12081 return (uint64_t)ret_conv;
12084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12086 o_conv.inner = (void*)(o & (~1));
12087 o_conv.is_owned = (o & 1) || (o == 0);
12088 o_conv = Invoice_clone(&o_conv);
12089 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12090 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
12091 return (uint64_t)ret_conv;
12094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12095 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12096 *ret_conv = CResult_InvoiceNoneZ_err();
12097 return (uint64_t)ret_conv;
12100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12101 if ((_res & 1) != 0) return;
12102 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
12104 CResult_InvoiceNoneZ_free(_res_conv);
12107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12108 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
12109 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
12110 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
12111 return (uint64_t)ret_conv;
12114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12115 LDKSignedRawInvoice o_conv;
12116 o_conv.inner = (void*)(o & (~1));
12117 o_conv.is_owned = (o & 1) || (o == 0);
12118 o_conv = SignedRawInvoice_clone(&o_conv);
12119 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12120 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
12121 return (uint64_t)ret_conv;
12124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
12125 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12126 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
12127 return (uint64_t)ret_conv;
12130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12131 if ((_res & 1) != 0) return;
12132 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
12134 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
12137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12138 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
12139 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
12140 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
12141 return (uint64_t)ret_conv;
12144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12145 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
12146 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12147 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
12148 return (uint64_t)ret_ref;
12151 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) {
12152 LDKRawInvoice a_conv;
12153 a_conv.inner = (void*)(a & (~1));
12154 a_conv.is_owned = (a & 1) || (a == 0);
12155 a_conv = RawInvoice_clone(&a_conv);
12156 LDKThirtyTwoBytes b_ref;
12157 CHECK((*env)->GetArrayLength(env, b) == 32);
12158 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
12159 LDKInvoiceSignature c_conv;
12160 c_conv.inner = (void*)(c & (~1));
12161 c_conv.is_owned = (c & 1) || (c == 0);
12162 c_conv = InvoiceSignature_clone(&c_conv);
12163 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
12164 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
12165 return (uint64_t)ret_ref;
12168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12169 if ((_res & 1) != 0) return;
12170 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
12172 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
12175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12176 LDKPayeePubKey o_conv;
12177 o_conv.inner = (void*)(o & (~1));
12178 o_conv.is_owned = (o & 1) || (o == 0);
12179 o_conv = PayeePubKey_clone(&o_conv);
12180 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12181 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
12182 return (uint64_t)ret_conv;
12185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12186 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12187 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12188 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
12189 return (uint64_t)ret_conv;
12192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12193 if ((_res & 1) != 0) return;
12194 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
12196 CResult_PayeePubKeyErrorZ_free(_res_conv);
12199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12200 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
12201 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
12202 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
12203 return (uint64_t)ret_conv;
12206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12207 LDKCVec_PrivateRouteZ _res_constr;
12208 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12209 if (_res_constr.datalen > 0)
12210 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
12212 _res_constr.data = NULL;
12213 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12214 for (size_t o = 0; o < _res_constr.datalen; o++) {
12215 int64_t _res_conv_14 = _res_vals[o];
12216 LDKPrivateRoute _res_conv_14_conv;
12217 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
12218 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
12219 _res_constr.data[o] = _res_conv_14_conv;
12221 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12222 CVec_PrivateRouteZ_free(_res_constr);
12225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12226 LDKPositiveTimestamp o_conv;
12227 o_conv.inner = (void*)(o & (~1));
12228 o_conv.is_owned = (o & 1) || (o == 0);
12229 o_conv = PositiveTimestamp_clone(&o_conv);
12230 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12231 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
12232 return (uint64_t)ret_conv;
12235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12236 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12237 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12238 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
12239 return (uint64_t)ret_conv;
12242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12243 if ((_res & 1) != 0) return;
12244 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
12246 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
12249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12250 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
12251 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
12252 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
12253 return (uint64_t)ret_conv;
12256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
12257 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12258 *ret_conv = CResult_NoneSemanticErrorZ_ok();
12259 return (uint64_t)ret_conv;
12262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12263 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12264 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12265 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
12266 return (uint64_t)ret_conv;
12269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12270 if ((_res & 1) != 0) return;
12271 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
12273 CResult_NoneSemanticErrorZ_free(_res_conv);
12276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12277 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
12278 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
12279 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
12280 return (uint64_t)ret_conv;
12283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12285 o_conv.inner = (void*)(o & (~1));
12286 o_conv.is_owned = (o & 1) || (o == 0);
12287 o_conv = Invoice_clone(&o_conv);
12288 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12289 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
12290 return (uint64_t)ret_conv;
12293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12294 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
12295 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12296 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
12297 return (uint64_t)ret_conv;
12300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12301 if ((_res & 1) != 0) return;
12302 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
12304 CResult_InvoiceSemanticErrorZ_free(_res_conv);
12307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12308 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
12309 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
12310 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
12311 return (uint64_t)ret_conv;
12314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12315 LDKDescription o_conv;
12316 o_conv.inner = (void*)(o & (~1));
12317 o_conv.is_owned = (o & 1) || (o == 0);
12318 o_conv = Description_clone(&o_conv);
12319 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12320 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
12321 return (uint64_t)ret_conv;
12324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12325 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12326 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12327 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
12328 return (uint64_t)ret_conv;
12331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12332 if ((_res & 1) != 0) return;
12333 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
12335 CResult_DescriptionCreationErrorZ_free(_res_conv);
12338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12339 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
12340 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
12341 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
12342 return (uint64_t)ret_conv;
12345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12346 LDKExpiryTime o_conv;
12347 o_conv.inner = (void*)(o & (~1));
12348 o_conv.is_owned = (o & 1) || (o == 0);
12349 o_conv = ExpiryTime_clone(&o_conv);
12350 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12351 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
12352 return (uint64_t)ret_conv;
12355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12356 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12357 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12358 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
12359 return (uint64_t)ret_conv;
12362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12363 if ((_res & 1) != 0) return;
12364 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
12366 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
12369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12370 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
12371 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
12372 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
12373 return (uint64_t)ret_conv;
12376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12377 LDKPrivateRoute o_conv;
12378 o_conv.inner = (void*)(o & (~1));
12379 o_conv.is_owned = (o & 1) || (o == 0);
12380 o_conv = PrivateRoute_clone(&o_conv);
12381 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12382 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
12383 return (uint64_t)ret_conv;
12386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12387 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
12388 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12389 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
12390 return (uint64_t)ret_conv;
12393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12394 if ((_res & 1) != 0) return;
12395 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
12397 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
12400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12401 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
12402 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
12403 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
12404 return (uint64_t)ret_conv;
12407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
12408 LDKStr o_conv = java_to_owned_str(env, o);
12409 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12410 *ret_conv = CResult_StringErrorZ_ok(o_conv);
12411 return (uint64_t)ret_conv;
12414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
12415 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
12416 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12417 *ret_conv = CResult_StringErrorZ_err(e_conv);
12418 return (uint64_t)ret_conv;
12421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12422 if ((_res & 1) != 0) return;
12423 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
12425 CResult_StringErrorZ_free(_res_conv);
12428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12429 LDKChannelMonitorUpdate o_conv;
12430 o_conv.inner = (void*)(o & (~1));
12431 o_conv.is_owned = (o & 1) || (o == 0);
12432 o_conv = ChannelMonitorUpdate_clone(&o_conv);
12433 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12434 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
12435 return (uint64_t)ret_conv;
12438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12439 LDKDecodeError e_conv;
12440 e_conv.inner = (void*)(e & (~1));
12441 e_conv.is_owned = (e & 1) || (e == 0);
12442 e_conv = DecodeError_clone(&e_conv);
12443 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12444 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
12445 return (uint64_t)ret_conv;
12448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12449 if ((_res & 1) != 0) return;
12450 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12452 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
12455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12456 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
12457 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
12458 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
12459 return (uint64_t)ret_conv;
12462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12463 LDKHTLCUpdate o_conv;
12464 o_conv.inner = (void*)(o & (~1));
12465 o_conv.is_owned = (o & 1) || (o == 0);
12466 o_conv = HTLCUpdate_clone(&o_conv);
12467 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12468 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
12469 return (uint64_t)ret_conv;
12472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12473 LDKDecodeError e_conv;
12474 e_conv.inner = (void*)(e & (~1));
12475 e_conv.is_owned = (e & 1) || (e == 0);
12476 e_conv = DecodeError_clone(&e_conv);
12477 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12478 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
12479 return (uint64_t)ret_conv;
12482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12483 if ((_res & 1) != 0) return;
12484 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12486 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
12489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12490 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
12491 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
12492 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
12493 return (uint64_t)ret_conv;
12496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
12497 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12498 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
12499 return (uint64_t)ret_conv;
12502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12503 LDKMonitorUpdateError e_conv;
12504 e_conv.inner = (void*)(e & (~1));
12505 e_conv.is_owned = (e & 1) || (e == 0);
12506 e_conv = MonitorUpdateError_clone(&e_conv);
12507 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12508 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
12509 return (uint64_t)ret_conv;
12512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12513 if ((_res & 1) != 0) return;
12514 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
12516 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
12519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12520 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
12521 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
12522 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
12523 return (uint64_t)ret_conv;
12526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12527 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
12528 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12529 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
12530 return (uint64_t)ret_ref;
12533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
12534 LDKOutPoint a_conv;
12535 a_conv.inner = (void*)(a & (~1));
12536 a_conv.is_owned = (a & 1) || (a == 0);
12537 a_conv = OutPoint_clone(&a_conv);
12539 b_ref.datalen = (*env)->GetArrayLength(env, b);
12540 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12541 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12542 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
12543 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
12544 return (uint64_t)ret_ref;
12547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12548 if ((_res & 1) != 0) return;
12549 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
12551 C2Tuple_OutPointScriptZ_free(_res_conv);
12554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12555 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
12556 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12557 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
12558 return (uint64_t)ret_ref;
12561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
12563 b_ref.datalen = (*env)->GetArrayLength(env, b);
12564 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
12565 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
12566 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
12567 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
12568 return (uint64_t)ret_ref;
12571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12572 if ((_res & 1) != 0) return;
12573 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
12575 C2Tuple_u32ScriptZ_free(_res_conv);
12578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12579 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
12580 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12581 if (_res_constr.datalen > 0)
12582 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12584 _res_constr.data = NULL;
12585 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12586 for (size_t b = 0; b < _res_constr.datalen; b++) {
12587 int64_t _res_conv_27 = _res_vals[b];
12588 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
12589 FREE((void*)_res_conv_27);
12590 _res_constr.data[b] = _res_conv_27_conv;
12592 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12593 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
12596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12597 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
12598 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12599 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
12600 return (uint64_t)ret_ref;
12603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12604 LDKThirtyTwoBytes a_ref;
12605 CHECK((*env)->GetArrayLength(env, a) == 32);
12606 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12607 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
12608 b_constr.datalen = (*env)->GetArrayLength(env, b);
12609 if (b_constr.datalen > 0)
12610 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
12612 b_constr.data = NULL;
12613 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12614 for (size_t b = 0; b < b_constr.datalen; b++) {
12615 int64_t b_conv_27 = b_vals[b];
12616 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
12617 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
12618 b_constr.data[b] = b_conv_27_conv;
12620 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12621 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
12622 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
12623 return (uint64_t)ret_ref;
12626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12627 if ((_res & 1) != 0) return;
12628 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
12630 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
12633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12634 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
12635 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12636 if (_res_constr.datalen > 0)
12637 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
12639 _res_constr.data = NULL;
12640 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12641 for (size_t v = 0; v < _res_constr.datalen; v++) {
12642 int64_t _res_conv_47 = _res_vals[v];
12643 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
12644 FREE((void*)_res_conv_47);
12645 _res_constr.data[v] = _res_conv_47_conv;
12647 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12648 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
12651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12652 LDKCVec_EventZ _res_constr;
12653 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12654 if (_res_constr.datalen > 0)
12655 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
12657 _res_constr.data = NULL;
12658 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12659 for (size_t h = 0; h < _res_constr.datalen; h++) {
12660 int64_t _res_conv_7 = _res_vals[h];
12661 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
12662 FREE((void*)_res_conv_7);
12663 _res_constr.data[h] = _res_conv_7_conv;
12665 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12666 CVec_EventZ_free(_res_constr);
12669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
12670 LDKCVec_TransactionZ _res_constr;
12671 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12672 if (_res_constr.datalen > 0)
12673 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
12675 _res_constr.data = NULL;
12676 for (size_t i = 0; i < _res_constr.datalen; i++) {
12677 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
12678 LDKTransaction _res_conv_8_ref;
12679 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
12680 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
12681 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
12682 _res_conv_8_ref.data_is_owned = true;
12683 _res_constr.data[i] = _res_conv_8_ref;
12685 CVec_TransactionZ_free(_res_constr);
12688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12689 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
12690 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12691 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
12692 return (uint64_t)ret_ref;
12695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
12696 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
12697 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
12698 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
12699 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
12700 return (uint64_t)ret_ref;
12703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12704 if ((_res & 1) != 0) return;
12705 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
12707 C2Tuple_u32TxOutZ_free(_res_conv);
12710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12711 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
12712 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12713 if (_res_constr.datalen > 0)
12714 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12716 _res_constr.data = NULL;
12717 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12718 for (size_t a = 0; a < _res_constr.datalen; a++) {
12719 int64_t _res_conv_26 = _res_vals[a];
12720 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
12721 FREE((void*)_res_conv_26);
12722 _res_constr.data[a] = _res_conv_26_conv;
12724 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12725 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
12728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12729 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
12730 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12731 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
12732 return (uint64_t)ret_ref;
12735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
12736 LDKThirtyTwoBytes a_ref;
12737 CHECK((*env)->GetArrayLength(env, a) == 32);
12738 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
12739 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
12740 b_constr.datalen = (*env)->GetArrayLength(env, b);
12741 if (b_constr.datalen > 0)
12742 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
12744 b_constr.data = NULL;
12745 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
12746 for (size_t a = 0; a < b_constr.datalen; a++) {
12747 int64_t b_conv_26 = b_vals[a];
12748 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
12749 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
12750 b_constr.data[a] = b_conv_26_conv;
12752 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
12753 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
12754 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
12755 return (uint64_t)ret_ref;
12758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12759 if ((_res & 1) != 0) return;
12760 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
12762 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
12765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12766 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
12767 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12768 if (_res_constr.datalen > 0)
12769 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
12771 _res_constr.data = NULL;
12772 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12773 for (size_t u = 0; u < _res_constr.datalen; u++) {
12774 int64_t _res_conv_46 = _res_vals[u];
12775 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
12776 FREE((void*)_res_conv_46);
12777 _res_constr.data[u] = _res_conv_46_conv;
12779 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12780 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
12783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12784 LDKCVec_BalanceZ _res_constr;
12785 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12786 if (_res_constr.datalen > 0)
12787 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
12789 _res_constr.data = NULL;
12790 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12791 for (size_t j = 0; j < _res_constr.datalen; j++) {
12792 int64_t _res_conv_9 = _res_vals[j];
12793 LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
12794 FREE((void*)_res_conv_9);
12795 _res_constr.data[j] = _res_conv_9_conv;
12797 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12798 CVec_BalanceZ_free(_res_constr);
12801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12802 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
12803 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
12804 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12805 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
12806 return (uint64_t)ret_conv;
12809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12810 LDKDecodeError e_conv;
12811 e_conv.inner = (void*)(e & (~1));
12812 e_conv.is_owned = (e & 1) || (e == 0);
12813 e_conv = DecodeError_clone(&e_conv);
12814 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
12815 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
12816 return (uint64_t)ret_conv;
12819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12820 if ((_res & 1) != 0) return;
12821 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12823 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
12826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
12827 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12828 *ret_conv = CResult_NoneLightningErrorZ_ok();
12829 return (uint64_t)ret_conv;
12832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12833 LDKLightningError e_conv;
12834 e_conv.inner = (void*)(e & (~1));
12835 e_conv.is_owned = (e & 1) || (e == 0);
12836 e_conv = LightningError_clone(&e_conv);
12837 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12838 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
12839 return (uint64_t)ret_conv;
12842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12843 if ((_res & 1) != 0) return;
12844 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
12846 CResult_NoneLightningErrorZ_free(_res_conv);
12849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12850 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
12851 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12852 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
12853 return (uint64_t)ret_conv;
12856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12857 LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
12858 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12859 *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
12860 return (uint64_t)ret_ref;
12863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
12864 LDKPublicKey a_ref;
12865 CHECK((*env)->GetArrayLength(env, a) == 33);
12866 (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
12867 LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
12868 if (b_conv.free == LDKType_JCalls_free) {
12869 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12870 LDKType_JCalls_cloned(&b_conv);
12872 LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
12873 *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
12874 return (uint64_t)ret_ref;
12877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12878 if ((_res & 1) != 0) return;
12879 LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
12881 C2Tuple_PublicKeyTypeZ_free(_res_conv);
12884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12885 LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
12886 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12887 if (_res_constr.datalen > 0)
12888 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
12890 _res_constr.data = NULL;
12891 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12892 for (size_t y = 0; y < _res_constr.datalen; y++) {
12893 int64_t _res_conv_24 = _res_vals[y];
12894 LDKC2Tuple_PublicKeyTypeZ _res_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_24) & ~1);
12895 FREE((void*)_res_conv_24);
12896 _res_constr.data[y] = _res_conv_24_conv;
12898 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12899 CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
12902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
12903 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12904 *ret_conv = CResult_boolLightningErrorZ_ok(o);
12905 return (uint64_t)ret_conv;
12908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12909 LDKLightningError e_conv;
12910 e_conv.inner = (void*)(e & (~1));
12911 e_conv.is_owned = (e & 1) || (e == 0);
12912 e_conv = LightningError_clone(&e_conv);
12913 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12914 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
12915 return (uint64_t)ret_conv;
12918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12919 if ((_res & 1) != 0) return;
12920 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
12922 CResult_boolLightningErrorZ_free(_res_conv);
12925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12926 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
12927 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12928 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
12929 return (uint64_t)ret_conv;
12932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12933 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
12934 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12935 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
12936 return (uint64_t)ret_ref;
12939 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) {
12940 LDKChannelAnnouncement a_conv;
12941 a_conv.inner = (void*)(a & (~1));
12942 a_conv.is_owned = (a & 1) || (a == 0);
12943 a_conv = ChannelAnnouncement_clone(&a_conv);
12944 LDKChannelUpdate b_conv;
12945 b_conv.inner = (void*)(b & (~1));
12946 b_conv.is_owned = (b & 1) || (b == 0);
12947 b_conv = ChannelUpdate_clone(&b_conv);
12948 LDKChannelUpdate c_conv;
12949 c_conv.inner = (void*)(c & (~1));
12950 c_conv.is_owned = (c & 1) || (c == 0);
12951 c_conv = ChannelUpdate_clone(&c_conv);
12952 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
12953 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
12954 return (uint64_t)ret_ref;
12957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12958 if ((_res & 1) != 0) return;
12959 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
12961 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
12964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12965 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
12966 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12967 if (_res_constr.datalen > 0)
12968 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
12970 _res_constr.data = NULL;
12971 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12972 for (size_t l = 0; l < _res_constr.datalen; l++) {
12973 int64_t _res_conv_63 = _res_vals[l];
12974 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
12975 FREE((void*)_res_conv_63);
12976 _res_constr.data[l] = _res_conv_63_conv;
12978 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12979 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
12982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12983 LDKCVec_NodeAnnouncementZ _res_constr;
12984 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12985 if (_res_constr.datalen > 0)
12986 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
12988 _res_constr.data = NULL;
12989 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12990 for (size_t s = 0; s < _res_constr.datalen; s++) {
12991 int64_t _res_conv_18 = _res_vals[s];
12992 LDKNodeAnnouncement _res_conv_18_conv;
12993 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
12994 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
12995 _res_constr.data[s] = _res_conv_18_conv;
12997 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12998 CVec_NodeAnnouncementZ_free(_res_constr);
13001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
13002 LDKCVec_PublicKeyZ _res_constr;
13003 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13004 if (_res_constr.datalen > 0)
13005 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13007 _res_constr.data = NULL;
13008 for (size_t i = 0; i < _res_constr.datalen; i++) {
13009 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
13010 LDKPublicKey _res_conv_8_ref;
13011 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
13012 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
13013 _res_constr.data[i] = _res_conv_8_ref;
13015 CVec_PublicKeyZ_free(_res_constr);
13018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
13020 o_ref.datalen = (*env)->GetArrayLength(env, o);
13021 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
13022 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
13023 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13024 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
13025 return (uint64_t)ret_conv;
13028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13029 LDKPeerHandleError e_conv;
13030 e_conv.inner = (void*)(e & (~1));
13031 e_conv.is_owned = (e & 1) || (e == 0);
13032 e_conv = PeerHandleError_clone(&e_conv);
13033 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13034 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
13035 return (uint64_t)ret_conv;
13038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13039 if ((_res & 1) != 0) return;
13040 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13042 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
13045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13046 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
13047 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
13048 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
13049 return (uint64_t)ret_conv;
13052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
13053 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13054 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
13055 return (uint64_t)ret_conv;
13058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13059 LDKPeerHandleError e_conv;
13060 e_conv.inner = (void*)(e & (~1));
13061 e_conv.is_owned = (e & 1) || (e == 0);
13062 e_conv = PeerHandleError_clone(&e_conv);
13063 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13064 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
13065 return (uint64_t)ret_conv;
13068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13069 if ((_res & 1) != 0) return;
13070 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13072 CResult_NonePeerHandleErrorZ_free(_res_conv);
13075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13076 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
13077 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
13078 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
13079 return (uint64_t)ret_conv;
13082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
13083 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13084 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
13085 return (uint64_t)ret_conv;
13088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13089 LDKPeerHandleError e_conv;
13090 e_conv.inner = (void*)(e & (~1));
13091 e_conv.is_owned = (e & 1) || (e == 0);
13092 e_conv = PeerHandleError_clone(&e_conv);
13093 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13094 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
13095 return (uint64_t)ret_conv;
13098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13099 if ((_res & 1) != 0) return;
13100 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
13102 CResult_boolPeerHandleErrorZ_free(_res_conv);
13105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13106 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
13107 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
13108 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
13109 return (uint64_t)ret_conv;
13112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
13113 LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
13114 if (o_conv.free == LDKAccess_JCalls_free) {
13115 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13116 LDKAccess_JCalls_cloned(&o_conv);
13118 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13119 *ret_copy = COption_AccessZ_some(o_conv);
13120 uint64_t ret_ref = (uint64_t)ret_copy;
13124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
13125 LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
13126 *ret_copy = COption_AccessZ_none();
13127 uint64_t ret_ref = (uint64_t)ret_copy;
13131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13132 if ((_res & 1) != 0) return;
13133 LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
13135 COption_AccessZ_free(_res_conv);
13138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13139 LDKDirectionalChannelInfo o_conv;
13140 o_conv.inner = (void*)(o & (~1));
13141 o_conv.is_owned = (o & 1) || (o == 0);
13142 o_conv = DirectionalChannelInfo_clone(&o_conv);
13143 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13144 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
13145 return (uint64_t)ret_conv;
13148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13149 LDKDecodeError e_conv;
13150 e_conv.inner = (void*)(e & (~1));
13151 e_conv.is_owned = (e & 1) || (e == 0);
13152 e_conv = DecodeError_clone(&e_conv);
13153 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13154 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
13155 return (uint64_t)ret_conv;
13158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13159 if ((_res & 1) != 0) return;
13160 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13162 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
13165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13166 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
13167 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
13168 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
13169 return (uint64_t)ret_conv;
13172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13173 LDKChannelInfo o_conv;
13174 o_conv.inner = (void*)(o & (~1));
13175 o_conv.is_owned = (o & 1) || (o == 0);
13176 o_conv = ChannelInfo_clone(&o_conv);
13177 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13178 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
13179 return (uint64_t)ret_conv;
13182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13183 LDKDecodeError e_conv;
13184 e_conv.inner = (void*)(e & (~1));
13185 e_conv.is_owned = (e & 1) || (e == 0);
13186 e_conv = DecodeError_clone(&e_conv);
13187 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13188 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
13189 return (uint64_t)ret_conv;
13192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13193 if ((_res & 1) != 0) return;
13194 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13196 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
13199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13200 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
13201 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
13202 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
13203 return (uint64_t)ret_conv;
13206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13207 LDKRoutingFees o_conv;
13208 o_conv.inner = (void*)(o & (~1));
13209 o_conv.is_owned = (o & 1) || (o == 0);
13210 o_conv = RoutingFees_clone(&o_conv);
13211 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13212 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
13213 return (uint64_t)ret_conv;
13216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13217 LDKDecodeError e_conv;
13218 e_conv.inner = (void*)(e & (~1));
13219 e_conv.is_owned = (e & 1) || (e == 0);
13220 e_conv = DecodeError_clone(&e_conv);
13221 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13222 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
13223 return (uint64_t)ret_conv;
13226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13227 if ((_res & 1) != 0) return;
13228 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13230 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
13233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13234 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
13235 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
13236 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
13237 return (uint64_t)ret_conv;
13240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13241 LDKNodeAnnouncementInfo o_conv;
13242 o_conv.inner = (void*)(o & (~1));
13243 o_conv.is_owned = (o & 1) || (o == 0);
13244 o_conv = NodeAnnouncementInfo_clone(&o_conv);
13245 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13246 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
13247 return (uint64_t)ret_conv;
13250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13251 LDKDecodeError e_conv;
13252 e_conv.inner = (void*)(e & (~1));
13253 e_conv.is_owned = (e & 1) || (e == 0);
13254 e_conv = DecodeError_clone(&e_conv);
13255 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13256 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
13257 return (uint64_t)ret_conv;
13260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13261 if ((_res & 1) != 0) return;
13262 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13264 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
13267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13268 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
13269 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
13270 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
13271 return (uint64_t)ret_conv;
13274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13275 LDKCVec_u64Z _res_constr;
13276 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13277 if (_res_constr.datalen > 0)
13278 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13280 _res_constr.data = NULL;
13281 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13282 for (size_t g = 0; g < _res_constr.datalen; g++) {
13283 int64_t _res_conv_6 = _res_vals[g];
13284 _res_constr.data[g] = _res_conv_6;
13286 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13287 CVec_u64Z_free(_res_constr);
13290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13291 LDKNodeInfo o_conv;
13292 o_conv.inner = (void*)(o & (~1));
13293 o_conv.is_owned = (o & 1) || (o == 0);
13294 o_conv = NodeInfo_clone(&o_conv);
13295 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13296 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
13297 return (uint64_t)ret_conv;
13300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13301 LDKDecodeError e_conv;
13302 e_conv.inner = (void*)(e & (~1));
13303 e_conv.is_owned = (e & 1) || (e == 0);
13304 e_conv = DecodeError_clone(&e_conv);
13305 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13306 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
13307 return (uint64_t)ret_conv;
13310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13311 if ((_res & 1) != 0) return;
13312 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
13314 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
13317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13318 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
13319 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
13320 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
13321 return (uint64_t)ret_conv;
13324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13325 LDKNetworkGraph o_conv;
13326 o_conv.inner = (void*)(o & (~1));
13327 o_conv.is_owned = (o & 1) || (o == 0);
13328 // Warning: we need a move here but no clone is available for LDKNetworkGraph
13329 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13330 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
13331 return (uint64_t)ret_conv;
13334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13335 LDKDecodeError e_conv;
13336 e_conv.inner = (void*)(e & (~1));
13337 e_conv.is_owned = (e & 1) || (e == 0);
13338 e_conv = DecodeError_clone(&e_conv);
13339 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
13340 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
13341 return (uint64_t)ret_conv;
13344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13345 if ((_res & 1) != 0) return;
13346 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
13348 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
13351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
13352 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13353 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13354 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13355 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
13356 return (uint64_t)ret_conv;
13359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
13360 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13361 *ret_conv = CResult_NetAddressu8Z_err(e);
13362 return (uint64_t)ret_conv;
13365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
13366 if ((_res & 1) != 0) return;
13367 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
13369 CResult_NetAddressu8Z_free(_res_conv);
13372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13373 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
13374 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
13375 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
13376 return (uint64_t)ret_conv;
13379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13380 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
13381 o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
13382 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13383 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
13384 return (uint64_t)ret_conv;
13387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13388 LDKDecodeError e_conv;
13389 e_conv.inner = (void*)(e & (~1));
13390 e_conv.is_owned = (e & 1) || (e == 0);
13391 e_conv = DecodeError_clone(&e_conv);
13392 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13393 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
13394 return (uint64_t)ret_conv;
13397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13398 if ((_res & 1) != 0) return;
13399 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
13401 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
13404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13405 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
13406 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
13407 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
13408 return (uint64_t)ret_conv;
13411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13412 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
13413 o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
13414 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13415 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
13416 return (uint64_t)ret_conv;
13419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13420 LDKDecodeError e_conv;
13421 e_conv.inner = (void*)(e & (~1));
13422 e_conv.is_owned = (e & 1) || (e == 0);
13423 e_conv = DecodeError_clone(&e_conv);
13424 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13425 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
13426 return (uint64_t)ret_conv;
13429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13430 if ((_res & 1) != 0) return;
13431 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
13433 CResult_NetAddressDecodeErrorZ_free(_res_conv);
13436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13437 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
13438 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
13439 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
13440 return (uint64_t)ret_conv;
13443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13444 LDKCVec_UpdateAddHTLCZ _res_constr;
13445 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13446 if (_res_constr.datalen > 0)
13447 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13449 _res_constr.data = NULL;
13450 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13451 for (size_t p = 0; p < _res_constr.datalen; p++) {
13452 int64_t _res_conv_15 = _res_vals[p];
13453 LDKUpdateAddHTLC _res_conv_15_conv;
13454 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
13455 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
13456 _res_constr.data[p] = _res_conv_15_conv;
13458 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13459 CVec_UpdateAddHTLCZ_free(_res_constr);
13462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13463 LDKCVec_UpdateFulfillHTLCZ _res_constr;
13464 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13465 if (_res_constr.datalen > 0)
13466 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13468 _res_constr.data = NULL;
13469 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13470 for (size_t t = 0; t < _res_constr.datalen; t++) {
13471 int64_t _res_conv_19 = _res_vals[t];
13472 LDKUpdateFulfillHTLC _res_conv_19_conv;
13473 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
13474 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
13475 _res_constr.data[t] = _res_conv_19_conv;
13477 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13478 CVec_UpdateFulfillHTLCZ_free(_res_constr);
13481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13482 LDKCVec_UpdateFailHTLCZ _res_constr;
13483 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13484 if (_res_constr.datalen > 0)
13485 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13487 _res_constr.data = NULL;
13488 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13489 for (size_t q = 0; q < _res_constr.datalen; q++) {
13490 int64_t _res_conv_16 = _res_vals[q];
13491 LDKUpdateFailHTLC _res_conv_16_conv;
13492 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
13493 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
13494 _res_constr.data[q] = _res_conv_16_conv;
13496 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13497 CVec_UpdateFailHTLCZ_free(_res_constr);
13500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
13501 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
13502 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
13503 if (_res_constr.datalen > 0)
13504 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13506 _res_constr.data = NULL;
13507 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
13508 for (size_t z = 0; z < _res_constr.datalen; z++) {
13509 int64_t _res_conv_25 = _res_vals[z];
13510 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
13511 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
13512 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
13513 _res_constr.data[z] = _res_conv_25_conv;
13515 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
13516 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
13519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13520 LDKAcceptChannel o_conv;
13521 o_conv.inner = (void*)(o & (~1));
13522 o_conv.is_owned = (o & 1) || (o == 0);
13523 o_conv = AcceptChannel_clone(&o_conv);
13524 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13525 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
13526 return (uint64_t)ret_conv;
13529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13530 LDKDecodeError e_conv;
13531 e_conv.inner = (void*)(e & (~1));
13532 e_conv.is_owned = (e & 1) || (e == 0);
13533 e_conv = DecodeError_clone(&e_conv);
13534 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13535 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
13536 return (uint64_t)ret_conv;
13539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13540 if ((_res & 1) != 0) return;
13541 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
13543 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
13546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13547 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
13548 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
13549 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
13550 return (uint64_t)ret_conv;
13553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13554 LDKAnnouncementSignatures o_conv;
13555 o_conv.inner = (void*)(o & (~1));
13556 o_conv.is_owned = (o & 1) || (o == 0);
13557 o_conv = AnnouncementSignatures_clone(&o_conv);
13558 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13559 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
13560 return (uint64_t)ret_conv;
13563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13564 LDKDecodeError e_conv;
13565 e_conv.inner = (void*)(e & (~1));
13566 e_conv.is_owned = (e & 1) || (e == 0);
13567 e_conv = DecodeError_clone(&e_conv);
13568 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13569 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
13570 return (uint64_t)ret_conv;
13573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13574 if ((_res & 1) != 0) return;
13575 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
13577 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
13580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13581 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
13582 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
13583 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
13584 return (uint64_t)ret_conv;
13587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13588 LDKChannelReestablish o_conv;
13589 o_conv.inner = (void*)(o & (~1));
13590 o_conv.is_owned = (o & 1) || (o == 0);
13591 o_conv = ChannelReestablish_clone(&o_conv);
13592 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13593 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
13594 return (uint64_t)ret_conv;
13597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13598 LDKDecodeError e_conv;
13599 e_conv.inner = (void*)(e & (~1));
13600 e_conv.is_owned = (e & 1) || (e == 0);
13601 e_conv = DecodeError_clone(&e_conv);
13602 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13603 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
13604 return (uint64_t)ret_conv;
13607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13608 if ((_res & 1) != 0) return;
13609 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
13611 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
13614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13615 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
13616 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13617 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
13618 return (uint64_t)ret_conv;
13621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13622 LDKClosingSigned o_conv;
13623 o_conv.inner = (void*)(o & (~1));
13624 o_conv.is_owned = (o & 1) || (o == 0);
13625 o_conv = ClosingSigned_clone(&o_conv);
13626 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13627 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
13628 return (uint64_t)ret_conv;
13631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13632 LDKDecodeError e_conv;
13633 e_conv.inner = (void*)(e & (~1));
13634 e_conv.is_owned = (e & 1) || (e == 0);
13635 e_conv = DecodeError_clone(&e_conv);
13636 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13637 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
13638 return (uint64_t)ret_conv;
13641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13642 if ((_res & 1) != 0) return;
13643 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13645 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
13648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13649 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
13650 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
13651 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
13652 return (uint64_t)ret_conv;
13655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13656 LDKClosingSignedFeeRange o_conv;
13657 o_conv.inner = (void*)(o & (~1));
13658 o_conv.is_owned = (o & 1) || (o == 0);
13659 o_conv = ClosingSignedFeeRange_clone(&o_conv);
13660 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13661 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
13662 return (uint64_t)ret_conv;
13665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13666 LDKDecodeError e_conv;
13667 e_conv.inner = (void*)(e & (~1));
13668 e_conv.is_owned = (e & 1) || (e == 0);
13669 e_conv = DecodeError_clone(&e_conv);
13670 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13671 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
13672 return (uint64_t)ret_conv;
13675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13676 if ((_res & 1) != 0) return;
13677 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13679 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
13682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13683 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
13684 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
13685 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
13686 return (uint64_t)ret_conv;
13689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13690 LDKCommitmentSigned o_conv;
13691 o_conv.inner = (void*)(o & (~1));
13692 o_conv.is_owned = (o & 1) || (o == 0);
13693 o_conv = CommitmentSigned_clone(&o_conv);
13694 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13695 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
13696 return (uint64_t)ret_conv;
13699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13700 LDKDecodeError e_conv;
13701 e_conv.inner = (void*)(e & (~1));
13702 e_conv.is_owned = (e & 1) || (e == 0);
13703 e_conv = DecodeError_clone(&e_conv);
13704 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13705 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
13706 return (uint64_t)ret_conv;
13709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13710 if ((_res & 1) != 0) return;
13711 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13713 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
13716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13717 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
13718 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
13719 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
13720 return (uint64_t)ret_conv;
13723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13724 LDKFundingCreated o_conv;
13725 o_conv.inner = (void*)(o & (~1));
13726 o_conv.is_owned = (o & 1) || (o == 0);
13727 o_conv = FundingCreated_clone(&o_conv);
13728 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13729 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
13730 return (uint64_t)ret_conv;
13733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13734 LDKDecodeError e_conv;
13735 e_conv.inner = (void*)(e & (~1));
13736 e_conv.is_owned = (e & 1) || (e == 0);
13737 e_conv = DecodeError_clone(&e_conv);
13738 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13739 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
13740 return (uint64_t)ret_conv;
13743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13744 if ((_res & 1) != 0) return;
13745 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13747 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
13750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13751 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
13752 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
13753 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
13754 return (uint64_t)ret_conv;
13757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13758 LDKFundingSigned o_conv;
13759 o_conv.inner = (void*)(o & (~1));
13760 o_conv.is_owned = (o & 1) || (o == 0);
13761 o_conv = FundingSigned_clone(&o_conv);
13762 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13763 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
13764 return (uint64_t)ret_conv;
13767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13768 LDKDecodeError e_conv;
13769 e_conv.inner = (void*)(e & (~1));
13770 e_conv.is_owned = (e & 1) || (e == 0);
13771 e_conv = DecodeError_clone(&e_conv);
13772 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13773 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
13774 return (uint64_t)ret_conv;
13777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13778 if ((_res & 1) != 0) return;
13779 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13781 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
13784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13785 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
13786 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
13787 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
13788 return (uint64_t)ret_conv;
13791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13792 LDKFundingLocked o_conv;
13793 o_conv.inner = (void*)(o & (~1));
13794 o_conv.is_owned = (o & 1) || (o == 0);
13795 o_conv = FundingLocked_clone(&o_conv);
13796 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13797 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
13798 return (uint64_t)ret_conv;
13801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13802 LDKDecodeError e_conv;
13803 e_conv.inner = (void*)(e & (~1));
13804 e_conv.is_owned = (e & 1) || (e == 0);
13805 e_conv = DecodeError_clone(&e_conv);
13806 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13807 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
13808 return (uint64_t)ret_conv;
13811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13812 if ((_res & 1) != 0) return;
13813 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
13815 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
13818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13819 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
13820 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
13821 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
13822 return (uint64_t)ret_conv;
13825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13827 o_conv.inner = (void*)(o & (~1));
13828 o_conv.is_owned = (o & 1) || (o == 0);
13829 o_conv = Init_clone(&o_conv);
13830 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13831 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
13832 return (uint64_t)ret_conv;
13835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13836 LDKDecodeError e_conv;
13837 e_conv.inner = (void*)(e & (~1));
13838 e_conv.is_owned = (e & 1) || (e == 0);
13839 e_conv = DecodeError_clone(&e_conv);
13840 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13841 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
13842 return (uint64_t)ret_conv;
13845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13846 if ((_res & 1) != 0) return;
13847 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
13849 CResult_InitDecodeErrorZ_free(_res_conv);
13852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13853 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
13854 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13855 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
13856 return (uint64_t)ret_conv;
13859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13860 LDKOpenChannel o_conv;
13861 o_conv.inner = (void*)(o & (~1));
13862 o_conv.is_owned = (o & 1) || (o == 0);
13863 o_conv = OpenChannel_clone(&o_conv);
13864 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13865 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
13866 return (uint64_t)ret_conv;
13869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13870 LDKDecodeError e_conv;
13871 e_conv.inner = (void*)(e & (~1));
13872 e_conv.is_owned = (e & 1) || (e == 0);
13873 e_conv = DecodeError_clone(&e_conv);
13874 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13875 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
13876 return (uint64_t)ret_conv;
13879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13880 if ((_res & 1) != 0) return;
13881 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
13883 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
13886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13887 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
13888 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
13889 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
13890 return (uint64_t)ret_conv;
13893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13894 LDKRevokeAndACK o_conv;
13895 o_conv.inner = (void*)(o & (~1));
13896 o_conv.is_owned = (o & 1) || (o == 0);
13897 o_conv = RevokeAndACK_clone(&o_conv);
13898 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13899 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
13900 return (uint64_t)ret_conv;
13903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13904 LDKDecodeError e_conv;
13905 e_conv.inner = (void*)(e & (~1));
13906 e_conv.is_owned = (e & 1) || (e == 0);
13907 e_conv = DecodeError_clone(&e_conv);
13908 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13909 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
13910 return (uint64_t)ret_conv;
13913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13914 if ((_res & 1) != 0) return;
13915 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
13917 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
13920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13921 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
13922 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
13923 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
13924 return (uint64_t)ret_conv;
13927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13928 LDKShutdown o_conv;
13929 o_conv.inner = (void*)(o & (~1));
13930 o_conv.is_owned = (o & 1) || (o == 0);
13931 o_conv = Shutdown_clone(&o_conv);
13932 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13933 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
13934 return (uint64_t)ret_conv;
13937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13938 LDKDecodeError e_conv;
13939 e_conv.inner = (void*)(e & (~1));
13940 e_conv.is_owned = (e & 1) || (e == 0);
13941 e_conv = DecodeError_clone(&e_conv);
13942 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13943 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
13944 return (uint64_t)ret_conv;
13947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13948 if ((_res & 1) != 0) return;
13949 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
13951 CResult_ShutdownDecodeErrorZ_free(_res_conv);
13954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13955 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
13956 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
13957 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
13958 return (uint64_t)ret_conv;
13961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13962 LDKUpdateFailHTLC o_conv;
13963 o_conv.inner = (void*)(o & (~1));
13964 o_conv.is_owned = (o & 1) || (o == 0);
13965 o_conv = UpdateFailHTLC_clone(&o_conv);
13966 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13967 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
13968 return (uint64_t)ret_conv;
13971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13972 LDKDecodeError e_conv;
13973 e_conv.inner = (void*)(e & (~1));
13974 e_conv.is_owned = (e & 1) || (e == 0);
13975 e_conv = DecodeError_clone(&e_conv);
13976 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13977 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
13978 return (uint64_t)ret_conv;
13981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13982 if ((_res & 1) != 0) return;
13983 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
13985 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
13988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13989 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
13990 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
13991 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
13992 return (uint64_t)ret_conv;
13995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13996 LDKUpdateFailMalformedHTLC o_conv;
13997 o_conv.inner = (void*)(o & (~1));
13998 o_conv.is_owned = (o & 1) || (o == 0);
13999 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
14000 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14001 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
14002 return (uint64_t)ret_conv;
14005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14006 LDKDecodeError e_conv;
14007 e_conv.inner = (void*)(e & (~1));
14008 e_conv.is_owned = (e & 1) || (e == 0);
14009 e_conv = DecodeError_clone(&e_conv);
14010 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14011 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
14012 return (uint64_t)ret_conv;
14015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14016 if ((_res & 1) != 0) return;
14017 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14019 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
14022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14023 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
14024 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
14025 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
14026 return (uint64_t)ret_conv;
14029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14030 LDKUpdateFee o_conv;
14031 o_conv.inner = (void*)(o & (~1));
14032 o_conv.is_owned = (o & 1) || (o == 0);
14033 o_conv = UpdateFee_clone(&o_conv);
14034 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14035 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
14036 return (uint64_t)ret_conv;
14039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14040 LDKDecodeError e_conv;
14041 e_conv.inner = (void*)(e & (~1));
14042 e_conv.is_owned = (e & 1) || (e == 0);
14043 e_conv = DecodeError_clone(&e_conv);
14044 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14045 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
14046 return (uint64_t)ret_conv;
14049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14050 if ((_res & 1) != 0) return;
14051 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14053 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
14056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14057 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
14058 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
14059 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
14060 return (uint64_t)ret_conv;
14063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14064 LDKUpdateFulfillHTLC o_conv;
14065 o_conv.inner = (void*)(o & (~1));
14066 o_conv.is_owned = (o & 1) || (o == 0);
14067 o_conv = UpdateFulfillHTLC_clone(&o_conv);
14068 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14069 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
14070 return (uint64_t)ret_conv;
14073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14074 LDKDecodeError e_conv;
14075 e_conv.inner = (void*)(e & (~1));
14076 e_conv.is_owned = (e & 1) || (e == 0);
14077 e_conv = DecodeError_clone(&e_conv);
14078 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14079 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
14080 return (uint64_t)ret_conv;
14083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14084 if ((_res & 1) != 0) return;
14085 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14087 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
14090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14091 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
14092 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
14093 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
14094 return (uint64_t)ret_conv;
14097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14098 LDKUpdateAddHTLC o_conv;
14099 o_conv.inner = (void*)(o & (~1));
14100 o_conv.is_owned = (o & 1) || (o == 0);
14101 o_conv = UpdateAddHTLC_clone(&o_conv);
14102 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14103 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
14104 return (uint64_t)ret_conv;
14107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14108 LDKDecodeError e_conv;
14109 e_conv.inner = (void*)(e & (~1));
14110 e_conv.is_owned = (e & 1) || (e == 0);
14111 e_conv = DecodeError_clone(&e_conv);
14112 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14113 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
14114 return (uint64_t)ret_conv;
14117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14118 if ((_res & 1) != 0) return;
14119 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
14121 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
14124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14125 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
14126 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
14127 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
14128 return (uint64_t)ret_conv;
14131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14133 o_conv.inner = (void*)(o & (~1));
14134 o_conv.is_owned = (o & 1) || (o == 0);
14135 o_conv = Ping_clone(&o_conv);
14136 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14137 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
14138 return (uint64_t)ret_conv;
14141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14142 LDKDecodeError e_conv;
14143 e_conv.inner = (void*)(e & (~1));
14144 e_conv.is_owned = (e & 1) || (e == 0);
14145 e_conv = DecodeError_clone(&e_conv);
14146 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14147 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
14148 return (uint64_t)ret_conv;
14151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14152 if ((_res & 1) != 0) return;
14153 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
14155 CResult_PingDecodeErrorZ_free(_res_conv);
14158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14159 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
14160 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
14161 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
14162 return (uint64_t)ret_conv;
14165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14167 o_conv.inner = (void*)(o & (~1));
14168 o_conv.is_owned = (o & 1) || (o == 0);
14169 o_conv = Pong_clone(&o_conv);
14170 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14171 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
14172 return (uint64_t)ret_conv;
14175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14176 LDKDecodeError e_conv;
14177 e_conv.inner = (void*)(e & (~1));
14178 e_conv.is_owned = (e & 1) || (e == 0);
14179 e_conv = DecodeError_clone(&e_conv);
14180 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14181 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
14182 return (uint64_t)ret_conv;
14185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14186 if ((_res & 1) != 0) return;
14187 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
14189 CResult_PongDecodeErrorZ_free(_res_conv);
14192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14193 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
14194 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
14195 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
14196 return (uint64_t)ret_conv;
14199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14200 LDKUnsignedChannelAnnouncement o_conv;
14201 o_conv.inner = (void*)(o & (~1));
14202 o_conv.is_owned = (o & 1) || (o == 0);
14203 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
14204 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14205 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
14206 return (uint64_t)ret_conv;
14209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14210 LDKDecodeError e_conv;
14211 e_conv.inner = (void*)(e & (~1));
14212 e_conv.is_owned = (e & 1) || (e == 0);
14213 e_conv = DecodeError_clone(&e_conv);
14214 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14215 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
14216 return (uint64_t)ret_conv;
14219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14220 if ((_res & 1) != 0) return;
14221 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14223 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
14226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14227 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14228 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
14229 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14230 return (uint64_t)ret_conv;
14233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14234 LDKChannelAnnouncement o_conv;
14235 o_conv.inner = (void*)(o & (~1));
14236 o_conv.is_owned = (o & 1) || (o == 0);
14237 o_conv = ChannelAnnouncement_clone(&o_conv);
14238 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14239 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
14240 return (uint64_t)ret_conv;
14243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14244 LDKDecodeError e_conv;
14245 e_conv.inner = (void*)(e & (~1));
14246 e_conv.is_owned = (e & 1) || (e == 0);
14247 e_conv = DecodeError_clone(&e_conv);
14248 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14249 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
14250 return (uint64_t)ret_conv;
14253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14254 if ((_res & 1) != 0) return;
14255 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14257 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
14260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14261 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
14262 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
14263 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
14264 return (uint64_t)ret_conv;
14267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14268 LDKUnsignedChannelUpdate o_conv;
14269 o_conv.inner = (void*)(o & (~1));
14270 o_conv.is_owned = (o & 1) || (o == 0);
14271 o_conv = UnsignedChannelUpdate_clone(&o_conv);
14272 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14273 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
14274 return (uint64_t)ret_conv;
14277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14278 LDKDecodeError e_conv;
14279 e_conv.inner = (void*)(e & (~1));
14280 e_conv.is_owned = (e & 1) || (e == 0);
14281 e_conv = DecodeError_clone(&e_conv);
14282 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14283 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
14284 return (uint64_t)ret_conv;
14287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14288 if ((_res & 1) != 0) return;
14289 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14291 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
14294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14295 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
14296 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
14297 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
14298 return (uint64_t)ret_conv;
14301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14302 LDKChannelUpdate o_conv;
14303 o_conv.inner = (void*)(o & (~1));
14304 o_conv.is_owned = (o & 1) || (o == 0);
14305 o_conv = ChannelUpdate_clone(&o_conv);
14306 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14307 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
14308 return (uint64_t)ret_conv;
14311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14312 LDKDecodeError e_conv;
14313 e_conv.inner = (void*)(e & (~1));
14314 e_conv.is_owned = (e & 1) || (e == 0);
14315 e_conv = DecodeError_clone(&e_conv);
14316 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14317 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
14318 return (uint64_t)ret_conv;
14321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14322 if ((_res & 1) != 0) return;
14323 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
14325 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
14328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14329 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
14330 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
14331 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
14332 return (uint64_t)ret_conv;
14335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14336 LDKErrorMessage o_conv;
14337 o_conv.inner = (void*)(o & (~1));
14338 o_conv.is_owned = (o & 1) || (o == 0);
14339 o_conv = ErrorMessage_clone(&o_conv);
14340 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14341 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
14342 return (uint64_t)ret_conv;
14345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14346 LDKDecodeError e_conv;
14347 e_conv.inner = (void*)(e & (~1));
14348 e_conv.is_owned = (e & 1) || (e == 0);
14349 e_conv = DecodeError_clone(&e_conv);
14350 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14351 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
14352 return (uint64_t)ret_conv;
14355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14356 if ((_res & 1) != 0) return;
14357 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
14359 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
14362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14363 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
14364 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
14365 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
14366 return (uint64_t)ret_conv;
14369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14370 LDKUnsignedNodeAnnouncement o_conv;
14371 o_conv.inner = (void*)(o & (~1));
14372 o_conv.is_owned = (o & 1) || (o == 0);
14373 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
14374 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14375 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
14376 return (uint64_t)ret_conv;
14379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14380 LDKDecodeError e_conv;
14381 e_conv.inner = (void*)(e & (~1));
14382 e_conv.is_owned = (e & 1) || (e == 0);
14383 e_conv = DecodeError_clone(&e_conv);
14384 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14385 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
14386 return (uint64_t)ret_conv;
14389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14390 if ((_res & 1) != 0) return;
14391 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14393 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
14396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14397 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
14398 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
14399 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
14400 return (uint64_t)ret_conv;
14403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14404 LDKNodeAnnouncement o_conv;
14405 o_conv.inner = (void*)(o & (~1));
14406 o_conv.is_owned = (o & 1) || (o == 0);
14407 o_conv = NodeAnnouncement_clone(&o_conv);
14408 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14409 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
14410 return (uint64_t)ret_conv;
14413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14414 LDKDecodeError e_conv;
14415 e_conv.inner = (void*)(e & (~1));
14416 e_conv.is_owned = (e & 1) || (e == 0);
14417 e_conv = DecodeError_clone(&e_conv);
14418 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14419 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
14420 return (uint64_t)ret_conv;
14423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14424 if ((_res & 1) != 0) return;
14425 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
14427 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
14430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14431 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
14432 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
14433 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
14434 return (uint64_t)ret_conv;
14437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14438 LDKQueryShortChannelIds o_conv;
14439 o_conv.inner = (void*)(o & (~1));
14440 o_conv.is_owned = (o & 1) || (o == 0);
14441 o_conv = QueryShortChannelIds_clone(&o_conv);
14442 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14443 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
14444 return (uint64_t)ret_conv;
14447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14448 LDKDecodeError e_conv;
14449 e_conv.inner = (void*)(e & (~1));
14450 e_conv.is_owned = (e & 1) || (e == 0);
14451 e_conv = DecodeError_clone(&e_conv);
14452 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14453 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
14454 return (uint64_t)ret_conv;
14457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14458 if ((_res & 1) != 0) return;
14459 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
14461 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
14464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14465 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
14466 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
14467 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
14468 return (uint64_t)ret_conv;
14471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14472 LDKReplyShortChannelIdsEnd o_conv;
14473 o_conv.inner = (void*)(o & (~1));
14474 o_conv.is_owned = (o & 1) || (o == 0);
14475 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
14476 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14477 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
14478 return (uint64_t)ret_conv;
14481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14482 LDKDecodeError e_conv;
14483 e_conv.inner = (void*)(e & (~1));
14484 e_conv.is_owned = (e & 1) || (e == 0);
14485 e_conv = DecodeError_clone(&e_conv);
14486 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14487 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
14488 return (uint64_t)ret_conv;
14491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14492 if ((_res & 1) != 0) return;
14493 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
14495 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
14498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14499 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
14500 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
14501 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
14502 return (uint64_t)ret_conv;
14505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14506 LDKQueryChannelRange o_conv;
14507 o_conv.inner = (void*)(o & (~1));
14508 o_conv.is_owned = (o & 1) || (o == 0);
14509 o_conv = QueryChannelRange_clone(&o_conv);
14510 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14511 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
14512 return (uint64_t)ret_conv;
14515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14516 LDKDecodeError e_conv;
14517 e_conv.inner = (void*)(e & (~1));
14518 e_conv.is_owned = (e & 1) || (e == 0);
14519 e_conv = DecodeError_clone(&e_conv);
14520 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14521 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
14522 return (uint64_t)ret_conv;
14525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14526 if ((_res & 1) != 0) return;
14527 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14529 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
14532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14533 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
14534 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
14535 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
14536 return (uint64_t)ret_conv;
14539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14540 LDKReplyChannelRange o_conv;
14541 o_conv.inner = (void*)(o & (~1));
14542 o_conv.is_owned = (o & 1) || (o == 0);
14543 o_conv = ReplyChannelRange_clone(&o_conv);
14544 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14545 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
14546 return (uint64_t)ret_conv;
14549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14550 LDKDecodeError e_conv;
14551 e_conv.inner = (void*)(e & (~1));
14552 e_conv.is_owned = (e & 1) || (e == 0);
14553 e_conv = DecodeError_clone(&e_conv);
14554 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14555 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
14556 return (uint64_t)ret_conv;
14559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14560 if ((_res & 1) != 0) return;
14561 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
14563 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
14566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14567 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
14568 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14569 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
14570 return (uint64_t)ret_conv;
14573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14574 LDKGossipTimestampFilter o_conv;
14575 o_conv.inner = (void*)(o & (~1));
14576 o_conv.is_owned = (o & 1) || (o == 0);
14577 o_conv = GossipTimestampFilter_clone(&o_conv);
14578 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14579 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
14580 return (uint64_t)ret_conv;
14583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14584 LDKDecodeError e_conv;
14585 e_conv.inner = (void*)(e & (~1));
14586 e_conv.is_owned = (e & 1) || (e == 0);
14587 e_conv = DecodeError_clone(&e_conv);
14588 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14589 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
14590 return (uint64_t)ret_conv;
14593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14594 if ((_res & 1) != 0) return;
14595 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
14597 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
14600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14601 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
14602 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14603 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
14604 return (uint64_t)ret_conv;
14607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
14609 o_conv.inner = (void*)(o & (~1));
14610 o_conv.is_owned = (o & 1) || (o == 0);
14611 o_conv = Invoice_clone(&o_conv);
14612 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14613 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
14614 return (uint64_t)ret_conv;
14617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
14618 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
14619 e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
14620 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14621 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
14622 return (uint64_t)ret_conv;
14625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14626 if ((_res & 1) != 0) return;
14627 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
14629 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
14632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14633 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
14634 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
14635 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
14636 return (uint64_t)ret_conv;
14639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
14640 LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
14641 if (o_conv.free == LDKFilter_JCalls_free) {
14642 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14643 LDKFilter_JCalls_cloned(&o_conv);
14645 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14646 *ret_copy = COption_FilterZ_some(o_conv);
14647 uint64_t ret_ref = (uint64_t)ret_copy;
14651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
14652 LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
14653 *ret_copy = COption_FilterZ_none();
14654 uint64_t ret_ref = (uint64_t)ret_copy;
14658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
14659 if ((_res & 1) != 0) return;
14660 LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
14662 COption_FilterZ_free(_res_conv);
14665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14666 if ((this_ptr & 1) != 0) return;
14667 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
14668 FREE((void*)this_ptr);
14669 PaymentPurpose_free(this_ptr_conv);
14672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14673 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
14674 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14675 *ret_copy = PaymentPurpose_clone(orig_conv);
14676 uint64_t ret_ref = (uint64_t)ret_copy;
14680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
14681 LDKThirtyTwoBytes payment_preimage_ref;
14682 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14683 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14684 LDKThirtyTwoBytes payment_secret_ref;
14685 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
14686 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
14687 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14688 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
14689 uint64_t ret_ref = (uint64_t)ret_copy;
14693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
14694 LDKThirtyTwoBytes a_ref;
14695 CHECK((*env)->GetArrayLength(env, a) == 32);
14696 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
14697 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14698 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
14699 uint64_t ret_ref = (uint64_t)ret_copy;
14703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14704 if ((this_ptr & 1) != 0) return;
14705 LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
14706 FREE((void*)this_ptr);
14707 ClosureReason_free(this_ptr_conv);
14710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14711 LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
14712 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14713 *ret_copy = ClosureReason_clone(orig_conv);
14714 uint64_t ret_ref = (uint64_t)ret_copy;
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
14719 LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
14720 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14721 *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
14722 uint64_t ret_ref = (uint64_t)ret_copy;
14726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
14727 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14728 *ret_copy = ClosureReason_holder_force_closed();
14729 uint64_t ret_ref = (uint64_t)ret_copy;
14733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
14734 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14735 *ret_copy = ClosureReason_cooperative_closure();
14736 uint64_t ret_ref = (uint64_t)ret_copy;
14740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
14741 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14742 *ret_copy = ClosureReason_commitment_tx_confirmed();
14743 uint64_t ret_ref = (uint64_t)ret_copy;
14747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
14748 LDKStr err_conv = java_to_owned_str(env, err);
14749 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14750 *ret_copy = ClosureReason_processing_error(err_conv);
14751 uint64_t ret_ref = (uint64_t)ret_copy;
14755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
14756 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14757 *ret_copy = ClosureReason_disconnected_peer();
14758 uint64_t ret_ref = (uint64_t)ret_copy;
14762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
14763 LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
14764 *ret_copy = ClosureReason_outdated_channel_manager();
14765 uint64_t ret_ref = (uint64_t)ret_copy;
14769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
14770 LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
14771 LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
14772 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14773 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14774 CVec_u8Z_free(ret_var);
14778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14779 if ((this_ptr & 1) != 0) return;
14780 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
14781 FREE((void*)this_ptr);
14782 Event_free(this_ptr_conv);
14785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14786 LDKEvent* orig_conv = (LDKEvent*)orig;
14787 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14788 *ret_copy = Event_clone(orig_conv);
14789 uint64_t ret_ref = (uint64_t)ret_copy;
14793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
14794 LDKThirtyTwoBytes temporary_channel_id_ref;
14795 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
14796 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
14797 LDKCVec_u8Z output_script_ref;
14798 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
14799 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
14800 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
14801 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14802 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
14803 uint64_t ret_ref = (uint64_t)ret_copy;
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
14808 LDKThirtyTwoBytes payment_hash_ref;
14809 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14810 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14811 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
14812 purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
14813 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14814 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
14815 uint64_t ret_ref = (uint64_t)ret_copy;
14819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
14820 LDKThirtyTwoBytes payment_preimage_ref;
14821 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
14822 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
14823 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14824 *ret_copy = Event_payment_sent(payment_preimage_ref);
14825 uint64_t ret_ref = (uint64_t)ret_copy;
14829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) {
14830 LDKThirtyTwoBytes payment_hash_ref;
14831 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
14832 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
14833 LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
14834 network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
14835 LDKCVec_RouteHopZ path_constr;
14836 path_constr.datalen = (*env)->GetArrayLength(env, path);
14837 if (path_constr.datalen > 0)
14838 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
14840 path_constr.data = NULL;
14841 int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
14842 for (size_t k = 0; k < path_constr.datalen; k++) {
14843 int64_t path_conv_10 = path_vals[k];
14844 LDKRouteHop path_conv_10_conv;
14845 path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
14846 path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
14847 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
14848 path_constr.data[k] = path_conv_10_conv;
14850 (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
14851 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14852 *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
14853 uint64_t ret_ref = (uint64_t)ret_copy;
14857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
14858 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14859 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
14860 uint64_t ret_ref = (uint64_t)ret_copy;
14864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
14865 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
14866 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
14867 if (outputs_constr.datalen > 0)
14868 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
14870 outputs_constr.data = NULL;
14871 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
14872 for (size_t b = 0; b < outputs_constr.datalen; b++) {
14873 int64_t outputs_conv_27 = outputs_vals[b];
14874 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
14875 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
14876 outputs_constr.data[b] = outputs_conv_27_conv;
14878 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
14879 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14880 *ret_copy = Event_spendable_outputs(outputs_constr);
14881 uint64_t ret_ref = (uint64_t)ret_copy;
14885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
14886 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
14887 fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
14888 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14889 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
14890 uint64_t ret_ref = (uint64_t)ret_copy;
14894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) {
14895 LDKThirtyTwoBytes channel_id_ref;
14896 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
14897 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
14898 LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
14899 reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
14900 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14901 *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
14902 uint64_t ret_ref = (uint64_t)ret_copy;
14906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
14907 LDKEvent* obj_conv = (LDKEvent*)obj;
14908 LDKCVec_u8Z ret_var = Event_write(obj_conv);
14909 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14910 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14911 CVec_u8Z_free(ret_var);
14915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14916 if ((this_ptr & 1) != 0) return;
14917 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
14918 FREE((void*)this_ptr);
14919 MessageSendEvent_free(this_ptr_conv);
14922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14923 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
14924 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14925 *ret_copy = MessageSendEvent_clone(orig_conv);
14926 uint64_t ret_ref = (uint64_t)ret_copy;
14930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14931 LDKPublicKey node_id_ref;
14932 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14933 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14934 LDKAcceptChannel msg_conv;
14935 msg_conv.inner = (void*)(msg & (~1));
14936 msg_conv.is_owned = (msg & 1) || (msg == 0);
14937 msg_conv = AcceptChannel_clone(&msg_conv);
14938 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14939 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
14940 uint64_t ret_ref = (uint64_t)ret_copy;
14944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14945 LDKPublicKey node_id_ref;
14946 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14947 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14948 LDKOpenChannel msg_conv;
14949 msg_conv.inner = (void*)(msg & (~1));
14950 msg_conv.is_owned = (msg & 1) || (msg == 0);
14951 msg_conv = OpenChannel_clone(&msg_conv);
14952 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14953 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
14954 uint64_t ret_ref = (uint64_t)ret_copy;
14958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14959 LDKPublicKey node_id_ref;
14960 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14961 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14962 LDKFundingCreated msg_conv;
14963 msg_conv.inner = (void*)(msg & (~1));
14964 msg_conv.is_owned = (msg & 1) || (msg == 0);
14965 msg_conv = FundingCreated_clone(&msg_conv);
14966 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14967 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
14968 uint64_t ret_ref = (uint64_t)ret_copy;
14972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14973 LDKPublicKey node_id_ref;
14974 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14975 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14976 LDKFundingSigned msg_conv;
14977 msg_conv.inner = (void*)(msg & (~1));
14978 msg_conv.is_owned = (msg & 1) || (msg == 0);
14979 msg_conv = FundingSigned_clone(&msg_conv);
14980 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14981 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
14982 uint64_t ret_ref = (uint64_t)ret_copy;
14986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
14987 LDKPublicKey node_id_ref;
14988 CHECK((*env)->GetArrayLength(env, node_id) == 33);
14989 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
14990 LDKFundingLocked msg_conv;
14991 msg_conv.inner = (void*)(msg & (~1));
14992 msg_conv.is_owned = (msg & 1) || (msg == 0);
14993 msg_conv = FundingLocked_clone(&msg_conv);
14994 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
14995 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
14996 uint64_t ret_ref = (uint64_t)ret_copy;
15000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15001 LDKPublicKey node_id_ref;
15002 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15003 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15004 LDKAnnouncementSignatures msg_conv;
15005 msg_conv.inner = (void*)(msg & (~1));
15006 msg_conv.is_owned = (msg & 1) || (msg == 0);
15007 msg_conv = AnnouncementSignatures_clone(&msg_conv);
15008 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15009 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
15010 uint64_t ret_ref = (uint64_t)ret_copy;
15014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
15015 LDKPublicKey node_id_ref;
15016 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15017 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15018 LDKCommitmentUpdate updates_conv;
15019 updates_conv.inner = (void*)(updates & (~1));
15020 updates_conv.is_owned = (updates & 1) || (updates == 0);
15021 updates_conv = CommitmentUpdate_clone(&updates_conv);
15022 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15023 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
15024 uint64_t ret_ref = (uint64_t)ret_copy;
15028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1revoke_1and_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15029 LDKPublicKey node_id_ref;
15030 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15031 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15032 LDKRevokeAndACK msg_conv;
15033 msg_conv.inner = (void*)(msg & (~1));
15034 msg_conv.is_owned = (msg & 1) || (msg == 0);
15035 msg_conv = RevokeAndACK_clone(&msg_conv);
15036 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15037 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
15038 uint64_t ret_ref = (uint64_t)ret_copy;
15042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15043 LDKPublicKey node_id_ref;
15044 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15045 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15046 LDKClosingSigned msg_conv;
15047 msg_conv.inner = (void*)(msg & (~1));
15048 msg_conv.is_owned = (msg & 1) || (msg == 0);
15049 msg_conv = ClosingSigned_clone(&msg_conv);
15050 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15051 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
15052 uint64_t ret_ref = (uint64_t)ret_copy;
15056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15057 LDKPublicKey node_id_ref;
15058 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15059 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15060 LDKShutdown msg_conv;
15061 msg_conv.inner = (void*)(msg & (~1));
15062 msg_conv.is_owned = (msg & 1) || (msg == 0);
15063 msg_conv = Shutdown_clone(&msg_conv);
15064 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15065 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
15066 uint64_t ret_ref = (uint64_t)ret_copy;
15070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15071 LDKPublicKey node_id_ref;
15072 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15073 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15074 LDKChannelReestablish msg_conv;
15075 msg_conv.inner = (void*)(msg & (~1));
15076 msg_conv.is_owned = (msg & 1) || (msg == 0);
15077 msg_conv = ChannelReestablish_clone(&msg_conv);
15078 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15079 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
15080 uint64_t ret_ref = (uint64_t)ret_copy;
15084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
15085 LDKChannelAnnouncement msg_conv;
15086 msg_conv.inner = (void*)(msg & (~1));
15087 msg_conv.is_owned = (msg & 1) || (msg == 0);
15088 msg_conv = ChannelAnnouncement_clone(&msg_conv);
15089 LDKChannelUpdate update_msg_conv;
15090 update_msg_conv.inner = (void*)(update_msg & (~1));
15091 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
15092 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
15093 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15094 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
15095 uint64_t ret_ref = (uint64_t)ret_copy;
15099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
15100 LDKNodeAnnouncement msg_conv;
15101 msg_conv.inner = (void*)(msg & (~1));
15102 msg_conv.is_owned = (msg & 1) || (msg == 0);
15103 msg_conv = NodeAnnouncement_clone(&msg_conv);
15104 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15105 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
15106 uint64_t ret_ref = (uint64_t)ret_copy;
15110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
15111 LDKChannelUpdate msg_conv;
15112 msg_conv.inner = (void*)(msg & (~1));
15113 msg_conv.is_owned = (msg & 1) || (msg == 0);
15114 msg_conv = ChannelUpdate_clone(&msg_conv);
15115 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15116 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
15117 uint64_t ret_ref = (uint64_t)ret_copy;
15121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15122 LDKPublicKey node_id_ref;
15123 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15124 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15125 LDKChannelUpdate msg_conv;
15126 msg_conv.inner = (void*)(msg & (~1));
15127 msg_conv.is_owned = (msg & 1) || (msg == 0);
15128 msg_conv = ChannelUpdate_clone(&msg_conv);
15129 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15130 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
15131 uint64_t ret_ref = (uint64_t)ret_copy;
15135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
15136 LDKPublicKey node_id_ref;
15137 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15138 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15139 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
15140 action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
15141 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15142 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
15143 uint64_t ret_ref = (uint64_t)ret_copy;
15147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15148 LDKPublicKey node_id_ref;
15149 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15150 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15151 LDKQueryChannelRange msg_conv;
15152 msg_conv.inner = (void*)(msg & (~1));
15153 msg_conv.is_owned = (msg & 1) || (msg == 0);
15154 msg_conv = QueryChannelRange_clone(&msg_conv);
15155 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15156 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
15157 uint64_t ret_ref = (uint64_t)ret_copy;
15161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short_1ids_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15162 LDKPublicKey node_id_ref;
15163 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15164 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15165 LDKQueryShortChannelIds msg_conv;
15166 msg_conv.inner = (void*)(msg & (~1));
15167 msg_conv.is_owned = (msg & 1) || (msg == 0);
15168 msg_conv = QueryShortChannelIds_clone(&msg_conv);
15169 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15170 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
15171 uint64_t ret_ref = (uint64_t)ret_copy;
15175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
15176 LDKPublicKey node_id_ref;
15177 CHECK((*env)->GetArrayLength(env, node_id) == 33);
15178 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
15179 LDKReplyChannelRange msg_conv;
15180 msg_conv.inner = (void*)(msg & (~1));
15181 msg_conv.is_owned = (msg & 1) || (msg == 0);
15182 msg_conv = ReplyChannelRange_clone(&msg_conv);
15183 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
15184 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
15185 uint64_t ret_ref = (uint64_t)ret_copy;
15189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15190 if ((this_ptr & 1) != 0) return;
15191 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
15192 FREE((void*)this_ptr);
15193 MessageSendEventsProvider_free(this_ptr_conv);
15196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15197 if ((this_ptr & 1) != 0) return;
15198 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
15199 FREE((void*)this_ptr);
15200 EventsProvider_free(this_ptr_conv);
15203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15204 if ((this_ptr & 1) != 0) return;
15205 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
15206 FREE((void*)this_ptr);
15207 EventHandler_free(this_ptr_conv);
15210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15211 if ((this_ptr & 1) != 0) return;
15212 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
15213 FREE((void*)this_ptr);
15214 APIError_free(this_ptr_conv);
15217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15218 LDKAPIError* orig_conv = (LDKAPIError*)orig;
15219 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15220 *ret_copy = APIError_clone(orig_conv);
15221 uint64_t ret_ref = (uint64_t)ret_copy;
15225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
15226 LDKStr err_conv = java_to_owned_str(env, err);
15227 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15228 *ret_copy = APIError_apimisuse_error(err_conv);
15229 uint64_t ret_ref = (uint64_t)ret_copy;
15233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
15234 LDKStr err_conv = java_to_owned_str(env, err);
15235 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15236 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
15237 uint64_t ret_ref = (uint64_t)ret_copy;
15241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
15242 LDKStr err_conv = java_to_owned_str(env, err);
15243 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15244 *ret_copy = APIError_route_error(err_conv);
15245 uint64_t ret_ref = (uint64_t)ret_copy;
15249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
15250 LDKStr err_conv = java_to_owned_str(env, err);
15251 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15252 *ret_copy = APIError_channel_unavailable(err_conv);
15253 uint64_t ret_ref = (uint64_t)ret_copy;
15257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
15258 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15259 *ret_copy = APIError_monitor_update_failed();
15260 uint64_t ret_ref = (uint64_t)ret_copy;
15264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
15265 LDKShutdownScript script_conv;
15266 script_conv.inner = (void*)(script & (~1));
15267 script_conv.is_owned = (script & 1) || (script == 0);
15268 script_conv = ShutdownScript_clone(&script_conv);
15269 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
15270 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
15271 uint64_t ret_ref = (uint64_t)ret_copy;
15275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
15276 LDKu8slice msg_ref;
15277 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15278 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15279 unsigned char sk_arr[32];
15280 CHECK((*env)->GetArrayLength(env, sk) == 32);
15281 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
15282 unsigned char (*sk_ref)[32] = &sk_arr;
15283 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
15284 *ret_conv = sign(msg_ref, sk_ref);
15285 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15286 return (uint64_t)ret_conv;
15289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
15290 LDKu8slice msg_ref;
15291 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15292 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15293 LDKStr sig_conv = java_to_owned_str(env, sig);
15294 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
15295 *ret_conv = recover_pk(msg_ref, sig_conv);
15296 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15297 return (uint64_t)ret_conv;
15300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
15301 LDKu8slice msg_ref;
15302 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
15303 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
15304 LDKStr sig_conv = java_to_owned_str(env, sig);
15305 LDKPublicKey pk_ref;
15306 CHECK((*env)->GetArrayLength(env, pk) == 33);
15307 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
15308 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
15309 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
15313 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15314 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
15315 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
15319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
15320 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
15324 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
15325 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
15329 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
15330 jclass ret_conv = LDKLevel_to_java(env, Level_info());
15334 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
15335 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
15339 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
15340 jclass ret_conv = LDKLevel_to_java(env, Level_error());
15344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15345 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
15346 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
15347 jboolean ret_val = Level_eq(a_conv, b_conv);
15351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
15352 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
15353 int64_t ret_val = Level_hash(o_conv);
15357 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
15358 jclass ret_conv = LDKLevel_to_java(env, Level_max());
15362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15363 if ((this_ptr & 1) != 0) return;
15364 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
15365 FREE((void*)this_ptr);
15366 Logger_free(this_ptr_conv);
15369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15370 LDKChannelHandshakeConfig this_obj_conv;
15371 this_obj_conv.inner = (void*)(this_obj & (~1));
15372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15373 ChannelHandshakeConfig_free(this_obj_conv);
15376 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15377 LDKChannelHandshakeConfig this_ptr_conv;
15378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15379 this_ptr_conv.is_owned = false;
15380 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
15384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15385 LDKChannelHandshakeConfig this_ptr_conv;
15386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15387 this_ptr_conv.is_owned = false;
15388 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
15391 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15392 LDKChannelHandshakeConfig this_ptr_conv;
15393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15394 this_ptr_conv.is_owned = false;
15395 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
15399 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) {
15400 LDKChannelHandshakeConfig this_ptr_conv;
15401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15402 this_ptr_conv.is_owned = false;
15403 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
15406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15407 LDKChannelHandshakeConfig this_ptr_conv;
15408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15409 this_ptr_conv.is_owned = false;
15410 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
15414 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) {
15415 LDKChannelHandshakeConfig this_ptr_conv;
15416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15417 this_ptr_conv.is_owned = false;
15418 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
15421 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) {
15422 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
15423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15425 uint64_t ret_ref = (uint64_t)ret_var.inner;
15426 if (ret_var.is_owned) {
15432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15433 LDKChannelHandshakeConfig orig_conv;
15434 orig_conv.inner = (void*)(orig & (~1));
15435 orig_conv.is_owned = false;
15436 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
15437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15439 uint64_t ret_ref = (uint64_t)ret_var.inner;
15440 if (ret_var.is_owned) {
15446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
15447 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
15448 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15449 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15450 uint64_t ret_ref = (uint64_t)ret_var.inner;
15451 if (ret_var.is_owned) {
15457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15458 LDKChannelHandshakeLimits this_obj_conv;
15459 this_obj_conv.inner = (void*)(this_obj & (~1));
15460 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15461 ChannelHandshakeLimits_free(this_obj_conv);
15464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15465 LDKChannelHandshakeLimits this_ptr_conv;
15466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15467 this_ptr_conv.is_owned = false;
15468 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
15472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15473 LDKChannelHandshakeLimits this_ptr_conv;
15474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15475 this_ptr_conv.is_owned = false;
15476 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
15479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15480 LDKChannelHandshakeLimits this_ptr_conv;
15481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15482 this_ptr_conv.is_owned = false;
15483 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
15487 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) {
15488 LDKChannelHandshakeLimits this_ptr_conv;
15489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15490 this_ptr_conv.is_owned = false;
15491 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
15494 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) {
15495 LDKChannelHandshakeLimits this_ptr_conv;
15496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15497 this_ptr_conv.is_owned = false;
15498 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
15502 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) {
15503 LDKChannelHandshakeLimits this_ptr_conv;
15504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15505 this_ptr_conv.is_owned = false;
15506 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
15509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15510 LDKChannelHandshakeLimits this_ptr_conv;
15511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15512 this_ptr_conv.is_owned = false;
15513 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
15517 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) {
15518 LDKChannelHandshakeLimits this_ptr_conv;
15519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15520 this_ptr_conv.is_owned = false;
15521 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
15524 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
15525 LDKChannelHandshakeLimits this_ptr_conv;
15526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15527 this_ptr_conv.is_owned = false;
15528 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
15532 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) {
15533 LDKChannelHandshakeLimits this_ptr_conv;
15534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15535 this_ptr_conv.is_owned = false;
15536 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
15539 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
15540 LDKChannelHandshakeLimits this_ptr_conv;
15541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15542 this_ptr_conv.is_owned = false;
15543 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
15547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15548 LDKChannelHandshakeLimits this_ptr_conv;
15549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15550 this_ptr_conv.is_owned = false;
15551 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
15554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
15555 LDKChannelHandshakeLimits this_ptr_conv;
15556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15557 this_ptr_conv.is_owned = false;
15558 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
15562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15563 LDKChannelHandshakeLimits this_ptr_conv;
15564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15565 this_ptr_conv.is_owned = false;
15566 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
15569 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15570 LDKChannelHandshakeLimits this_ptr_conv;
15571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15572 this_ptr_conv.is_owned = false;
15573 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
15577 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) {
15578 LDKChannelHandshakeLimits this_ptr_conv;
15579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15580 this_ptr_conv.is_owned = false;
15581 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
15584 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) {
15585 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);
15586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15588 uint64_t ret_ref = (uint64_t)ret_var.inner;
15589 if (ret_var.is_owned) {
15595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15596 LDKChannelHandshakeLimits orig_conv;
15597 orig_conv.inner = (void*)(orig & (~1));
15598 orig_conv.is_owned = false;
15599 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
15600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15602 uint64_t ret_ref = (uint64_t)ret_var.inner;
15603 if (ret_var.is_owned) {
15609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
15610 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
15611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15613 uint64_t ret_ref = (uint64_t)ret_var.inner;
15614 if (ret_var.is_owned) {
15620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15621 LDKChannelConfig this_obj_conv;
15622 this_obj_conv.inner = (void*)(this_obj & (~1));
15623 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15624 ChannelConfig_free(this_obj_conv);
15627 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
15628 LDKChannelConfig this_ptr_conv;
15629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15630 this_ptr_conv.is_owned = false;
15631 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
15635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15636 LDKChannelConfig this_ptr_conv;
15637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15638 this_ptr_conv.is_owned = false;
15639 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
15642 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15643 LDKChannelConfig this_ptr_conv;
15644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15645 this_ptr_conv.is_owned = false;
15646 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
15650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15651 LDKChannelConfig this_ptr_conv;
15652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15653 this_ptr_conv.is_owned = false;
15654 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
15657 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15658 LDKChannelConfig this_ptr_conv;
15659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15660 this_ptr_conv.is_owned = false;
15661 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
15665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15666 LDKChannelConfig this_ptr_conv;
15667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15668 this_ptr_conv.is_owned = false;
15669 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
15672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
15673 LDKChannelConfig this_ptr_conv;
15674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15675 this_ptr_conv.is_owned = false;
15676 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
15680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15681 LDKChannelConfig this_ptr_conv;
15682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15683 this_ptr_conv.is_owned = false;
15684 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
15687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15688 LDKChannelConfig this_ptr_conv;
15689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15690 this_ptr_conv.is_owned = false;
15691 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
15695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15696 LDKChannelConfig this_ptr_conv;
15697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15698 this_ptr_conv.is_owned = false;
15699 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
15702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15703 LDKChannelConfig this_ptr_conv;
15704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15705 this_ptr_conv.is_owned = false;
15706 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
15710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15711 LDKChannelConfig this_ptr_conv;
15712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15713 this_ptr_conv.is_owned = false;
15714 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
15717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15718 LDKChannelConfig this_ptr_conv;
15719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15720 this_ptr_conv.is_owned = false;
15721 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
15725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15726 LDKChannelConfig this_ptr_conv;
15727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15728 this_ptr_conv.is_owned = false;
15729 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
15732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
15733 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
15734 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15735 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15736 uint64_t ret_ref = (uint64_t)ret_var.inner;
15737 if (ret_var.is_owned) {
15743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15744 LDKChannelConfig orig_conv;
15745 orig_conv.inner = (void*)(orig & (~1));
15746 orig_conv.is_owned = false;
15747 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
15748 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15749 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15750 uint64_t ret_ref = (uint64_t)ret_var.inner;
15751 if (ret_var.is_owned) {
15757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
15758 LDKChannelConfig ret_var = ChannelConfig_default();
15759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15761 uint64_t ret_ref = (uint64_t)ret_var.inner;
15762 if (ret_var.is_owned) {
15768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
15769 LDKChannelConfig obj_conv;
15770 obj_conv.inner = (void*)(obj & (~1));
15771 obj_conv.is_owned = false;
15772 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
15773 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15774 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15775 CVec_u8Z_free(ret_var);
15779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15780 LDKu8slice ser_ref;
15781 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15782 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15783 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
15784 *ret_conv = ChannelConfig_read(ser_ref);
15785 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15786 return (uint64_t)ret_conv;
15789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15790 LDKUserConfig this_obj_conv;
15791 this_obj_conv.inner = (void*)(this_obj & (~1));
15792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15793 UserConfig_free(this_obj_conv);
15796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
15797 LDKUserConfig this_ptr_conv;
15798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15799 this_ptr_conv.is_owned = false;
15800 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
15801 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15802 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15803 uint64_t ret_ref = (uint64_t)ret_var.inner;
15804 if (ret_var.is_owned) {
15810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15811 LDKUserConfig this_ptr_conv;
15812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15813 this_ptr_conv.is_owned = false;
15814 LDKChannelHandshakeConfig val_conv;
15815 val_conv.inner = (void*)(val & (~1));
15816 val_conv.is_owned = (val & 1) || (val == 0);
15817 val_conv = ChannelHandshakeConfig_clone(&val_conv);
15818 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
15821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
15822 LDKUserConfig this_ptr_conv;
15823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15824 this_ptr_conv.is_owned = false;
15825 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
15826 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15827 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15828 uint64_t ret_ref = (uint64_t)ret_var.inner;
15829 if (ret_var.is_owned) {
15835 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) {
15836 LDKUserConfig this_ptr_conv;
15837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15838 this_ptr_conv.is_owned = false;
15839 LDKChannelHandshakeLimits val_conv;
15840 val_conv.inner = (void*)(val & (~1));
15841 val_conv.is_owned = (val & 1) || (val == 0);
15842 val_conv = ChannelHandshakeLimits_clone(&val_conv);
15843 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
15846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
15847 LDKUserConfig this_ptr_conv;
15848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15849 this_ptr_conv.is_owned = false;
15850 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
15851 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15852 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15853 uint64_t ret_ref = (uint64_t)ret_var.inner;
15854 if (ret_var.is_owned) {
15860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15861 LDKUserConfig this_ptr_conv;
15862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15863 this_ptr_conv.is_owned = false;
15864 LDKChannelConfig val_conv;
15865 val_conv.inner = (void*)(val & (~1));
15866 val_conv.is_owned = (val & 1) || (val == 0);
15867 val_conv = ChannelConfig_clone(&val_conv);
15868 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
15871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
15872 LDKUserConfig this_ptr_conv;
15873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15874 this_ptr_conv.is_owned = false;
15875 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
15879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15880 LDKUserConfig this_ptr_conv;
15881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15882 this_ptr_conv.is_owned = false;
15883 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
15886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) {
15887 LDKChannelHandshakeConfig own_channel_config_arg_conv;
15888 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
15889 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
15890 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
15891 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
15892 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
15893 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
15894 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
15895 LDKChannelConfig channel_options_arg_conv;
15896 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
15897 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
15898 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
15899 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg);
15900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15902 uint64_t ret_ref = (uint64_t)ret_var.inner;
15903 if (ret_var.is_owned) {
15909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15910 LDKUserConfig orig_conv;
15911 orig_conv.inner = (void*)(orig & (~1));
15912 orig_conv.is_owned = false;
15913 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
15914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15916 uint64_t ret_ref = (uint64_t)ret_var.inner;
15917 if (ret_var.is_owned) {
15923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
15924 LDKUserConfig ret_var = UserConfig_default();
15925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15927 uint64_t ret_ref = (uint64_t)ret_var.inner;
15928 if (ret_var.is_owned) {
15934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15935 LDKBestBlock this_obj_conv;
15936 this_obj_conv.inner = (void*)(this_obj & (~1));
15937 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15938 BestBlock_free(this_obj_conv);
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15942 LDKBestBlock orig_conv;
15943 orig_conv.inner = (void*)(orig & (~1));
15944 orig_conv.is_owned = false;
15945 LDKBestBlock ret_var = BestBlock_clone(&orig_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_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15956 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15957 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15958 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15959 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15960 uint64_t ret_ref = (uint64_t)ret_var.inner;
15961 if (ret_var.is_owned) {
15967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15968 LDKThirtyTwoBytes block_hash_ref;
15969 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15970 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15971 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15972 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15973 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15974 uint64_t ret_ref = (uint64_t)ret_var.inner;
15975 if (ret_var.is_owned) {
15981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15982 LDKBestBlock this_arg_conv;
15983 this_arg_conv.inner = (void*)(this_arg & (~1));
15984 this_arg_conv.is_owned = false;
15985 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15986 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15990 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15991 LDKBestBlock this_arg_conv;
15992 this_arg_conv.inner = (void*)(this_arg & (~1));
15993 this_arg_conv.is_owned = false;
15994 int32_t ret_val = BestBlock_height(&this_arg_conv);
15998 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15999 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
16000 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
16004 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
16005 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
16009 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
16010 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
16014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16015 if ((this_ptr & 1) != 0) return;
16016 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
16017 FREE((void*)this_ptr);
16018 Access_free(this_ptr_conv);
16021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16022 if ((this_ptr & 1) != 0) return;
16023 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
16024 FREE((void*)this_ptr);
16025 Listen_free(this_ptr_conv);
16028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16029 if ((this_ptr & 1) != 0) return;
16030 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
16031 FREE((void*)this_ptr);
16032 Confirm_free(this_ptr_conv);
16035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16036 if ((this_ptr & 1) != 0) return;
16037 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
16038 FREE((void*)this_ptr);
16039 Watch_free(this_ptr_conv);
16042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16043 if ((this_ptr & 1) != 0) return;
16044 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
16045 FREE((void*)this_ptr);
16046 Filter_free(this_ptr_conv);
16049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16050 LDKWatchedOutput this_obj_conv;
16051 this_obj_conv.inner = (void*)(this_obj & (~1));
16052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16053 WatchedOutput_free(this_obj_conv);
16056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16057 LDKWatchedOutput this_ptr_conv;
16058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16059 this_ptr_conv.is_owned = false;
16060 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
16065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16066 LDKWatchedOutput this_ptr_conv;
16067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16068 this_ptr_conv.is_owned = false;
16069 LDKThirtyTwoBytes val_ref;
16070 CHECK((*env)->GetArrayLength(env, val) == 32);
16071 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16072 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
16075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16076 LDKWatchedOutput this_ptr_conv;
16077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16078 this_ptr_conv.is_owned = false;
16079 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
16080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16082 uint64_t ret_ref = (uint64_t)ret_var.inner;
16083 if (ret_var.is_owned) {
16089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16090 LDKWatchedOutput this_ptr_conv;
16091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16092 this_ptr_conv.is_owned = false;
16093 LDKOutPoint val_conv;
16094 val_conv.inner = (void*)(val & (~1));
16095 val_conv.is_owned = (val & 1) || (val == 0);
16096 val_conv = OutPoint_clone(&val_conv);
16097 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
16100 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16101 LDKWatchedOutput this_ptr_conv;
16102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16103 this_ptr_conv.is_owned = false;
16104 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
16105 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16106 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16111 LDKWatchedOutput this_ptr_conv;
16112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16113 this_ptr_conv.is_owned = false;
16114 LDKCVec_u8Z val_ref;
16115 val_ref.datalen = (*env)->GetArrayLength(env, val);
16116 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
16117 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
16118 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
16121 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) {
16122 LDKThirtyTwoBytes block_hash_arg_ref;
16123 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
16124 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
16125 LDKOutPoint outpoint_arg_conv;
16126 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16127 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16128 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16129 LDKCVec_u8Z script_pubkey_arg_ref;
16130 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
16131 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
16132 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
16133 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
16134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16136 uint64_t ret_ref = (uint64_t)ret_var.inner;
16137 if (ret_var.is_owned) {
16143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16144 LDKWatchedOutput orig_conv;
16145 orig_conv.inner = (void*)(orig & (~1));
16146 orig_conv.is_owned = false;
16147 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
16148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16150 uint64_t ret_ref = (uint64_t)ret_var.inner;
16151 if (ret_var.is_owned) {
16157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
16158 LDKWatchedOutput o_conv;
16159 o_conv.inner = (void*)(o & (~1));
16160 o_conv.is_owned = false;
16161 int64_t ret_val = WatchedOutput_hash(&o_conv);
16165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16166 if ((this_ptr & 1) != 0) return;
16167 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
16168 FREE((void*)this_ptr);
16169 BroadcasterInterface_free(this_ptr_conv);
16172 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16173 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
16174 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
16178 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
16179 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
16183 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
16184 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
16188 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
16189 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
16193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16194 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
16195 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
16196 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
16200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16201 if ((this_ptr & 1) != 0) return;
16202 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
16203 FREE((void*)this_ptr);
16204 FeeEstimator_free(this_ptr_conv);
16207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16208 LDKChainMonitor this_obj_conv;
16209 this_obj_conv.inner = (void*)(this_obj & (~1));
16210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16211 ChainMonitor_free(this_obj_conv);
16214 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) {
16215 LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
16216 // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
16217 if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
16218 // Manually implement clone for Java trait instances
16219 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
16220 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16221 LDKFilter_JCalls_cloned(&chain_source_conv.some);
16224 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16225 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16226 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16227 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16229 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16230 if (logger_conv.free == LDKLogger_JCalls_free) {
16231 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16232 LDKLogger_JCalls_cloned(&logger_conv);
16234 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
16235 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
16236 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16237 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
16239 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
16240 if (persister_conv.free == LDKPersist_JCalls_free) {
16241 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16242 LDKPersist_JCalls_cloned(&persister_conv);
16244 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
16245 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16246 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16247 uint64_t ret_ref = (uint64_t)ret_var.inner;
16248 if (ret_var.is_owned) {
16254 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
16255 LDKChainMonitor this_arg_conv;
16256 this_arg_conv.inner = (void*)(this_arg & (~1));
16257 this_arg_conv.is_owned = false;
16258 LDKCVec_ChannelDetailsZ ignored_channels_constr;
16259 ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
16260 if (ignored_channels_constr.datalen > 0)
16261 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16263 ignored_channels_constr.data = NULL;
16264 int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
16265 for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
16266 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
16267 LDKChannelDetails ignored_channels_conv_16_conv;
16268 ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
16269 ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
16270 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
16271 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
16273 (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
16274 LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
16275 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16276 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16277 for (size_t j = 0; j < ret_var.datalen; j++) {
16278 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16279 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
16280 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16281 ret_arr_ptr[j] = ret_conv_9_ref;
16283 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16284 FREE(ret_var.data);
16288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16289 LDKChainMonitor this_arg_conv;
16290 this_arg_conv.inner = (void*)(this_arg & (~1));
16291 this_arg_conv.is_owned = false;
16292 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
16293 *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
16294 return (uint64_t)ret_ret;
16297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16298 LDKChainMonitor this_arg_conv;
16299 this_arg_conv.inner = (void*)(this_arg & (~1));
16300 this_arg_conv.is_owned = false;
16301 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16302 *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
16303 return (uint64_t)ret_ret;
16306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16307 LDKChainMonitor this_arg_conv;
16308 this_arg_conv.inner = (void*)(this_arg & (~1));
16309 this_arg_conv.is_owned = false;
16310 LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
16311 *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
16312 return (uint64_t)ret_ret;
16315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16316 LDKChainMonitor this_arg_conv;
16317 this_arg_conv.inner = (void*)(this_arg & (~1));
16318 this_arg_conv.is_owned = false;
16319 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16320 *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
16321 return (uint64_t)ret_ret;
16324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16325 LDKChannelMonitorUpdate this_obj_conv;
16326 this_obj_conv.inner = (void*)(this_obj & (~1));
16327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16328 ChannelMonitorUpdate_free(this_obj_conv);
16331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16332 LDKChannelMonitorUpdate this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
16339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16340 LDKChannelMonitorUpdate this_ptr_conv;
16341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16342 this_ptr_conv.is_owned = false;
16343 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
16346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16347 LDKChannelMonitorUpdate orig_conv;
16348 orig_conv.inner = (void*)(orig & (~1));
16349 orig_conv.is_owned = false;
16350 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
16351 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16352 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16353 uint64_t ret_ref = (uint64_t)ret_var.inner;
16354 if (ret_var.is_owned) {
16360 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16361 LDKChannelMonitorUpdate obj_conv;
16362 obj_conv.inner = (void*)(obj & (~1));
16363 obj_conv.is_owned = false;
16364 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
16365 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16366 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16367 CVec_u8Z_free(ret_var);
16371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16372 LDKu8slice ser_ref;
16373 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16374 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16375 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
16376 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
16377 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16378 return (uint64_t)ret_conv;
16381 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16382 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
16383 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
16387 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
16388 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
16392 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
16393 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
16397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16398 LDKMonitorUpdateError this_obj_conv;
16399 this_obj_conv.inner = (void*)(this_obj & (~1));
16400 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16401 MonitorUpdateError_free(this_obj_conv);
16404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16405 LDKMonitorUpdateError orig_conv;
16406 orig_conv.inner = (void*)(orig & (~1));
16407 orig_conv.is_owned = false;
16408 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
16409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16411 uint64_t ret_ref = (uint64_t)ret_var.inner;
16412 if (ret_var.is_owned) {
16418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16419 if ((this_ptr & 1) != 0) return;
16420 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
16421 FREE((void*)this_ptr);
16422 MonitorEvent_free(this_ptr_conv);
16425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16426 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
16427 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16428 *ret_copy = MonitorEvent_clone(orig_conv);
16429 uint64_t ret_ref = (uint64_t)ret_copy;
16433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
16434 LDKHTLCUpdate a_conv;
16435 a_conv.inner = (void*)(a & (~1));
16436 a_conv.is_owned = (a & 1) || (a == 0);
16437 a_conv = HTLCUpdate_clone(&a_conv);
16438 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16439 *ret_copy = MonitorEvent_htlcevent(a_conv);
16440 uint64_t ret_ref = (uint64_t)ret_copy;
16444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
16445 LDKOutPoint a_conv;
16446 a_conv.inner = (void*)(a & (~1));
16447 a_conv.is_owned = (a & 1) || (a == 0);
16448 a_conv = OutPoint_clone(&a_conv);
16449 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16450 *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
16451 uint64_t ret_ref = (uint64_t)ret_copy;
16455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16456 LDKHTLCUpdate this_obj_conv;
16457 this_obj_conv.inner = (void*)(this_obj & (~1));
16458 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16459 HTLCUpdate_free(this_obj_conv);
16462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16463 LDKHTLCUpdate orig_conv;
16464 orig_conv.inner = (void*)(orig & (~1));
16465 orig_conv.is_owned = false;
16466 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
16467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16469 uint64_t ret_ref = (uint64_t)ret_var.inner;
16470 if (ret_var.is_owned) {
16476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
16477 LDKHTLCUpdate obj_conv;
16478 obj_conv.inner = (void*)(obj & (~1));
16479 obj_conv.is_owned = false;
16480 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
16481 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16482 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16483 CVec_u8Z_free(ret_var);
16487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16488 LDKu8slice ser_ref;
16489 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16490 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16491 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
16492 *ret_conv = HTLCUpdate_read(ser_ref);
16493 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16494 return (uint64_t)ret_conv;
16497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16498 if ((this_ptr & 1) != 0) return;
16499 LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
16500 FREE((void*)this_ptr);
16501 Balance_free(this_ptr_conv);
16504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16505 LDKBalance* orig_conv = (LDKBalance*)orig;
16506 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16507 *ret_copy = Balance_clone(orig_conv);
16508 uint64_t ret_ref = (uint64_t)ret_copy;
16512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
16513 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16514 *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
16515 uint64_t ret_ref = (uint64_t)ret_copy;
16519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
16520 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16521 *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
16522 uint64_t ret_ref = (uint64_t)ret_copy;
16526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
16527 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16528 *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
16529 uint64_t ret_ref = (uint64_t)ret_copy;
16533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
16534 LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16535 *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
16536 uint64_t ret_ref = (uint64_t)ret_copy;
16540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
16541 LDKBalance* a_conv = (LDKBalance*)a;
16542 LDKBalance* b_conv = (LDKBalance*)b;
16543 jboolean ret_val = Balance_eq(a_conv, b_conv);
16547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16548 LDKChannelMonitor this_obj_conv;
16549 this_obj_conv.inner = (void*)(this_obj & (~1));
16550 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16551 ChannelMonitor_free(this_obj_conv);
16554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16555 LDKChannelMonitor orig_conv;
16556 orig_conv.inner = (void*)(orig & (~1));
16557 orig_conv.is_owned = false;
16558 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
16559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16561 uint64_t ret_ref = (uint64_t)ret_var.inner;
16562 if (ret_var.is_owned) {
16568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16569 LDKChannelMonitor obj_conv;
16570 obj_conv.inner = (void*)(obj & (~1));
16571 obj_conv.is_owned = false;
16572 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
16573 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16574 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16575 CVec_u8Z_free(ret_var);
16579 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) {
16580 LDKChannelMonitor this_arg_conv;
16581 this_arg_conv.inner = (void*)(this_arg & (~1));
16582 this_arg_conv.is_owned = false;
16583 LDKChannelMonitorUpdate updates_conv;
16584 updates_conv.inner = (void*)(updates & (~1));
16585 updates_conv.is_owned = false;
16586 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16587 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16588 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16589 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
16590 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
16591 return (uint64_t)ret_conv;
16594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16595 LDKChannelMonitor this_arg_conv;
16596 this_arg_conv.inner = (void*)(this_arg & (~1));
16597 this_arg_conv.is_owned = false;
16598 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
16602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
16603 LDKChannelMonitor this_arg_conv;
16604 this_arg_conv.inner = (void*)(this_arg & (~1));
16605 this_arg_conv.is_owned = false;
16606 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
16607 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
16608 return (uint64_t)ret_ref;
16611 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
16612 LDKChannelMonitor this_arg_conv;
16613 this_arg_conv.inner = (void*)(this_arg & (~1));
16614 this_arg_conv.is_owned = false;
16615 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
16616 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16617 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16618 for (size_t v = 0; v < ret_var.datalen; v++) {
16619 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
16620 *ret_conv_47_ref = ret_var.data[v];
16621 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
16623 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16624 FREE(ret_var.data);
16628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
16629 LDKChannelMonitor this_arg_conv;
16630 this_arg_conv.inner = (void*)(this_arg & (~1));
16631 this_arg_conv.is_owned = false;
16632 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
16633 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
16636 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16637 LDKChannelMonitor this_arg_conv;
16638 this_arg_conv.inner = (void*)(this_arg & (~1));
16639 this_arg_conv.is_owned = false;
16640 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
16641 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16642 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16643 for (size_t o = 0; o < ret_var.datalen; o++) {
16644 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
16645 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
16646 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
16647 ret_arr_ptr[o] = ret_conv_14_ref;
16649 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16650 FREE(ret_var.data);
16654 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
16655 LDKChannelMonitor this_arg_conv;
16656 this_arg_conv.inner = (void*)(this_arg & (~1));
16657 this_arg_conv.is_owned = false;
16658 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
16659 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16660 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16661 for (size_t h = 0; h < ret_var.datalen; h++) {
16662 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
16663 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
16664 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
16665 ret_arr_ptr[h] = ret_conv_7_ref;
16667 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16668 FREE(ret_var.data);
16672 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) {
16673 LDKChannelMonitor this_arg_conv;
16674 this_arg_conv.inner = (void*)(this_arg & (~1));
16675 this_arg_conv.is_owned = false;
16676 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
16677 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
16678 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16680 for (size_t i = 0; i < ret_var.datalen; i++) {
16681 LDKTransaction ret_conv_8_var = ret_var.data[i];
16682 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
16683 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
16684 Transaction_free(ret_conv_8_var);
16685 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16687 FREE(ret_var.data);
16691 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) {
16692 LDKChannelMonitor this_arg_conv;
16693 this_arg_conv.inner = (void*)(this_arg & (~1));
16694 this_arg_conv.is_owned = false;
16695 unsigned char header_arr[80];
16696 CHECK((*env)->GetArrayLength(env, header) == 80);
16697 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16698 unsigned char (*header_ref)[80] = &header_arr;
16699 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16700 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16701 if (txdata_constr.datalen > 0)
16702 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16704 txdata_constr.data = NULL;
16705 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16706 for (size_t y = 0; y < txdata_constr.datalen; y++) {
16707 int64_t txdata_conv_24 = txdata_vals[y];
16708 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
16709 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
16710 txdata_constr.data[y] = txdata_conv_24_conv;
16712 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16713 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16714 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16715 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16716 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16718 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16719 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16720 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16721 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16723 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16724 if (logger_conv.free == LDKLogger_JCalls_free) {
16725 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16726 LDKLogger_JCalls_cloned(&logger_conv);
16728 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);
16729 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16730 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16731 for (size_t u = 0; u < ret_var.datalen; u++) {
16732 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16733 *ret_conv_46_ref = ret_var.data[u];
16734 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16736 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16737 FREE(ret_var.data);
16741 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) {
16742 LDKChannelMonitor this_arg_conv;
16743 this_arg_conv.inner = (void*)(this_arg & (~1));
16744 this_arg_conv.is_owned = false;
16745 unsigned char header_arr[80];
16746 CHECK((*env)->GetArrayLength(env, header) == 80);
16747 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16748 unsigned char (*header_ref)[80] = &header_arr;
16749 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16750 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16751 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16752 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16754 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16755 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16756 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16757 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16759 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16760 if (logger_conv.free == LDKLogger_JCalls_free) {
16761 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16762 LDKLogger_JCalls_cloned(&logger_conv);
16764 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16767 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) {
16768 LDKChannelMonitor this_arg_conv;
16769 this_arg_conv.inner = (void*)(this_arg & (~1));
16770 this_arg_conv.is_owned = false;
16771 unsigned char header_arr[80];
16772 CHECK((*env)->GetArrayLength(env, header) == 80);
16773 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16774 unsigned char (*header_ref)[80] = &header_arr;
16775 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
16776 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
16777 if (txdata_constr.datalen > 0)
16778 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
16780 txdata_constr.data = NULL;
16781 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
16782 for (size_t y = 0; y < txdata_constr.datalen; y++) {
16783 int64_t txdata_conv_24 = txdata_vals[y];
16784 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
16785 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
16786 txdata_constr.data[y] = txdata_conv_24_conv;
16788 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
16789 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16790 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16791 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16792 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16794 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16795 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16796 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16797 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16799 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16800 if (logger_conv.free == LDKLogger_JCalls_free) {
16801 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16802 LDKLogger_JCalls_cloned(&logger_conv);
16804 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);
16805 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16806 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16807 for (size_t u = 0; u < ret_var.datalen; u++) {
16808 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16809 *ret_conv_46_ref = ret_var.data[u];
16810 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16812 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16813 FREE(ret_var.data);
16817 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) {
16818 LDKChannelMonitor this_arg_conv;
16819 this_arg_conv.inner = (void*)(this_arg & (~1));
16820 this_arg_conv.is_owned = false;
16821 unsigned char txid_arr[32];
16822 CHECK((*env)->GetArrayLength(env, txid) == 32);
16823 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
16824 unsigned char (*txid_ref)[32] = &txid_arr;
16825 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16826 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16828 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16830 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16831 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16832 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16833 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16835 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16836 if (logger_conv.free == LDKLogger_JCalls_free) {
16837 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16838 LDKLogger_JCalls_cloned(&logger_conv);
16840 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
16843 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) {
16844 LDKChannelMonitor this_arg_conv;
16845 this_arg_conv.inner = (void*)(this_arg & (~1));
16846 this_arg_conv.is_owned = false;
16847 unsigned char header_arr[80];
16848 CHECK((*env)->GetArrayLength(env, header) == 80);
16849 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
16850 unsigned char (*header_ref)[80] = &header_arr;
16851 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
16852 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16853 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16854 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
16856 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16857 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16858 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16859 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16861 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16862 if (logger_conv.free == LDKLogger_JCalls_free) {
16863 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16864 LDKLogger_JCalls_cloned(&logger_conv);
16866 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
16867 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16868 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16869 for (size_t u = 0; u < ret_var.datalen; u++) {
16870 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
16871 *ret_conv_46_ref = ret_var.data[u];
16872 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
16874 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16875 FREE(ret_var.data);
16879 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
16880 LDKChannelMonitor this_arg_conv;
16881 this_arg_conv.inner = (void*)(this_arg & (~1));
16882 this_arg_conv.is_owned = false;
16883 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
16884 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
16886 for (size_t i = 0; i < ret_var.datalen; i++) {
16887 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
16888 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
16889 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
16891 FREE(ret_var.data);
16895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
16896 LDKChannelMonitor this_arg_conv;
16897 this_arg_conv.inner = (void*)(this_arg & (~1));
16898 this_arg_conv.is_owned = false;
16899 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
16900 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16901 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16902 uint64_t ret_ref = (uint64_t)ret_var.inner;
16903 if (ret_var.is_owned) {
16909 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
16910 LDKChannelMonitor this_arg_conv;
16911 this_arg_conv.inner = (void*)(this_arg & (~1));
16912 this_arg_conv.is_owned = false;
16913 LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
16914 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16915 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16916 for (size_t j = 0; j < ret_var.datalen; j++) {
16917 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
16918 *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
16919 uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
16920 ret_arr_ptr[j] = ret_conv_9_ref;
16922 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16923 FREE(ret_var.data);
16927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16928 if ((this_ptr & 1) != 0) return;
16929 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
16930 FREE((void*)this_ptr);
16931 Persist_free(this_ptr_conv);
16934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16935 LDKu8slice ser_ref;
16936 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16937 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16938 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
16939 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
16940 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
16941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16942 return (uint64_t)ret_conv;
16945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16946 LDKOutPoint this_obj_conv;
16947 this_obj_conv.inner = (void*)(this_obj & (~1));
16948 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16949 OutPoint_free(this_obj_conv);
16952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
16953 LDKOutPoint this_ptr_conv;
16954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16955 this_ptr_conv.is_owned = false;
16956 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
16961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16962 LDKOutPoint this_ptr_conv;
16963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16964 this_ptr_conv.is_owned = false;
16965 LDKThirtyTwoBytes val_ref;
16966 CHECK((*env)->GetArrayLength(env, val) == 32);
16967 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16968 OutPoint_set_txid(&this_ptr_conv, val_ref);
16971 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
16972 LDKOutPoint this_ptr_conv;
16973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16974 this_ptr_conv.is_owned = false;
16975 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
16979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16980 LDKOutPoint this_ptr_conv;
16981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16982 this_ptr_conv.is_owned = false;
16983 OutPoint_set_index(&this_ptr_conv, val);
16986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
16987 LDKThirtyTwoBytes txid_arg_ref;
16988 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
16989 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
16990 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
16991 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16992 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16993 uint64_t ret_ref = (uint64_t)ret_var.inner;
16994 if (ret_var.is_owned) {
17000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17001 LDKOutPoint orig_conv;
17002 orig_conv.inner = (void*)(orig & (~1));
17003 orig_conv.is_owned = false;
17004 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
17005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17007 uint64_t ret_ref = (uint64_t)ret_var.inner;
17008 if (ret_var.is_owned) {
17014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
17015 LDKOutPoint a_conv;
17016 a_conv.inner = (void*)(a & (~1));
17017 a_conv.is_owned = false;
17018 LDKOutPoint b_conv;
17019 b_conv.inner = (void*)(b & (~1));
17020 b_conv.is_owned = false;
17021 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
17025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
17026 LDKOutPoint o_conv;
17027 o_conv.inner = (void*)(o & (~1));
17028 o_conv.is_owned = false;
17029 int64_t ret_val = OutPoint_hash(&o_conv);
17033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17034 LDKOutPoint this_arg_conv;
17035 this_arg_conv.inner = (void*)(this_arg & (~1));
17036 this_arg_conv.is_owned = false;
17037 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17038 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
17042 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
17043 LDKOutPoint obj_conv;
17044 obj_conv.inner = (void*)(obj & (~1));
17045 obj_conv.is_owned = false;
17046 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
17047 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17048 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17049 CVec_u8Z_free(ret_var);
17053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17054 LDKu8slice ser_ref;
17055 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17056 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17057 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17058 *ret_conv = OutPoint_read(ser_ref);
17059 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17060 return (uint64_t)ret_conv;
17063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17064 LDKDelayedPaymentOutputDescriptor this_obj_conv;
17065 this_obj_conv.inner = (void*)(this_obj & (~1));
17066 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17067 DelayedPaymentOutputDescriptor_free(this_obj_conv);
17070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17071 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17073 this_ptr_conv.is_owned = false;
17074 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17077 uint64_t ret_ref = (uint64_t)ret_var.inner;
17078 if (ret_var.is_owned) {
17084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17085 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17087 this_ptr_conv.is_owned = false;
17088 LDKOutPoint val_conv;
17089 val_conv.inner = (void*)(val & (~1));
17090 val_conv.is_owned = (val & 1) || (val == 0);
17091 val_conv = OutPoint_clone(&val_conv);
17092 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17096 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17098 this_ptr_conv.is_owned = false;
17099 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17100 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
17104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17105 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17107 this_ptr_conv.is_owned = false;
17108 LDKPublicKey val_ref;
17109 CHECK((*env)->GetArrayLength(env, val) == 33);
17110 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17111 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
17114 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17115 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17117 this_ptr_conv.is_owned = false;
17118 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
17122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17123 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17125 this_ptr_conv.is_owned = false;
17126 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
17129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17130 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17132 this_ptr_conv.is_owned = false;
17133 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17134 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17135 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17139 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17141 this_ptr_conv.is_owned = false;
17142 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17143 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
17147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17148 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17150 this_ptr_conv.is_owned = false;
17151 LDKPublicKey val_ref;
17152 CHECK((*env)->GetArrayLength(env, val) == 33);
17153 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17154 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
17157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17158 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17160 this_ptr_conv.is_owned = false;
17161 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17162 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17167 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17169 this_ptr_conv.is_owned = false;
17170 LDKThirtyTwoBytes val_ref;
17171 CHECK((*env)->GetArrayLength(env, val) == 32);
17172 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17173 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17177 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17179 this_ptr_conv.is_owned = false;
17180 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17185 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
17186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17187 this_ptr_conv.is_owned = false;
17188 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17191 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) {
17192 LDKOutPoint outpoint_arg_conv;
17193 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17194 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17195 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17196 LDKPublicKey per_commitment_point_arg_ref;
17197 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
17198 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
17199 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17200 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17201 LDKPublicKey revocation_pubkey_arg_ref;
17202 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
17203 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
17204 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17205 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17206 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17207 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);
17208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17210 uint64_t ret_ref = (uint64_t)ret_var.inner;
17211 if (ret_var.is_owned) {
17217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17218 LDKDelayedPaymentOutputDescriptor orig_conv;
17219 orig_conv.inner = (void*)(orig & (~1));
17220 orig_conv.is_owned = false;
17221 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
17222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17224 uint64_t ret_ref = (uint64_t)ret_var.inner;
17225 if (ret_var.is_owned) {
17231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17232 LDKDelayedPaymentOutputDescriptor obj_conv;
17233 obj_conv.inner = (void*)(obj & (~1));
17234 obj_conv.is_owned = false;
17235 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
17236 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17237 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17238 CVec_u8Z_free(ret_var);
17242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17243 LDKu8slice ser_ref;
17244 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17245 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17246 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
17247 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
17248 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17249 return (uint64_t)ret_conv;
17252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17253 LDKStaticPaymentOutputDescriptor this_obj_conv;
17254 this_obj_conv.inner = (void*)(this_obj & (~1));
17255 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17256 StaticPaymentOutputDescriptor_free(this_obj_conv);
17259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17260 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17262 this_ptr_conv.is_owned = false;
17263 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
17264 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17265 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17266 uint64_t ret_ref = (uint64_t)ret_var.inner;
17267 if (ret_var.is_owned) {
17273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17274 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17276 this_ptr_conv.is_owned = false;
17277 LDKOutPoint val_conv;
17278 val_conv.inner = (void*)(val & (~1));
17279 val_conv.is_owned = (val & 1) || (val == 0);
17280 val_conv = OutPoint_clone(&val_conv);
17281 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
17284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17285 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17287 this_ptr_conv.is_owned = false;
17288 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
17289 val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
17290 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
17293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17294 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17296 this_ptr_conv.is_owned = false;
17297 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17298 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
17302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17303 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17305 this_ptr_conv.is_owned = false;
17306 LDKThirtyTwoBytes val_ref;
17307 CHECK((*env)->GetArrayLength(env, val) == 32);
17308 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17309 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
17312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17313 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17315 this_ptr_conv.is_owned = false;
17316 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
17320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17321 LDKStaticPaymentOutputDescriptor this_ptr_conv;
17322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17323 this_ptr_conv.is_owned = false;
17324 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
17327 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) {
17328 LDKOutPoint outpoint_arg_conv;
17329 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
17330 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
17331 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
17332 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
17333 output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
17334 LDKThirtyTwoBytes channel_keys_id_arg_ref;
17335 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
17336 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
17337 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
17338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17340 uint64_t ret_ref = (uint64_t)ret_var.inner;
17341 if (ret_var.is_owned) {
17347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17348 LDKStaticPaymentOutputDescriptor orig_conv;
17349 orig_conv.inner = (void*)(orig & (~1));
17350 orig_conv.is_owned = false;
17351 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
17352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17354 uint64_t ret_ref = (uint64_t)ret_var.inner;
17355 if (ret_var.is_owned) {
17361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17362 LDKStaticPaymentOutputDescriptor obj_conv;
17363 obj_conv.inner = (void*)(obj & (~1));
17364 obj_conv.is_owned = false;
17365 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
17366 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17367 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17368 CVec_u8Z_free(ret_var);
17372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17373 LDKu8slice ser_ref;
17374 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17375 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17376 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
17377 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
17378 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17379 return (uint64_t)ret_conv;
17382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17383 if ((this_ptr & 1) != 0) return;
17384 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
17385 FREE((void*)this_ptr);
17386 SpendableOutputDescriptor_free(this_ptr_conv);
17389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17390 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
17391 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17392 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
17393 uint64_t ret_ref = (uint64_t)ret_copy;
17397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
17398 LDKOutPoint outpoint_conv;
17399 outpoint_conv.inner = (void*)(outpoint & (~1));
17400 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
17401 outpoint_conv = OutPoint_clone(&outpoint_conv);
17402 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
17403 output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
17404 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17405 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
17406 uint64_t ret_ref = (uint64_t)ret_copy;
17410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17411 LDKDelayedPaymentOutputDescriptor a_conv;
17412 a_conv.inner = (void*)(a & (~1));
17413 a_conv.is_owned = (a & 1) || (a == 0);
17414 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
17415 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17416 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
17417 uint64_t ret_ref = (uint64_t)ret_copy;
17421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
17422 LDKStaticPaymentOutputDescriptor a_conv;
17423 a_conv.inner = (void*)(a & (~1));
17424 a_conv.is_owned = (a & 1) || (a == 0);
17425 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
17426 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17427 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
17428 uint64_t ret_ref = (uint64_t)ret_copy;
17432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
17433 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
17434 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
17435 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17436 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17437 CVec_u8Z_free(ret_var);
17441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17442 LDKu8slice ser_ref;
17443 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17444 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17445 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
17446 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
17447 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17448 return (uint64_t)ret_conv;
17451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17452 if ((this_ptr & 1) != 0) return;
17453 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
17454 FREE((void*)this_ptr);
17455 BaseSign_free(this_ptr_conv);
17458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17459 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
17460 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17461 *ret_ret = Sign_clone(orig_conv);
17462 return (uint64_t)ret_ret;
17465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17466 if ((this_ptr & 1) != 0) return;
17467 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
17468 FREE((void*)this_ptr);
17469 Sign_free(this_ptr_conv);
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17473 if ((this_ptr & 1) != 0) return;
17474 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
17475 FREE((void*)this_ptr);
17476 KeysInterface_free(this_ptr_conv);
17479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17480 LDKInMemorySigner this_obj_conv;
17481 this_obj_conv.inner = (void*)(this_obj & (~1));
17482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17483 InMemorySigner_free(this_obj_conv);
17486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17487 LDKInMemorySigner this_ptr_conv;
17488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17489 this_ptr_conv.is_owned = false;
17490 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
17495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17496 LDKInMemorySigner this_ptr_conv;
17497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17498 this_ptr_conv.is_owned = false;
17499 LDKSecretKey val_ref;
17500 CHECK((*env)->GetArrayLength(env, val) == 32);
17501 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17502 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
17505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17506 LDKInMemorySigner this_ptr_conv;
17507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17508 this_ptr_conv.is_owned = false;
17509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
17514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17515 LDKInMemorySigner this_ptr_conv;
17516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17517 this_ptr_conv.is_owned = false;
17518 LDKSecretKey val_ref;
17519 CHECK((*env)->GetArrayLength(env, val) == 32);
17520 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17521 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
17524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17525 LDKInMemorySigner this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = false;
17528 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
17533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17534 LDKInMemorySigner this_ptr_conv;
17535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17536 this_ptr_conv.is_owned = false;
17537 LDKSecretKey val_ref;
17538 CHECK((*env)->GetArrayLength(env, val) == 32);
17539 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17540 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
17543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17544 LDKInMemorySigner this_ptr_conv;
17545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17546 this_ptr_conv.is_owned = false;
17547 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
17552 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) {
17553 LDKInMemorySigner this_ptr_conv;
17554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17555 this_ptr_conv.is_owned = false;
17556 LDKSecretKey val_ref;
17557 CHECK((*env)->GetArrayLength(env, val) == 32);
17558 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17559 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
17562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
17563 LDKInMemorySigner this_ptr_conv;
17564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17565 this_ptr_conv.is_owned = false;
17566 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17567 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
17571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17572 LDKInMemorySigner this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 LDKSecretKey val_ref;
17576 CHECK((*env)->GetArrayLength(env, val) == 32);
17577 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
17578 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
17581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
17582 LDKInMemorySigner this_ptr_conv;
17583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17584 this_ptr_conv.is_owned = false;
17585 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17586 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
17590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17591 LDKInMemorySigner this_ptr_conv;
17592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17593 this_ptr_conv.is_owned = false;
17594 LDKThirtyTwoBytes val_ref;
17595 CHECK((*env)->GetArrayLength(env, val) == 32);
17596 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17597 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
17600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17601 LDKInMemorySigner orig_conv;
17602 orig_conv.inner = (void*)(orig & (~1));
17603 orig_conv.is_owned = false;
17604 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
17605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17607 uint64_t ret_ref = (uint64_t)ret_var.inner;
17608 if (ret_var.is_owned) {
17614 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) {
17615 LDKSecretKey funding_key_ref;
17616 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
17617 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
17618 LDKSecretKey revocation_base_key_ref;
17619 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
17620 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
17621 LDKSecretKey payment_key_ref;
17622 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
17623 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
17624 LDKSecretKey delayed_payment_base_key_ref;
17625 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
17626 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
17627 LDKSecretKey htlc_base_key_ref;
17628 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
17629 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
17630 LDKThirtyTwoBytes commitment_seed_ref;
17631 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
17632 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
17633 LDKThirtyTwoBytes channel_keys_id_ref;
17634 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
17635 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
17636 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);
17637 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17638 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17639 uint64_t ret_ref = (uint64_t)ret_var.inner;
17640 if (ret_var.is_owned) {
17646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
17647 LDKInMemorySigner this_arg_conv;
17648 this_arg_conv.inner = (void*)(this_arg & (~1));
17649 this_arg_conv.is_owned = false;
17650 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
17651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17653 uint64_t ret_ref = (uint64_t)ret_var.inner;
17654 if (ret_var.is_owned) {
17660 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17661 LDKInMemorySigner this_arg_conv;
17662 this_arg_conv.inner = (void*)(this_arg & (~1));
17663 this_arg_conv.is_owned = false;
17664 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
17668 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
17669 LDKInMemorySigner this_arg_conv;
17670 this_arg_conv.inner = (void*)(this_arg & (~1));
17671 this_arg_conv.is_owned = false;
17672 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
17676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
17677 LDKInMemorySigner this_arg_conv;
17678 this_arg_conv.inner = (void*)(this_arg & (~1));
17679 this_arg_conv.is_owned = false;
17680 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
17684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
17685 LDKInMemorySigner this_arg_conv;
17686 this_arg_conv.inner = (void*)(this_arg & (~1));
17687 this_arg_conv.is_owned = false;
17688 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
17689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17691 uint64_t ret_ref = (uint64_t)ret_var.inner;
17692 if (ret_var.is_owned) {
17698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
17699 LDKInMemorySigner this_arg_conv;
17700 this_arg_conv.inner = (void*)(this_arg & (~1));
17701 this_arg_conv.is_owned = false;
17702 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
17703 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17704 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17705 uint64_t ret_ref = (uint64_t)ret_var.inner;
17706 if (ret_var.is_owned) {
17712 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) {
17713 LDKInMemorySigner this_arg_conv;
17714 this_arg_conv.inner = (void*)(this_arg & (~1));
17715 this_arg_conv.is_owned = false;
17716 LDKTransaction spend_tx_ref;
17717 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17718 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17719 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17720 spend_tx_ref.data_is_owned = true;
17721 LDKStaticPaymentOutputDescriptor descriptor_conv;
17722 descriptor_conv.inner = (void*)(descriptor & (~1));
17723 descriptor_conv.is_owned = false;
17724 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17725 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17726 return (uint64_t)ret_conv;
17729 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) {
17730 LDKInMemorySigner this_arg_conv;
17731 this_arg_conv.inner = (void*)(this_arg & (~1));
17732 this_arg_conv.is_owned = false;
17733 LDKTransaction spend_tx_ref;
17734 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
17735 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
17736 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
17737 spend_tx_ref.data_is_owned = true;
17738 LDKDelayedPaymentOutputDescriptor descriptor_conv;
17739 descriptor_conv.inner = (void*)(descriptor & (~1));
17740 descriptor_conv.is_owned = false;
17741 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
17742 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
17743 return (uint64_t)ret_conv;
17746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
17747 LDKInMemorySigner this_arg_conv;
17748 this_arg_conv.inner = (void*)(this_arg & (~1));
17749 this_arg_conv.is_owned = false;
17750 LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
17751 *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
17752 return (uint64_t)ret_ret;
17755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
17756 LDKInMemorySigner this_arg_conv;
17757 this_arg_conv.inner = (void*)(this_arg & (~1));
17758 this_arg_conv.is_owned = false;
17759 LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
17760 *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
17761 return (uint64_t)ret_ret;
17764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
17765 LDKInMemorySigner obj_conv;
17766 obj_conv.inner = (void*)(obj & (~1));
17767 obj_conv.is_owned = false;
17768 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
17769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17771 CVec_u8Z_free(ret_var);
17775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17776 LDKu8slice ser_ref;
17777 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17778 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17779 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
17780 *ret_conv = InMemorySigner_read(ser_ref);
17781 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17782 return (uint64_t)ret_conv;
17785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17786 LDKKeysManager this_obj_conv;
17787 this_obj_conv.inner = (void*)(this_obj & (~1));
17788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17789 KeysManager_free(this_obj_conv);
17792 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) {
17793 unsigned char seed_arr[32];
17794 CHECK((*env)->GetArrayLength(env, seed) == 32);
17795 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
17796 unsigned char (*seed_ref)[32] = &seed_arr;
17797 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
17798 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17799 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17800 uint64_t ret_ref = (uint64_t)ret_var.inner;
17801 if (ret_var.is_owned) {
17807 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) {
17808 LDKKeysManager this_arg_conv;
17809 this_arg_conv.inner = (void*)(this_arg & (~1));
17810 this_arg_conv.is_owned = false;
17811 unsigned char params_arr[32];
17812 CHECK((*env)->GetArrayLength(env, params) == 32);
17813 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
17814 unsigned char (*params_ref)[32] = ¶ms_arr;
17815 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
17816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17818 uint64_t ret_ref = (uint64_t)ret_var.inner;
17819 if (ret_var.is_owned) {
17825 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) {
17826 LDKKeysManager this_arg_conv;
17827 this_arg_conv.inner = (void*)(this_arg & (~1));
17828 this_arg_conv.is_owned = false;
17829 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17830 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
17831 if (descriptors_constr.datalen > 0)
17832 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17834 descriptors_constr.data = NULL;
17835 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
17836 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17837 int64_t descriptors_conv_27 = descriptors_vals[b];
17838 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
17839 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
17840 descriptors_constr.data[b] = descriptors_conv_27_conv;
17842 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
17843 LDKCVec_TxOutZ outputs_constr;
17844 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17845 if (outputs_constr.datalen > 0)
17846 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17848 outputs_constr.data = NULL;
17849 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17850 for (size_t h = 0; h < outputs_constr.datalen; h++) {
17851 int64_t outputs_conv_7 = outputs_vals[h];
17852 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
17853 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
17854 outputs_constr.data[h] = outputs_conv_7_conv;
17856 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17857 LDKCVec_u8Z change_destination_script_ref;
17858 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
17859 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17860 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
17861 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17862 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
17863 return (uint64_t)ret_conv;
17866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
17867 LDKKeysManager this_arg_conv;
17868 this_arg_conv.inner = (void*)(this_arg & (~1));
17869 this_arg_conv.is_owned = false;
17870 LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
17871 *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
17872 return (uint64_t)ret_ret;
17875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17876 LDKChannelManager this_obj_conv;
17877 this_obj_conv.inner = (void*)(this_obj & (~1));
17878 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17879 ChannelManager_free(this_obj_conv);
17882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17883 LDKChainParameters this_obj_conv;
17884 this_obj_conv.inner = (void*)(this_obj & (~1));
17885 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17886 ChainParameters_free(this_obj_conv);
17889 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
17890 LDKChainParameters this_ptr_conv;
17891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17892 this_ptr_conv.is_owned = false;
17893 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
17897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
17898 LDKChainParameters this_ptr_conv;
17899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17900 this_ptr_conv.is_owned = false;
17901 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
17902 ChainParameters_set_network(&this_ptr_conv, val_conv);
17905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
17906 LDKChainParameters this_ptr_conv;
17907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17908 this_ptr_conv.is_owned = false;
17909 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
17910 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17911 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17912 uint64_t ret_ref = (uint64_t)ret_var.inner;
17913 if (ret_var.is_owned) {
17919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17920 LDKChainParameters this_ptr_conv;
17921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17922 this_ptr_conv.is_owned = false;
17923 LDKBestBlock val_conv;
17924 val_conv.inner = (void*)(val & (~1));
17925 val_conv.is_owned = (val & 1) || (val == 0);
17926 val_conv = BestBlock_clone(&val_conv);
17927 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
17930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
17931 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
17932 LDKBestBlock best_block_arg_conv;
17933 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
17934 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
17935 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
17936 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
17937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17939 uint64_t ret_ref = (uint64_t)ret_var.inner;
17940 if (ret_var.is_owned) {
17946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17947 LDKChainParameters orig_conv;
17948 orig_conv.inner = (void*)(orig & (~1));
17949 orig_conv.is_owned = false;
17950 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
17951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17953 uint64_t ret_ref = (uint64_t)ret_var.inner;
17954 if (ret_var.is_owned) {
17960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17961 LDKCounterpartyForwardingInfo this_obj_conv;
17962 this_obj_conv.inner = (void*)(this_obj & (~1));
17963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17964 CounterpartyForwardingInfo_free(this_obj_conv);
17967 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17968 LDKCounterpartyForwardingInfo this_ptr_conv;
17969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17970 this_ptr_conv.is_owned = false;
17971 int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
17975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17976 LDKCounterpartyForwardingInfo this_ptr_conv;
17977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17978 this_ptr_conv.is_owned = false;
17979 CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
17982 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
17983 LDKCounterpartyForwardingInfo this_ptr_conv;
17984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17985 this_ptr_conv.is_owned = false;
17986 int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
17990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17991 LDKCounterpartyForwardingInfo this_ptr_conv;
17992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17993 this_ptr_conv.is_owned = false;
17994 CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
17997 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
17998 LDKCounterpartyForwardingInfo this_ptr_conv;
17999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18000 this_ptr_conv.is_owned = false;
18001 int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
18005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18006 LDKCounterpartyForwardingInfo this_ptr_conv;
18007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18008 this_ptr_conv.is_owned = false;
18009 CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
18012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
18013 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
18014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18016 uint64_t ret_ref = (uint64_t)ret_var.inner;
18017 if (ret_var.is_owned) {
18023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18024 LDKCounterpartyForwardingInfo orig_conv;
18025 orig_conv.inner = (void*)(orig & (~1));
18026 orig_conv.is_owned = false;
18027 LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
18028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18030 uint64_t ret_ref = (uint64_t)ret_var.inner;
18031 if (ret_var.is_owned) {
18037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18038 LDKChannelCounterparty this_obj_conv;
18039 this_obj_conv.inner = (void*)(this_obj & (~1));
18040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18041 ChannelCounterparty_free(this_obj_conv);
18044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18045 LDKChannelCounterparty this_ptr_conv;
18046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18047 this_ptr_conv.is_owned = false;
18048 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
18053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18054 LDKChannelCounterparty this_ptr_conv;
18055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18056 this_ptr_conv.is_owned = false;
18057 LDKPublicKey val_ref;
18058 CHECK((*env)->GetArrayLength(env, val) == 33);
18059 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18060 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
18063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18064 LDKChannelCounterparty this_ptr_conv;
18065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18066 this_ptr_conv.is_owned = false;
18067 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
18068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18070 uint64_t ret_ref = (uint64_t)ret_var.inner;
18071 if (ret_var.is_owned) {
18077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18078 LDKChannelCounterparty this_ptr_conv;
18079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18080 this_ptr_conv.is_owned = false;
18081 LDKInitFeatures val_conv;
18082 val_conv.inner = (void*)(val & (~1));
18083 val_conv.is_owned = (val & 1) || (val == 0);
18084 val_conv = InitFeatures_clone(&val_conv);
18085 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
18088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18089 LDKChannelCounterparty this_ptr_conv;
18090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18091 this_ptr_conv.is_owned = false;
18092 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
18096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18097 LDKChannelCounterparty this_ptr_conv;
18098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18099 this_ptr_conv.is_owned = false;
18100 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
18103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
18104 LDKChannelCounterparty this_ptr_conv;
18105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18106 this_ptr_conv.is_owned = false;
18107 LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
18108 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18109 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18110 uint64_t ret_ref = (uint64_t)ret_var.inner;
18111 if (ret_var.is_owned) {
18117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18118 LDKChannelCounterparty this_ptr_conv;
18119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18120 this_ptr_conv.is_owned = false;
18121 LDKCounterpartyForwardingInfo val_conv;
18122 val_conv.inner = (void*)(val & (~1));
18123 val_conv.is_owned = (val & 1) || (val == 0);
18124 val_conv = CounterpartyForwardingInfo_clone(&val_conv);
18125 ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
18128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
18129 LDKPublicKey node_id_arg_ref;
18130 CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
18131 (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
18132 LDKInitFeatures features_arg_conv;
18133 features_arg_conv.inner = (void*)(features_arg & (~1));
18134 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
18135 features_arg_conv = InitFeatures_clone(&features_arg_conv);
18136 LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
18137 forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
18138 forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
18139 forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
18140 LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
18141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18143 uint64_t ret_ref = (uint64_t)ret_var.inner;
18144 if (ret_var.is_owned) {
18150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18151 LDKChannelCounterparty orig_conv;
18152 orig_conv.inner = (void*)(orig & (~1));
18153 orig_conv.is_owned = false;
18154 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
18155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18157 uint64_t ret_ref = (uint64_t)ret_var.inner;
18158 if (ret_var.is_owned) {
18164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18165 LDKChannelDetails this_obj_conv;
18166 this_obj_conv.inner = (void*)(this_obj & (~1));
18167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18168 ChannelDetails_free(this_obj_conv);
18171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18172 LDKChannelDetails this_ptr_conv;
18173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18174 this_ptr_conv.is_owned = false;
18175 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
18180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18181 LDKChannelDetails this_ptr_conv;
18182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18183 this_ptr_conv.is_owned = false;
18184 LDKThirtyTwoBytes val_ref;
18185 CHECK((*env)->GetArrayLength(env, val) == 32);
18186 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18187 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
18190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
18191 LDKChannelDetails this_ptr_conv;
18192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18193 this_ptr_conv.is_owned = false;
18194 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
18195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18197 uint64_t ret_ref = (uint64_t)ret_var.inner;
18198 if (ret_var.is_owned) {
18204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18205 LDKChannelDetails this_ptr_conv;
18206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18207 this_ptr_conv.is_owned = false;
18208 LDKChannelCounterparty val_conv;
18209 val_conv.inner = (void*)(val & (~1));
18210 val_conv.is_owned = (val & 1) || (val == 0);
18211 val_conv = ChannelCounterparty_clone(&val_conv);
18212 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
18215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
18216 LDKChannelDetails this_ptr_conv;
18217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18218 this_ptr_conv.is_owned = false;
18219 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
18220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18222 uint64_t ret_ref = (uint64_t)ret_var.inner;
18223 if (ret_var.is_owned) {
18229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18230 LDKChannelDetails this_ptr_conv;
18231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18232 this_ptr_conv.is_owned = false;
18233 LDKOutPoint val_conv;
18234 val_conv.inner = (void*)(val & (~1));
18235 val_conv.is_owned = (val & 1) || (val == 0);
18236 val_conv = OutPoint_clone(&val_conv);
18237 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
18240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18241 LDKChannelDetails this_ptr_conv;
18242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18243 this_ptr_conv.is_owned = false;
18244 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18245 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
18246 uint64_t ret_ref = (uint64_t)ret_copy;
18250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18251 LDKChannelDetails this_ptr_conv;
18252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18253 this_ptr_conv.is_owned = false;
18254 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18255 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18256 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
18259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18260 LDKChannelDetails this_ptr_conv;
18261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18262 this_ptr_conv.is_owned = false;
18263 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
18267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18268 LDKChannelDetails this_ptr_conv;
18269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18270 this_ptr_conv.is_owned = false;
18271 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
18274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
18275 LDKChannelDetails this_ptr_conv;
18276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18277 this_ptr_conv.is_owned = false;
18278 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
18279 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
18280 uint64_t ret_ref = (uint64_t)ret_copy;
18284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18285 LDKChannelDetails this_ptr_conv;
18286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18287 this_ptr_conv.is_owned = false;
18288 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
18289 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
18290 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
18293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18294 LDKChannelDetails this_ptr_conv;
18295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18296 this_ptr_conv.is_owned = false;
18297 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
18301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18302 LDKChannelDetails this_ptr_conv;
18303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18304 this_ptr_conv.is_owned = false;
18305 ChannelDetails_set_user_id(&this_ptr_conv, val);
18308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18309 LDKChannelDetails this_ptr_conv;
18310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18311 this_ptr_conv.is_owned = false;
18312 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
18316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18317 LDKChannelDetails this_ptr_conv;
18318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18319 this_ptr_conv.is_owned = false;
18320 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
18323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18324 LDKChannelDetails this_ptr_conv;
18325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18326 this_ptr_conv.is_owned = false;
18327 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
18331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18332 LDKChannelDetails this_ptr_conv;
18333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18334 this_ptr_conv.is_owned = false;
18335 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
18338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
18339 LDKChannelDetails this_ptr_conv;
18340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18341 this_ptr_conv.is_owned = false;
18342 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
18343 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
18344 uint64_t ret_ref = (uint64_t)ret_copy;
18348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18349 LDKChannelDetails this_ptr_conv;
18350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18351 this_ptr_conv.is_owned = false;
18352 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
18353 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
18354 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
18357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18358 LDKChannelDetails this_ptr_conv;
18359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18360 this_ptr_conv.is_owned = false;
18361 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
18362 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
18363 uint64_t ret_ref = (uint64_t)ret_copy;
18367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18368 LDKChannelDetails this_ptr_conv;
18369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18370 this_ptr_conv.is_owned = false;
18371 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
18372 val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
18373 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
18376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
18377 LDKChannelDetails this_ptr_conv;
18378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18379 this_ptr_conv.is_owned = false;
18380 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
18384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18385 LDKChannelDetails this_ptr_conv;
18386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18387 this_ptr_conv.is_owned = false;
18388 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
18391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
18392 LDKChannelDetails this_ptr_conv;
18393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18394 this_ptr_conv.is_owned = false;
18395 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
18399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18400 LDKChannelDetails this_ptr_conv;
18401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18402 this_ptr_conv.is_owned = false;
18403 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
18406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
18407 LDKChannelDetails this_ptr_conv;
18408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18409 this_ptr_conv.is_owned = false;
18410 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
18414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18415 LDKChannelDetails this_ptr_conv;
18416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18417 this_ptr_conv.is_owned = false;
18418 ChannelDetails_set_is_usable(&this_ptr_conv, val);
18421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
18422 LDKChannelDetails this_ptr_conv;
18423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18424 this_ptr_conv.is_owned = false;
18425 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
18429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
18430 LDKChannelDetails this_ptr_conv;
18431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18432 this_ptr_conv.is_owned = false;
18433 ChannelDetails_set_is_public(&this_ptr_conv, val);
18436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
18437 LDKThirtyTwoBytes channel_id_arg_ref;
18438 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18439 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18440 LDKChannelCounterparty counterparty_arg_conv;
18441 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
18442 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
18443 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
18444 LDKOutPoint funding_txo_arg_conv;
18445 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
18446 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
18447 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
18448 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
18449 short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
18450 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
18451 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
18452 confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
18453 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
18454 force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
18455 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
18456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18458 uint64_t ret_ref = (uint64_t)ret_var.inner;
18459 if (ret_var.is_owned) {
18465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18466 LDKChannelDetails orig_conv;
18467 orig_conv.inner = (void*)(orig & (~1));
18468 orig_conv.is_owned = false;
18469 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
18470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18472 uint64_t ret_ref = (uint64_t)ret_var.inner;
18473 if (ret_var.is_owned) {
18479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18480 if ((this_ptr & 1) != 0) return;
18481 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
18482 FREE((void*)this_ptr);
18483 PaymentSendFailure_free(this_ptr_conv);
18486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18487 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
18488 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18489 *ret_copy = PaymentSendFailure_clone(orig_conv);
18490 uint64_t ret_ref = (uint64_t)ret_copy;
18494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
18495 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
18496 a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
18497 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18498 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
18499 uint64_t ret_ref = (uint64_t)ret_copy;
18503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
18504 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18505 a_constr.datalen = (*env)->GetArrayLength(env, a);
18506 if (a_constr.datalen > 0)
18507 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18509 a_constr.data = NULL;
18510 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18511 for (size_t w = 0; w < a_constr.datalen; w++) {
18512 int64_t a_conv_22 = a_vals[w];
18513 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18514 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18515 a_constr.data[w] = a_conv_22_conv;
18517 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18518 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18519 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
18520 uint64_t ret_ref = (uint64_t)ret_copy;
18524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
18525 LDKCVec_APIErrorZ a_constr;
18526 a_constr.datalen = (*env)->GetArrayLength(env, a);
18527 if (a_constr.datalen > 0)
18528 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
18530 a_constr.data = NULL;
18531 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18532 for (size_t k = 0; k < a_constr.datalen; k++) {
18533 int64_t a_conv_10 = a_vals[k];
18534 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
18535 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
18536 a_constr.data[k] = a_conv_10_conv;
18538 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18539 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18540 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
18541 uint64_t ret_ref = (uint64_t)ret_copy;
18545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
18546 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
18547 a_constr.datalen = (*env)->GetArrayLength(env, a);
18548 if (a_constr.datalen > 0)
18549 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
18551 a_constr.data = NULL;
18552 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
18553 for (size_t w = 0; w < a_constr.datalen; w++) {
18554 int64_t a_conv_22 = a_vals[w];
18555 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
18556 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
18557 a_constr.data[w] = a_conv_22_conv;
18559 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
18560 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
18561 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
18562 uint64_t ret_ref = (uint64_t)ret_copy;
18566 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) {
18567 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
18568 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
18569 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18570 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
18572 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
18573 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
18574 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18575 LDKWatch_JCalls_cloned(&chain_monitor_conv);
18577 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
18578 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
18579 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18580 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
18582 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
18583 if (logger_conv.free == LDKLogger_JCalls_free) {
18584 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18585 LDKLogger_JCalls_cloned(&logger_conv);
18587 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
18588 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
18589 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18590 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
18592 LDKUserConfig config_conv;
18593 config_conv.inner = (void*)(config & (~1));
18594 config_conv.is_owned = (config & 1) || (config == 0);
18595 config_conv = UserConfig_clone(&config_conv);
18596 LDKChainParameters params_conv;
18597 params_conv.inner = (void*)(params & (~1));
18598 params_conv.is_owned = (params & 1) || (params == 0);
18599 params_conv = ChainParameters_clone(¶ms_conv);
18600 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
18601 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18602 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18603 uint64_t ret_ref = (uint64_t)ret_var.inner;
18604 if (ret_var.is_owned) {
18610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
18611 LDKChannelManager this_arg_conv;
18612 this_arg_conv.inner = (void*)(this_arg & (~1));
18613 this_arg_conv.is_owned = false;
18614 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
18615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18617 uint64_t ret_ref = (uint64_t)ret_var.inner;
18618 if (ret_var.is_owned) {
18624 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) {
18625 LDKChannelManager this_arg_conv;
18626 this_arg_conv.inner = (void*)(this_arg & (~1));
18627 this_arg_conv.is_owned = false;
18628 LDKPublicKey their_network_key_ref;
18629 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
18630 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
18631 LDKUserConfig override_config_conv;
18632 override_config_conv.inner = (void*)(override_config & (~1));
18633 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
18634 override_config_conv = UserConfig_clone(&override_config_conv);
18635 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18636 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
18637 return (uint64_t)ret_conv;
18640 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18641 LDKChannelManager this_arg_conv;
18642 this_arg_conv.inner = (void*)(this_arg & (~1));
18643 this_arg_conv.is_owned = false;
18644 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
18645 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18646 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18647 for (size_t q = 0; q < ret_var.datalen; q++) {
18648 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18649 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18650 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18651 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18652 if (ret_conv_16_var.is_owned) {
18653 ret_conv_16_ref |= 1;
18655 ret_arr_ptr[q] = ret_conv_16_ref;
18657 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18658 FREE(ret_var.data);
18662 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18663 LDKChannelManager this_arg_conv;
18664 this_arg_conv.inner = (void*)(this_arg & (~1));
18665 this_arg_conv.is_owned = false;
18666 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
18667 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18668 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18669 for (size_t q = 0; q < ret_var.datalen; q++) {
18670 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
18671 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18672 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18673 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
18674 if (ret_conv_16_var.is_owned) {
18675 ret_conv_16_ref |= 1;
18677 ret_arr_ptr[q] = ret_conv_16_ref;
18679 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18680 FREE(ret_var.data);
18684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
18685 LDKChannelManager this_arg_conv;
18686 this_arg_conv.inner = (void*)(this_arg & (~1));
18687 this_arg_conv.is_owned = false;
18688 unsigned char channel_id_arr[32];
18689 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18690 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18691 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18692 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18693 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
18694 return (uint64_t)ret_conv;
18697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
18698 LDKChannelManager this_arg_conv;
18699 this_arg_conv.inner = (void*)(this_arg & (~1));
18700 this_arg_conv.is_owned = false;
18701 unsigned char channel_id_arr[32];
18702 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18703 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18704 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18705 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18706 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
18707 return (uint64_t)ret_conv;
18710 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) {
18711 LDKChannelManager this_arg_conv;
18712 this_arg_conv.inner = (void*)(this_arg & (~1));
18713 this_arg_conv.is_owned = false;
18714 unsigned char channel_id_arr[32];
18715 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
18716 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
18717 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
18718 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18719 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
18720 return (uint64_t)ret_conv;
18723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
18724 LDKChannelManager this_arg_conv;
18725 this_arg_conv.inner = (void*)(this_arg & (~1));
18726 this_arg_conv.is_owned = false;
18727 ChannelManager_force_close_all_channels(&this_arg_conv);
18730 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) {
18731 LDKChannelManager this_arg_conv;
18732 this_arg_conv.inner = (void*)(this_arg & (~1));
18733 this_arg_conv.is_owned = false;
18734 LDKRoute route_conv;
18735 route_conv.inner = (void*)(route & (~1));
18736 route_conv.is_owned = false;
18737 LDKThirtyTwoBytes payment_hash_ref;
18738 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18739 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
18740 LDKThirtyTwoBytes payment_secret_ref;
18741 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
18742 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
18743 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
18744 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
18745 return (uint64_t)ret_conv;
18748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
18749 LDKChannelManager this_arg_conv;
18750 this_arg_conv.inner = (void*)(this_arg & (~1));
18751 this_arg_conv.is_owned = false;
18752 LDKRoute route_conv;
18753 route_conv.inner = (void*)(route & (~1));
18754 route_conv.is_owned = false;
18755 LDKThirtyTwoBytes payment_preimage_ref;
18756 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
18757 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
18758 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
18759 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
18760 return (uint64_t)ret_conv;
18763 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) {
18764 LDKChannelManager this_arg_conv;
18765 this_arg_conv.inner = (void*)(this_arg & (~1));
18766 this_arg_conv.is_owned = false;
18767 unsigned char temporary_channel_id_arr[32];
18768 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
18769 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
18770 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
18771 LDKTransaction funding_transaction_ref;
18772 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
18773 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
18774 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
18775 funding_transaction_ref.data_is_owned = true;
18776 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
18777 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
18778 return (uint64_t)ret_conv;
18781 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) {
18782 LDKChannelManager this_arg_conv;
18783 this_arg_conv.inner = (void*)(this_arg & (~1));
18784 this_arg_conv.is_owned = false;
18785 LDKThreeBytes rgb_ref;
18786 CHECK((*env)->GetArrayLength(env, rgb) == 3);
18787 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
18788 LDKThirtyTwoBytes alias_ref;
18789 CHECK((*env)->GetArrayLength(env, alias) == 32);
18790 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
18791 LDKCVec_NetAddressZ addresses_constr;
18792 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
18793 if (addresses_constr.datalen > 0)
18794 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18796 addresses_constr.data = NULL;
18797 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
18798 for (size_t m = 0; m < addresses_constr.datalen; m++) {
18799 int64_t addresses_conv_12 = addresses_vals[m];
18800 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
18801 addresses_constr.data[m] = addresses_conv_12_conv;
18803 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
18804 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
18807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
18808 LDKChannelManager this_arg_conv;
18809 this_arg_conv.inner = (void*)(this_arg & (~1));
18810 this_arg_conv.is_owned = false;
18811 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
18814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
18815 LDKChannelManager this_arg_conv;
18816 this_arg_conv.inner = (void*)(this_arg & (~1));
18817 this_arg_conv.is_owned = false;
18818 ChannelManager_timer_tick_occurred(&this_arg_conv);
18821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
18822 LDKChannelManager this_arg_conv;
18823 this_arg_conv.inner = (void*)(this_arg & (~1));
18824 this_arg_conv.is_owned = false;
18825 unsigned char payment_hash_arr[32];
18826 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18827 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
18828 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
18829 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
18833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
18834 LDKChannelManager this_arg_conv;
18835 this_arg_conv.inner = (void*)(this_arg & (~1));
18836 this_arg_conv.is_owned = false;
18837 LDKThirtyTwoBytes payment_preimage_ref;
18838 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
18839 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
18840 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
18844 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
18845 LDKChannelManager this_arg_conv;
18846 this_arg_conv.inner = (void*)(this_arg & (~1));
18847 this_arg_conv.is_owned = false;
18848 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18849 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
18853 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) {
18854 LDKChannelManager this_arg_conv;
18855 this_arg_conv.inner = (void*)(this_arg & (~1));
18856 this_arg_conv.is_owned = false;
18857 LDKOutPoint funding_txo_conv;
18858 funding_txo_conv.inner = (void*)(funding_txo & (~1));
18859 funding_txo_conv.is_owned = false;
18860 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
18863 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) {
18864 LDKChannelManager this_arg_conv;
18865 this_arg_conv.inner = (void*)(this_arg & (~1));
18866 this_arg_conv.is_owned = false;
18867 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
18868 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18869 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
18870 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
18871 return (uint64_t)ret_ref;
18874 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) {
18875 LDKChannelManager this_arg_conv;
18876 this_arg_conv.inner = (void*)(this_arg & (~1));
18877 this_arg_conv.is_owned = false;
18878 LDKThirtyTwoBytes payment_hash_ref;
18879 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
18880 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
18881 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
18882 min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
18883 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
18884 *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);
18885 return (uint64_t)ret_conv;
18888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18889 LDKChannelManager this_arg_conv;
18890 this_arg_conv.inner = (void*)(this_arg & (~1));
18891 this_arg_conv.is_owned = false;
18892 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18893 *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
18894 return (uint64_t)ret_ret;
18897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
18898 LDKChannelManager this_arg_conv;
18899 this_arg_conv.inner = (void*)(this_arg & (~1));
18900 this_arg_conv.is_owned = false;
18901 LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18902 *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
18903 return (uint64_t)ret_ret;
18906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
18907 LDKChannelManager this_arg_conv;
18908 this_arg_conv.inner = (void*)(this_arg & (~1));
18909 this_arg_conv.is_owned = false;
18910 LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
18911 *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
18912 return (uint64_t)ret_ret;
18915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
18916 LDKChannelManager this_arg_conv;
18917 this_arg_conv.inner = (void*)(this_arg & (~1));
18918 this_arg_conv.is_owned = false;
18919 LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18920 *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
18921 return (uint64_t)ret_ret;
18924 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) {
18925 LDKChannelManager this_arg_conv;
18926 this_arg_conv.inner = (void*)(this_arg & (~1));
18927 this_arg_conv.is_owned = false;
18928 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
18932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
18933 LDKChannelManager this_arg_conv;
18934 this_arg_conv.inner = (void*)(this_arg & (~1));
18935 this_arg_conv.is_owned = false;
18936 ChannelManager_await_persistable_update(&this_arg_conv);
18939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
18940 LDKChannelManager this_arg_conv;
18941 this_arg_conv.inner = (void*)(this_arg & (~1));
18942 this_arg_conv.is_owned = false;
18943 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
18944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18946 uint64_t ret_ref = (uint64_t)ret_var.inner;
18947 if (ret_var.is_owned) {
18953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
18954 LDKChannelManager this_arg_conv;
18955 this_arg_conv.inner = (void*)(this_arg & (~1));
18956 this_arg_conv.is_owned = false;
18957 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
18958 *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
18959 return (uint64_t)ret_ret;
18962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
18963 LDKChannelManager obj_conv;
18964 obj_conv.inner = (void*)(obj & (~1));
18965 obj_conv.is_owned = false;
18966 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
18967 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18968 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18969 CVec_u8Z_free(ret_var);
18973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18974 LDKChannelManagerReadArgs this_obj_conv;
18975 this_obj_conv.inner = (void*)(this_obj & (~1));
18976 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18977 ChannelManagerReadArgs_free(this_obj_conv);
18980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
18981 LDKChannelManagerReadArgs this_ptr_conv;
18982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18983 this_ptr_conv.is_owned = false;
18984 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
18988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18989 LDKChannelManagerReadArgs this_ptr_conv;
18990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18991 this_ptr_conv.is_owned = false;
18992 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
18993 if (val_conv.free == LDKKeysInterface_JCalls_free) {
18994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18995 LDKKeysInterface_JCalls_cloned(&val_conv);
18997 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
19000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
19001 LDKChannelManagerReadArgs this_ptr_conv;
19002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19003 this_ptr_conv.is_owned = false;
19004 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
19008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19009 LDKChannelManagerReadArgs this_ptr_conv;
19010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19011 this_ptr_conv.is_owned = false;
19012 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
19013 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
19014 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19015 LDKFeeEstimator_JCalls_cloned(&val_conv);
19017 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
19020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
19021 LDKChannelManagerReadArgs this_ptr_conv;
19022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19023 this_ptr_conv.is_owned = false;
19024 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
19028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19029 LDKChannelManagerReadArgs this_ptr_conv;
19030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19031 this_ptr_conv.is_owned = false;
19032 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
19033 if (val_conv.free == LDKWatch_JCalls_free) {
19034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19035 LDKWatch_JCalls_cloned(&val_conv);
19037 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
19040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
19041 LDKChannelManagerReadArgs this_ptr_conv;
19042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19043 this_ptr_conv.is_owned = false;
19044 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
19048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19049 LDKChannelManagerReadArgs this_ptr_conv;
19050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19051 this_ptr_conv.is_owned = false;
19052 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
19053 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
19054 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19055 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
19057 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
19060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
19061 LDKChannelManagerReadArgs this_ptr_conv;
19062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19063 this_ptr_conv.is_owned = false;
19064 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
19068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19069 LDKChannelManagerReadArgs this_ptr_conv;
19070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19071 this_ptr_conv.is_owned = false;
19072 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
19073 if (val_conv.free == LDKLogger_JCalls_free) {
19074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19075 LDKLogger_JCalls_cloned(&val_conv);
19077 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
19080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
19081 LDKChannelManagerReadArgs this_ptr_conv;
19082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19083 this_ptr_conv.is_owned = false;
19084 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
19085 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19086 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19087 uint64_t ret_ref = (uint64_t)ret_var.inner;
19088 if (ret_var.is_owned) {
19094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19095 LDKChannelManagerReadArgs this_ptr_conv;
19096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19097 this_ptr_conv.is_owned = false;
19098 LDKUserConfig val_conv;
19099 val_conv.inner = (void*)(val & (~1));
19100 val_conv.is_owned = (val & 1) || (val == 0);
19101 val_conv = UserConfig_clone(&val_conv);
19102 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
19105 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) {
19106 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
19107 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
19108 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19109 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
19111 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
19112 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
19113 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19114 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
19116 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
19117 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
19118 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19119 LDKWatch_JCalls_cloned(&chain_monitor_conv);
19121 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
19122 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
19123 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19124 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
19126 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
19127 if (logger_conv.free == LDKLogger_JCalls_free) {
19128 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19129 LDKLogger_JCalls_cloned(&logger_conv);
19131 LDKUserConfig default_config_conv;
19132 default_config_conv.inner = (void*)(default_config & (~1));
19133 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
19134 default_config_conv = UserConfig_clone(&default_config_conv);
19135 LDKCVec_ChannelMonitorZ channel_monitors_constr;
19136 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
19137 if (channel_monitors_constr.datalen > 0)
19138 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
19140 channel_monitors_constr.data = NULL;
19141 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
19142 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
19143 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
19144 LDKChannelMonitor channel_monitors_conv_16_conv;
19145 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
19146 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
19147 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
19149 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
19150 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);
19151 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19152 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19153 uint64_t ret_ref = (uint64_t)ret_var.inner;
19154 if (ret_var.is_owned) {
19160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
19161 LDKu8slice ser_ref;
19162 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19163 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19164 LDKChannelManagerReadArgs arg_conv;
19165 arg_conv.inner = (void*)(arg & (~1));
19166 arg_conv.is_owned = (arg & 1) || (arg == 0);
19167 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
19168 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
19169 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
19170 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19171 return (uint64_t)ret_conv;
19174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19175 LDKDecodeError this_obj_conv;
19176 this_obj_conv.inner = (void*)(this_obj & (~1));
19177 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19178 DecodeError_free(this_obj_conv);
19181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19182 LDKDecodeError orig_conv;
19183 orig_conv.inner = (void*)(orig & (~1));
19184 orig_conv.is_owned = false;
19185 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
19186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19188 uint64_t ret_ref = (uint64_t)ret_var.inner;
19189 if (ret_var.is_owned) {
19195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19196 LDKInit this_obj_conv;
19197 this_obj_conv.inner = (void*)(this_obj & (~1));
19198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19199 Init_free(this_obj_conv);
19202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19203 LDKInit this_ptr_conv;
19204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19205 this_ptr_conv.is_owned = false;
19206 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
19207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19209 uint64_t ret_ref = (uint64_t)ret_var.inner;
19210 if (ret_var.is_owned) {
19216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19217 LDKInit this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 LDKInitFeatures val_conv;
19221 val_conv.inner = (void*)(val & (~1));
19222 val_conv.is_owned = (val & 1) || (val == 0);
19223 val_conv = InitFeatures_clone(&val_conv);
19224 Init_set_features(&this_ptr_conv, val_conv);
19227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
19228 LDKInitFeatures features_arg_conv;
19229 features_arg_conv.inner = (void*)(features_arg & (~1));
19230 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
19231 features_arg_conv = InitFeatures_clone(&features_arg_conv);
19232 LDKInit ret_var = Init_new(features_arg_conv);
19233 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19234 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19235 uint64_t ret_ref = (uint64_t)ret_var.inner;
19236 if (ret_var.is_owned) {
19242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19244 orig_conv.inner = (void*)(orig & (~1));
19245 orig_conv.is_owned = false;
19246 LDKInit ret_var = Init_clone(&orig_conv);
19247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19249 uint64_t ret_ref = (uint64_t)ret_var.inner;
19250 if (ret_var.is_owned) {
19256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19257 LDKErrorMessage this_obj_conv;
19258 this_obj_conv.inner = (void*)(this_obj & (~1));
19259 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19260 ErrorMessage_free(this_obj_conv);
19263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19264 LDKErrorMessage this_ptr_conv;
19265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19266 this_ptr_conv.is_owned = false;
19267 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19268 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
19272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19273 LDKErrorMessage this_ptr_conv;
19274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19275 this_ptr_conv.is_owned = false;
19276 LDKThirtyTwoBytes val_ref;
19277 CHECK((*env)->GetArrayLength(env, val) == 32);
19278 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19279 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
19282 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
19283 LDKErrorMessage this_ptr_conv;
19284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19285 this_ptr_conv.is_owned = false;
19286 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
19287 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19293 LDKErrorMessage this_ptr_conv;
19294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19295 this_ptr_conv.is_owned = false;
19296 LDKStr val_conv = java_to_owned_str(env, val);
19297 ErrorMessage_set_data(&this_ptr_conv, val_conv);
19300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
19301 LDKThirtyTwoBytes channel_id_arg_ref;
19302 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19303 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19304 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
19305 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
19306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19308 uint64_t ret_ref = (uint64_t)ret_var.inner;
19309 if (ret_var.is_owned) {
19315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19316 LDKErrorMessage orig_conv;
19317 orig_conv.inner = (void*)(orig & (~1));
19318 orig_conv.is_owned = false;
19319 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
19320 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19321 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19322 uint64_t ret_ref = (uint64_t)ret_var.inner;
19323 if (ret_var.is_owned) {
19329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19330 LDKPing this_obj_conv;
19331 this_obj_conv.inner = (void*)(this_obj & (~1));
19332 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19333 Ping_free(this_obj_conv);
19336 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19337 LDKPing this_ptr_conv;
19338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19339 this_ptr_conv.is_owned = false;
19340 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
19344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19345 LDKPing this_ptr_conv;
19346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19347 this_ptr_conv.is_owned = false;
19348 Ping_set_ponglen(&this_ptr_conv, val);
19351 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19352 LDKPing this_ptr_conv;
19353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19354 this_ptr_conv.is_owned = false;
19355 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
19359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19360 LDKPing this_ptr_conv;
19361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19362 this_ptr_conv.is_owned = false;
19363 Ping_set_byteslen(&this_ptr_conv, val);
19366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
19367 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
19368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19370 uint64_t ret_ref = (uint64_t)ret_var.inner;
19371 if (ret_var.is_owned) {
19377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19379 orig_conv.inner = (void*)(orig & (~1));
19380 orig_conv.is_owned = false;
19381 LDKPing ret_var = Ping_clone(&orig_conv);
19382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19384 uint64_t ret_ref = (uint64_t)ret_var.inner;
19385 if (ret_var.is_owned) {
19391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19392 LDKPong this_obj_conv;
19393 this_obj_conv.inner = (void*)(this_obj & (~1));
19394 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19395 Pong_free(this_obj_conv);
19398 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
19399 LDKPong this_ptr_conv;
19400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19401 this_ptr_conv.is_owned = false;
19402 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
19406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19407 LDKPong this_ptr_conv;
19408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19409 this_ptr_conv.is_owned = false;
19410 Pong_set_byteslen(&this_ptr_conv, val);
19413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
19414 LDKPong ret_var = Pong_new(byteslen_arg);
19415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19417 uint64_t ret_ref = (uint64_t)ret_var.inner;
19418 if (ret_var.is_owned) {
19424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19426 orig_conv.inner = (void*)(orig & (~1));
19427 orig_conv.is_owned = false;
19428 LDKPong ret_var = Pong_clone(&orig_conv);
19429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19431 uint64_t ret_ref = (uint64_t)ret_var.inner;
19432 if (ret_var.is_owned) {
19438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19439 LDKOpenChannel this_obj_conv;
19440 this_obj_conv.inner = (void*)(this_obj & (~1));
19441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19442 OpenChannel_free(this_obj_conv);
19445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19446 LDKOpenChannel this_ptr_conv;
19447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19448 this_ptr_conv.is_owned = false;
19449 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
19454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19455 LDKOpenChannel this_ptr_conv;
19456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19457 this_ptr_conv.is_owned = false;
19458 LDKThirtyTwoBytes val_ref;
19459 CHECK((*env)->GetArrayLength(env, val) == 32);
19460 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19461 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
19464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19465 LDKOpenChannel this_ptr_conv;
19466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19467 this_ptr_conv.is_owned = false;
19468 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19469 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
19473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19474 LDKOpenChannel this_ptr_conv;
19475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19476 this_ptr_conv.is_owned = false;
19477 LDKThirtyTwoBytes val_ref;
19478 CHECK((*env)->GetArrayLength(env, val) == 32);
19479 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19480 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19484 LDKOpenChannel this_ptr_conv;
19485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19486 this_ptr_conv.is_owned = false;
19487 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
19491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19492 LDKOpenChannel this_ptr_conv;
19493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19494 this_ptr_conv.is_owned = false;
19495 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
19498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19499 LDKOpenChannel this_ptr_conv;
19500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19501 this_ptr_conv.is_owned = false;
19502 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
19506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19507 LDKOpenChannel this_ptr_conv;
19508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19509 this_ptr_conv.is_owned = false;
19510 OpenChannel_set_push_msat(&this_ptr_conv, val);
19513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19514 LDKOpenChannel this_ptr_conv;
19515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19516 this_ptr_conv.is_owned = false;
19517 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
19521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19522 LDKOpenChannel this_ptr_conv;
19523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19524 this_ptr_conv.is_owned = false;
19525 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19528 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) {
19529 LDKOpenChannel this_ptr_conv;
19530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19531 this_ptr_conv.is_owned = false;
19532 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19536 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) {
19537 LDKOpenChannel this_ptr_conv;
19538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19539 this_ptr_conv.is_owned = false;
19540 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19544 LDKOpenChannel this_ptr_conv;
19545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19546 this_ptr_conv.is_owned = false;
19547 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19552 LDKOpenChannel this_ptr_conv;
19553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19554 this_ptr_conv.is_owned = false;
19555 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19559 LDKOpenChannel this_ptr_conv;
19560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19561 this_ptr_conv.is_owned = false;
19562 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
19566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19567 LDKOpenChannel this_ptr_conv;
19568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19569 this_ptr_conv.is_owned = false;
19570 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19573 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
19574 LDKOpenChannel this_ptr_conv;
19575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19576 this_ptr_conv.is_owned = false;
19577 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
19581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19582 LDKOpenChannel this_ptr_conv;
19583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19584 this_ptr_conv.is_owned = false;
19585 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
19588 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19589 LDKOpenChannel this_ptr_conv;
19590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19591 this_ptr_conv.is_owned = false;
19592 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
19596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19597 LDKOpenChannel this_ptr_conv;
19598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19599 this_ptr_conv.is_owned = false;
19600 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
19603 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
19604 LDKOpenChannel this_ptr_conv;
19605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19606 this_ptr_conv.is_owned = false;
19607 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
19611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19612 LDKOpenChannel this_ptr_conv;
19613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19614 this_ptr_conv.is_owned = false;
19615 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19619 LDKOpenChannel this_ptr_conv;
19620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19621 this_ptr_conv.is_owned = false;
19622 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19623 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
19627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19628 LDKOpenChannel this_ptr_conv;
19629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19630 this_ptr_conv.is_owned = false;
19631 LDKPublicKey val_ref;
19632 CHECK((*env)->GetArrayLength(env, val) == 33);
19633 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19634 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19638 LDKOpenChannel this_ptr_conv;
19639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19640 this_ptr_conv.is_owned = false;
19641 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
19646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19647 LDKOpenChannel this_ptr_conv;
19648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19649 this_ptr_conv.is_owned = false;
19650 LDKPublicKey val_ref;
19651 CHECK((*env)->GetArrayLength(env, val) == 33);
19652 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19653 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19657 LDKOpenChannel this_ptr_conv;
19658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19659 this_ptr_conv.is_owned = false;
19660 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19661 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
19665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19666 LDKOpenChannel this_ptr_conv;
19667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19668 this_ptr_conv.is_owned = false;
19669 LDKPublicKey val_ref;
19670 CHECK((*env)->GetArrayLength(env, val) == 33);
19671 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19672 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
19675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19676 LDKOpenChannel this_ptr_conv;
19677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19678 this_ptr_conv.is_owned = false;
19679 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
19684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19685 LDKOpenChannel this_ptr_conv;
19686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19687 this_ptr_conv.is_owned = false;
19688 LDKPublicKey val_ref;
19689 CHECK((*env)->GetArrayLength(env, val) == 33);
19690 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19691 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19694 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19695 LDKOpenChannel this_ptr_conv;
19696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19697 this_ptr_conv.is_owned = false;
19698 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19699 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
19703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19704 LDKOpenChannel this_ptr_conv;
19705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19706 this_ptr_conv.is_owned = false;
19707 LDKPublicKey val_ref;
19708 CHECK((*env)->GetArrayLength(env, val) == 33);
19709 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19710 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19714 LDKOpenChannel this_ptr_conv;
19715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19716 this_ptr_conv.is_owned = false;
19717 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19718 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
19722 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) {
19723 LDKOpenChannel this_ptr_conv;
19724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19725 this_ptr_conv.is_owned = false;
19726 LDKPublicKey val_ref;
19727 CHECK((*env)->GetArrayLength(env, val) == 33);
19728 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19729 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
19732 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19733 LDKOpenChannel this_ptr_conv;
19734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19735 this_ptr_conv.is_owned = false;
19736 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
19740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19741 LDKOpenChannel this_ptr_conv;
19742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19743 this_ptr_conv.is_owned = false;
19744 OpenChannel_set_channel_flags(&this_ptr_conv, val);
19747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19748 LDKOpenChannel orig_conv;
19749 orig_conv.inner = (void*)(orig & (~1));
19750 orig_conv.is_owned = false;
19751 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
19752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19754 uint64_t ret_ref = (uint64_t)ret_var.inner;
19755 if (ret_var.is_owned) {
19761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19762 LDKAcceptChannel this_obj_conv;
19763 this_obj_conv.inner = (void*)(this_obj & (~1));
19764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19765 AcceptChannel_free(this_obj_conv);
19768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19769 LDKAcceptChannel this_ptr_conv;
19770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19771 this_ptr_conv.is_owned = false;
19772 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19773 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
19777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19778 LDKAcceptChannel this_ptr_conv;
19779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19780 this_ptr_conv.is_owned = false;
19781 LDKThirtyTwoBytes val_ref;
19782 CHECK((*env)->GetArrayLength(env, val) == 32);
19783 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19784 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
19787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19788 LDKAcceptChannel this_ptr_conv;
19789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19790 this_ptr_conv.is_owned = false;
19791 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
19795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19796 LDKAcceptChannel this_ptr_conv;
19797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19798 this_ptr_conv.is_owned = false;
19799 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
19802 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) {
19803 LDKAcceptChannel this_ptr_conv;
19804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19805 this_ptr_conv.is_owned = false;
19806 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
19810 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) {
19811 LDKAcceptChannel this_ptr_conv;
19812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19813 this_ptr_conv.is_owned = false;
19814 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
19817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
19818 LDKAcceptChannel this_ptr_conv;
19819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19820 this_ptr_conv.is_owned = false;
19821 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
19825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19826 LDKAcceptChannel this_ptr_conv;
19827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19828 this_ptr_conv.is_owned = false;
19829 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
19832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19833 LDKAcceptChannel this_ptr_conv;
19834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19835 this_ptr_conv.is_owned = false;
19836 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
19840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19841 LDKAcceptChannel this_ptr_conv;
19842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19843 this_ptr_conv.is_owned = false;
19844 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
19847 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
19848 LDKAcceptChannel this_ptr_conv;
19849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19850 this_ptr_conv.is_owned = false;
19851 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
19855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19856 LDKAcceptChannel this_ptr_conv;
19857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19858 this_ptr_conv.is_owned = false;
19859 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
19862 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
19863 LDKAcceptChannel this_ptr_conv;
19864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19865 this_ptr_conv.is_owned = false;
19866 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
19870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19871 LDKAcceptChannel this_ptr_conv;
19872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19873 this_ptr_conv.is_owned = false;
19874 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
19877 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
19878 LDKAcceptChannel this_ptr_conv;
19879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19880 this_ptr_conv.is_owned = false;
19881 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
19885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19886 LDKAcceptChannel this_ptr_conv;
19887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19888 this_ptr_conv.is_owned = false;
19889 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
19892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
19893 LDKAcceptChannel this_ptr_conv;
19894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19895 this_ptr_conv.is_owned = false;
19896 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
19901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19902 LDKAcceptChannel this_ptr_conv;
19903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19904 this_ptr_conv.is_owned = false;
19905 LDKPublicKey val_ref;
19906 CHECK((*env)->GetArrayLength(env, val) == 33);
19907 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19908 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
19911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19912 LDKAcceptChannel this_ptr_conv;
19913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19914 this_ptr_conv.is_owned = false;
19915 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19916 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
19920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19921 LDKAcceptChannel this_ptr_conv;
19922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19923 this_ptr_conv.is_owned = false;
19924 LDKPublicKey val_ref;
19925 CHECK((*env)->GetArrayLength(env, val) == 33);
19926 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19927 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
19930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19931 LDKAcceptChannel this_ptr_conv;
19932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19933 this_ptr_conv.is_owned = false;
19934 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
19939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19940 LDKAcceptChannel this_ptr_conv;
19941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19942 this_ptr_conv.is_owned = false;
19943 LDKPublicKey val_ref;
19944 CHECK((*env)->GetArrayLength(env, val) == 33);
19945 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19946 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
19949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19950 LDKAcceptChannel this_ptr_conv;
19951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19952 this_ptr_conv.is_owned = false;
19953 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19954 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
19958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19959 LDKAcceptChannel this_ptr_conv;
19960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19961 this_ptr_conv.is_owned = false;
19962 LDKPublicKey val_ref;
19963 CHECK((*env)->GetArrayLength(env, val) == 33);
19964 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19965 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
19968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
19969 LDKAcceptChannel this_ptr_conv;
19970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19971 this_ptr_conv.is_owned = false;
19972 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19973 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
19977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19978 LDKAcceptChannel this_ptr_conv;
19979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19980 this_ptr_conv.is_owned = false;
19981 LDKPublicKey val_ref;
19982 CHECK((*env)->GetArrayLength(env, val) == 33);
19983 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19984 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
19987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19988 LDKAcceptChannel this_ptr_conv;
19989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19990 this_ptr_conv.is_owned = false;
19991 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19992 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
19996 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) {
19997 LDKAcceptChannel this_ptr_conv;
19998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19999 this_ptr_conv.is_owned = false;
20000 LDKPublicKey val_ref;
20001 CHECK((*env)->GetArrayLength(env, val) == 33);
20002 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20003 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
20006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20007 LDKAcceptChannel orig_conv;
20008 orig_conv.inner = (void*)(orig & (~1));
20009 orig_conv.is_owned = false;
20010 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
20011 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20012 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20013 uint64_t ret_ref = (uint64_t)ret_var.inner;
20014 if (ret_var.is_owned) {
20020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20021 LDKFundingCreated this_obj_conv;
20022 this_obj_conv.inner = (void*)(this_obj & (~1));
20023 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20024 FundingCreated_free(this_obj_conv);
20027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20028 LDKFundingCreated this_ptr_conv;
20029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20030 this_ptr_conv.is_owned = false;
20031 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20032 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
20036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20037 LDKFundingCreated this_ptr_conv;
20038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20039 this_ptr_conv.is_owned = false;
20040 LDKThirtyTwoBytes val_ref;
20041 CHECK((*env)->GetArrayLength(env, val) == 32);
20042 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20043 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
20046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
20047 LDKFundingCreated this_ptr_conv;
20048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20049 this_ptr_conv.is_owned = false;
20050 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20051 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
20055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20056 LDKFundingCreated this_ptr_conv;
20057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20058 this_ptr_conv.is_owned = false;
20059 LDKThirtyTwoBytes val_ref;
20060 CHECK((*env)->GetArrayLength(env, val) == 32);
20061 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20062 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
20065 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
20066 LDKFundingCreated this_ptr_conv;
20067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20068 this_ptr_conv.is_owned = false;
20069 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
20073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20074 LDKFundingCreated this_ptr_conv;
20075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20076 this_ptr_conv.is_owned = false;
20077 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
20080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20081 LDKFundingCreated this_ptr_conv;
20082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20083 this_ptr_conv.is_owned = false;
20084 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20085 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
20089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20090 LDKFundingCreated this_ptr_conv;
20091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20092 this_ptr_conv.is_owned = false;
20093 LDKSignature val_ref;
20094 CHECK((*env)->GetArrayLength(env, val) == 64);
20095 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20096 FundingCreated_set_signature(&this_ptr_conv, val_ref);
20099 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) {
20100 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
20101 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
20102 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
20103 LDKThirtyTwoBytes funding_txid_arg_ref;
20104 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
20105 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
20106 LDKSignature signature_arg_ref;
20107 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20108 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20109 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
20110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20112 uint64_t ret_ref = (uint64_t)ret_var.inner;
20113 if (ret_var.is_owned) {
20119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20120 LDKFundingCreated orig_conv;
20121 orig_conv.inner = (void*)(orig & (~1));
20122 orig_conv.is_owned = false;
20123 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
20124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20126 uint64_t ret_ref = (uint64_t)ret_var.inner;
20127 if (ret_var.is_owned) {
20133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20134 LDKFundingSigned this_obj_conv;
20135 this_obj_conv.inner = (void*)(this_obj & (~1));
20136 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20137 FundingSigned_free(this_obj_conv);
20140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20141 LDKFundingSigned this_ptr_conv;
20142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20143 this_ptr_conv.is_owned = false;
20144 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20145 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
20149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20150 LDKFundingSigned this_ptr_conv;
20151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20152 this_ptr_conv.is_owned = false;
20153 LDKThirtyTwoBytes val_ref;
20154 CHECK((*env)->GetArrayLength(env, val) == 32);
20155 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20156 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
20159 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20160 LDKFundingSigned this_ptr_conv;
20161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20162 this_ptr_conv.is_owned = false;
20163 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20164 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
20168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20169 LDKFundingSigned this_ptr_conv;
20170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20171 this_ptr_conv.is_owned = false;
20172 LDKSignature val_ref;
20173 CHECK((*env)->GetArrayLength(env, val) == 64);
20174 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20175 FundingSigned_set_signature(&this_ptr_conv, val_ref);
20178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
20179 LDKThirtyTwoBytes channel_id_arg_ref;
20180 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20181 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20182 LDKSignature signature_arg_ref;
20183 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20184 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20185 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
20186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20188 uint64_t ret_ref = (uint64_t)ret_var.inner;
20189 if (ret_var.is_owned) {
20195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20196 LDKFundingSigned orig_conv;
20197 orig_conv.inner = (void*)(orig & (~1));
20198 orig_conv.is_owned = false;
20199 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
20200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20202 uint64_t ret_ref = (uint64_t)ret_var.inner;
20203 if (ret_var.is_owned) {
20209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20210 LDKFundingLocked this_obj_conv;
20211 this_obj_conv.inner = (void*)(this_obj & (~1));
20212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20213 FundingLocked_free(this_obj_conv);
20216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20217 LDKFundingLocked this_ptr_conv;
20218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20219 this_ptr_conv.is_owned = false;
20220 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20221 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
20225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20226 LDKFundingLocked this_ptr_conv;
20227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20228 this_ptr_conv.is_owned = false;
20229 LDKThirtyTwoBytes val_ref;
20230 CHECK((*env)->GetArrayLength(env, val) == 32);
20231 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20232 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
20235 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20236 LDKFundingLocked this_ptr_conv;
20237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20238 this_ptr_conv.is_owned = false;
20239 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20240 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
20244 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) {
20245 LDKFundingLocked this_ptr_conv;
20246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20247 this_ptr_conv.is_owned = false;
20248 LDKPublicKey val_ref;
20249 CHECK((*env)->GetArrayLength(env, val) == 33);
20250 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20251 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
20254 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) {
20255 LDKThirtyTwoBytes channel_id_arg_ref;
20256 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20257 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20258 LDKPublicKey next_per_commitment_point_arg_ref;
20259 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
20260 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
20261 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
20262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20264 uint64_t ret_ref = (uint64_t)ret_var.inner;
20265 if (ret_var.is_owned) {
20271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20272 LDKFundingLocked orig_conv;
20273 orig_conv.inner = (void*)(orig & (~1));
20274 orig_conv.is_owned = false;
20275 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
20276 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20277 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20278 uint64_t ret_ref = (uint64_t)ret_var.inner;
20279 if (ret_var.is_owned) {
20285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20286 LDKShutdown this_obj_conv;
20287 this_obj_conv.inner = (void*)(this_obj & (~1));
20288 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20289 Shutdown_free(this_obj_conv);
20292 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20293 LDKShutdown this_ptr_conv;
20294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20295 this_ptr_conv.is_owned = false;
20296 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20297 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
20301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20302 LDKShutdown this_ptr_conv;
20303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20304 this_ptr_conv.is_owned = false;
20305 LDKThirtyTwoBytes val_ref;
20306 CHECK((*env)->GetArrayLength(env, val) == 32);
20307 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20308 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
20311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
20312 LDKShutdown this_ptr_conv;
20313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20314 this_ptr_conv.is_owned = false;
20315 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_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);
20321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20322 LDKShutdown this_ptr_conv;
20323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20324 this_ptr_conv.is_owned = false;
20325 LDKCVec_u8Z val_ref;
20326 val_ref.datalen = (*env)->GetArrayLength(env, val);
20327 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
20328 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
20329 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
20332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
20333 LDKThirtyTwoBytes channel_id_arg_ref;
20334 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20335 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20336 LDKCVec_u8Z scriptpubkey_arg_ref;
20337 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
20338 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
20339 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
20340 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
20341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20343 uint64_t ret_ref = (uint64_t)ret_var.inner;
20344 if (ret_var.is_owned) {
20350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20351 LDKShutdown orig_conv;
20352 orig_conv.inner = (void*)(orig & (~1));
20353 orig_conv.is_owned = false;
20354 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
20355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20357 uint64_t ret_ref = (uint64_t)ret_var.inner;
20358 if (ret_var.is_owned) {
20364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20365 LDKClosingSignedFeeRange this_obj_conv;
20366 this_obj_conv.inner = (void*)(this_obj & (~1));
20367 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20368 ClosingSignedFeeRange_free(this_obj_conv);
20371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20372 LDKClosingSignedFeeRange this_ptr_conv;
20373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20374 this_ptr_conv.is_owned = false;
20375 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
20379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20380 LDKClosingSignedFeeRange this_ptr_conv;
20381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20382 this_ptr_conv.is_owned = false;
20383 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
20386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20387 LDKClosingSignedFeeRange this_ptr_conv;
20388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20389 this_ptr_conv.is_owned = false;
20390 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
20394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20395 LDKClosingSignedFeeRange this_ptr_conv;
20396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20397 this_ptr_conv.is_owned = false;
20398 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
20401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
20402 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
20403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20405 uint64_t ret_ref = (uint64_t)ret_var.inner;
20406 if (ret_var.is_owned) {
20412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20413 LDKClosingSignedFeeRange orig_conv;
20414 orig_conv.inner = (void*)(orig & (~1));
20415 orig_conv.is_owned = false;
20416 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
20417 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20418 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20419 uint64_t ret_ref = (uint64_t)ret_var.inner;
20420 if (ret_var.is_owned) {
20426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20427 LDKClosingSigned this_obj_conv;
20428 this_obj_conv.inner = (void*)(this_obj & (~1));
20429 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20430 ClosingSigned_free(this_obj_conv);
20433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20434 LDKClosingSigned this_ptr_conv;
20435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20436 this_ptr_conv.is_owned = false;
20437 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20438 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
20442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20443 LDKClosingSigned this_ptr_conv;
20444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20445 this_ptr_conv.is_owned = false;
20446 LDKThirtyTwoBytes val_ref;
20447 CHECK((*env)->GetArrayLength(env, val) == 32);
20448 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20449 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
20452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
20453 LDKClosingSigned this_ptr_conv;
20454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20455 this_ptr_conv.is_owned = false;
20456 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
20460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20461 LDKClosingSigned this_ptr_conv;
20462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20463 this_ptr_conv.is_owned = false;
20464 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
20467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20468 LDKClosingSigned this_ptr_conv;
20469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20470 this_ptr_conv.is_owned = false;
20471 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20472 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
20476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20477 LDKClosingSigned this_ptr_conv;
20478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20479 this_ptr_conv.is_owned = false;
20480 LDKSignature val_ref;
20481 CHECK((*env)->GetArrayLength(env, val) == 64);
20482 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20483 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
20486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
20487 LDKClosingSigned this_ptr_conv;
20488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20489 this_ptr_conv.is_owned = false;
20490 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
20491 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20492 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20493 uint64_t ret_ref = (uint64_t)ret_var.inner;
20494 if (ret_var.is_owned) {
20500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20501 LDKClosingSigned this_ptr_conv;
20502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20503 this_ptr_conv.is_owned = false;
20504 LDKClosingSignedFeeRange val_conv;
20505 val_conv.inner = (void*)(val & (~1));
20506 val_conv.is_owned = (val & 1) || (val == 0);
20507 val_conv = ClosingSignedFeeRange_clone(&val_conv);
20508 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
20511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
20512 LDKThirtyTwoBytes channel_id_arg_ref;
20513 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20514 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20515 LDKSignature signature_arg_ref;
20516 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20517 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20518 LDKClosingSignedFeeRange fee_range_arg_conv;
20519 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
20520 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
20521 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
20522 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
20523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20525 uint64_t ret_ref = (uint64_t)ret_var.inner;
20526 if (ret_var.is_owned) {
20532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20533 LDKClosingSigned orig_conv;
20534 orig_conv.inner = (void*)(orig & (~1));
20535 orig_conv.is_owned = false;
20536 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
20537 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20538 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20539 uint64_t ret_ref = (uint64_t)ret_var.inner;
20540 if (ret_var.is_owned) {
20546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20547 LDKUpdateAddHTLC this_obj_conv;
20548 this_obj_conv.inner = (void*)(this_obj & (~1));
20549 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20550 UpdateAddHTLC_free(this_obj_conv);
20553 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20554 LDKUpdateAddHTLC this_ptr_conv;
20555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20556 this_ptr_conv.is_owned = false;
20557 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20558 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
20562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20563 LDKUpdateAddHTLC this_ptr_conv;
20564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20565 this_ptr_conv.is_owned = false;
20566 LDKThirtyTwoBytes val_ref;
20567 CHECK((*env)->GetArrayLength(env, val) == 32);
20568 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20569 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20573 LDKUpdateAddHTLC this_ptr_conv;
20574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20575 this_ptr_conv.is_owned = false;
20576 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
20580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20581 LDKUpdateAddHTLC this_ptr_conv;
20582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20583 this_ptr_conv.is_owned = false;
20584 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
20587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20588 LDKUpdateAddHTLC this_ptr_conv;
20589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20590 this_ptr_conv.is_owned = false;
20591 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
20595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20596 LDKUpdateAddHTLC this_ptr_conv;
20597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20598 this_ptr_conv.is_owned = false;
20599 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
20602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20603 LDKUpdateAddHTLC this_ptr_conv;
20604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20605 this_ptr_conv.is_owned = false;
20606 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
20611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20612 LDKUpdateAddHTLC this_ptr_conv;
20613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20614 this_ptr_conv.is_owned = false;
20615 LDKThirtyTwoBytes val_ref;
20616 CHECK((*env)->GetArrayLength(env, val) == 32);
20617 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20618 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
20621 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
20622 LDKUpdateAddHTLC this_ptr_conv;
20623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20624 this_ptr_conv.is_owned = false;
20625 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
20629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20630 LDKUpdateAddHTLC this_ptr_conv;
20631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20632 this_ptr_conv.is_owned = false;
20633 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
20636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20637 LDKUpdateAddHTLC orig_conv;
20638 orig_conv.inner = (void*)(orig & (~1));
20639 orig_conv.is_owned = false;
20640 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
20641 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20642 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20643 uint64_t ret_ref = (uint64_t)ret_var.inner;
20644 if (ret_var.is_owned) {
20650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20651 LDKUpdateFulfillHTLC this_obj_conv;
20652 this_obj_conv.inner = (void*)(this_obj & (~1));
20653 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20654 UpdateFulfillHTLC_free(this_obj_conv);
20657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20658 LDKUpdateFulfillHTLC this_ptr_conv;
20659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20660 this_ptr_conv.is_owned = false;
20661 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20662 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
20666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20667 LDKUpdateFulfillHTLC this_ptr_conv;
20668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20669 this_ptr_conv.is_owned = false;
20670 LDKThirtyTwoBytes val_ref;
20671 CHECK((*env)->GetArrayLength(env, val) == 32);
20672 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20673 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
20676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20677 LDKUpdateFulfillHTLC this_ptr_conv;
20678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20679 this_ptr_conv.is_owned = false;
20680 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
20684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20685 LDKUpdateFulfillHTLC this_ptr_conv;
20686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20687 this_ptr_conv.is_owned = false;
20688 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
20691 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
20692 LDKUpdateFulfillHTLC this_ptr_conv;
20693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20694 this_ptr_conv.is_owned = false;
20695 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20696 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
20700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20701 LDKUpdateFulfillHTLC this_ptr_conv;
20702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20703 this_ptr_conv.is_owned = false;
20704 LDKThirtyTwoBytes val_ref;
20705 CHECK((*env)->GetArrayLength(env, val) == 32);
20706 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20707 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
20710 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) {
20711 LDKThirtyTwoBytes channel_id_arg_ref;
20712 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20713 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20714 LDKThirtyTwoBytes payment_preimage_arg_ref;
20715 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
20716 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
20717 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
20718 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20719 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20720 uint64_t ret_ref = (uint64_t)ret_var.inner;
20721 if (ret_var.is_owned) {
20727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20728 LDKUpdateFulfillHTLC orig_conv;
20729 orig_conv.inner = (void*)(orig & (~1));
20730 orig_conv.is_owned = false;
20731 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
20732 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20733 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20734 uint64_t ret_ref = (uint64_t)ret_var.inner;
20735 if (ret_var.is_owned) {
20741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20742 LDKUpdateFailHTLC this_obj_conv;
20743 this_obj_conv.inner = (void*)(this_obj & (~1));
20744 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20745 UpdateFailHTLC_free(this_obj_conv);
20748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20749 LDKUpdateFailHTLC this_ptr_conv;
20750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20751 this_ptr_conv.is_owned = false;
20752 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20753 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
20757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20758 LDKUpdateFailHTLC this_ptr_conv;
20759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20760 this_ptr_conv.is_owned = false;
20761 LDKThirtyTwoBytes val_ref;
20762 CHECK((*env)->GetArrayLength(env, val) == 32);
20763 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20764 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
20767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20768 LDKUpdateFailHTLC this_ptr_conv;
20769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20770 this_ptr_conv.is_owned = false;
20771 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
20775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20776 LDKUpdateFailHTLC this_ptr_conv;
20777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20778 this_ptr_conv.is_owned = false;
20779 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
20782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20783 LDKUpdateFailHTLC orig_conv;
20784 orig_conv.inner = (void*)(orig & (~1));
20785 orig_conv.is_owned = false;
20786 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
20787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20789 uint64_t ret_ref = (uint64_t)ret_var.inner;
20790 if (ret_var.is_owned) {
20796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20797 LDKUpdateFailMalformedHTLC this_obj_conv;
20798 this_obj_conv.inner = (void*)(this_obj & (~1));
20799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20800 UpdateFailMalformedHTLC_free(this_obj_conv);
20803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20804 LDKUpdateFailMalformedHTLC this_ptr_conv;
20805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20806 this_ptr_conv.is_owned = false;
20807 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20808 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
20812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20813 LDKUpdateFailMalformedHTLC this_ptr_conv;
20814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20815 this_ptr_conv.is_owned = false;
20816 LDKThirtyTwoBytes val_ref;
20817 CHECK((*env)->GetArrayLength(env, val) == 32);
20818 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20819 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
20822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20823 LDKUpdateFailMalformedHTLC this_ptr_conv;
20824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20825 this_ptr_conv.is_owned = false;
20826 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
20830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20831 LDKUpdateFailMalformedHTLC this_ptr_conv;
20832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20833 this_ptr_conv.is_owned = false;
20834 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
20837 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
20838 LDKUpdateFailMalformedHTLC this_ptr_conv;
20839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20840 this_ptr_conv.is_owned = false;
20841 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
20845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20846 LDKUpdateFailMalformedHTLC this_ptr_conv;
20847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20848 this_ptr_conv.is_owned = false;
20849 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
20852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20853 LDKUpdateFailMalformedHTLC orig_conv;
20854 orig_conv.inner = (void*)(orig & (~1));
20855 orig_conv.is_owned = false;
20856 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
20857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20859 uint64_t ret_ref = (uint64_t)ret_var.inner;
20860 if (ret_var.is_owned) {
20866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20867 LDKCommitmentSigned this_obj_conv;
20868 this_obj_conv.inner = (void*)(this_obj & (~1));
20869 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20870 CommitmentSigned_free(this_obj_conv);
20873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20874 LDKCommitmentSigned this_ptr_conv;
20875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20876 this_ptr_conv.is_owned = false;
20877 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20878 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
20882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20883 LDKCommitmentSigned this_ptr_conv;
20884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20885 this_ptr_conv.is_owned = false;
20886 LDKThirtyTwoBytes val_ref;
20887 CHECK((*env)->GetArrayLength(env, val) == 32);
20888 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20889 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
20892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20893 LDKCommitmentSigned this_ptr_conv;
20894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20895 this_ptr_conv.is_owned = false;
20896 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
20901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20902 LDKCommitmentSigned this_ptr_conv;
20903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20904 this_ptr_conv.is_owned = false;
20905 LDKSignature val_ref;
20906 CHECK((*env)->GetArrayLength(env, val) == 64);
20907 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20908 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
20911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
20912 LDKCommitmentSigned this_ptr_conv;
20913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20914 this_ptr_conv.is_owned = false;
20915 LDKCVec_SignatureZ val_constr;
20916 val_constr.datalen = (*env)->GetArrayLength(env, val);
20917 if (val_constr.datalen > 0)
20918 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20920 val_constr.data = NULL;
20921 for (size_t i = 0; i < val_constr.datalen; i++) {
20922 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
20923 LDKSignature val_conv_8_ref;
20924 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
20925 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
20926 val_constr.data[i] = val_conv_8_ref;
20928 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
20931 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) {
20932 LDKThirtyTwoBytes channel_id_arg_ref;
20933 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
20934 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
20935 LDKSignature signature_arg_ref;
20936 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20937 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20938 LDKCVec_SignatureZ htlc_signatures_arg_constr;
20939 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
20940 if (htlc_signatures_arg_constr.datalen > 0)
20941 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
20943 htlc_signatures_arg_constr.data = NULL;
20944 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
20945 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
20946 LDKSignature htlc_signatures_arg_conv_8_ref;
20947 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
20948 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
20949 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
20951 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
20952 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20953 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20954 uint64_t ret_ref = (uint64_t)ret_var.inner;
20955 if (ret_var.is_owned) {
20961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20962 LDKCommitmentSigned orig_conv;
20963 orig_conv.inner = (void*)(orig & (~1));
20964 orig_conv.is_owned = false;
20965 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
20966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20968 uint64_t ret_ref = (uint64_t)ret_var.inner;
20969 if (ret_var.is_owned) {
20975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20976 LDKRevokeAndACK this_obj_conv;
20977 this_obj_conv.inner = (void*)(this_obj & (~1));
20978 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20979 RevokeAndACK_free(this_obj_conv);
20982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20983 LDKRevokeAndACK this_ptr_conv;
20984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20985 this_ptr_conv.is_owned = false;
20986 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20987 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
20991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20992 LDKRevokeAndACK this_ptr_conv;
20993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20994 this_ptr_conv.is_owned = false;
20995 LDKThirtyTwoBytes val_ref;
20996 CHECK((*env)->GetArrayLength(env, val) == 32);
20997 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20998 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
21001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21002 LDKRevokeAndACK this_ptr_conv;
21003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21004 this_ptr_conv.is_owned = false;
21005 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21006 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
21010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21011 LDKRevokeAndACK this_ptr_conv;
21012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21013 this_ptr_conv.is_owned = false;
21014 LDKThirtyTwoBytes val_ref;
21015 CHECK((*env)->GetArrayLength(env, val) == 32);
21016 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21017 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
21020 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21021 LDKRevokeAndACK this_ptr_conv;
21022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21023 this_ptr_conv.is_owned = false;
21024 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21025 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
21029 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) {
21030 LDKRevokeAndACK this_ptr_conv;
21031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21032 this_ptr_conv.is_owned = false;
21033 LDKPublicKey val_ref;
21034 CHECK((*env)->GetArrayLength(env, val) == 33);
21035 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21036 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
21039 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) {
21040 LDKThirtyTwoBytes channel_id_arg_ref;
21041 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21042 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21043 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
21044 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
21045 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
21046 LDKPublicKey next_per_commitment_point_arg_ref;
21047 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
21048 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
21049 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
21050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21052 uint64_t ret_ref = (uint64_t)ret_var.inner;
21053 if (ret_var.is_owned) {
21059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21060 LDKRevokeAndACK orig_conv;
21061 orig_conv.inner = (void*)(orig & (~1));
21062 orig_conv.is_owned = false;
21063 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
21064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21066 uint64_t ret_ref = (uint64_t)ret_var.inner;
21067 if (ret_var.is_owned) {
21073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21074 LDKUpdateFee this_obj_conv;
21075 this_obj_conv.inner = (void*)(this_obj & (~1));
21076 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21077 UpdateFee_free(this_obj_conv);
21080 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21081 LDKUpdateFee this_ptr_conv;
21082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21083 this_ptr_conv.is_owned = false;
21084 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21085 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
21089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21090 LDKUpdateFee this_ptr_conv;
21091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21092 this_ptr_conv.is_owned = false;
21093 LDKThirtyTwoBytes val_ref;
21094 CHECK((*env)->GetArrayLength(env, val) == 32);
21095 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21096 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
21099 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
21100 LDKUpdateFee this_ptr_conv;
21101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21102 this_ptr_conv.is_owned = false;
21103 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
21107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21108 LDKUpdateFee this_ptr_conv;
21109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21110 this_ptr_conv.is_owned = false;
21111 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
21114 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) {
21115 LDKThirtyTwoBytes channel_id_arg_ref;
21116 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21117 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21118 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
21119 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21120 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21121 uint64_t ret_ref = (uint64_t)ret_var.inner;
21122 if (ret_var.is_owned) {
21128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21129 LDKUpdateFee orig_conv;
21130 orig_conv.inner = (void*)(orig & (~1));
21131 orig_conv.is_owned = false;
21132 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
21133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21135 uint64_t ret_ref = (uint64_t)ret_var.inner;
21136 if (ret_var.is_owned) {
21142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21143 LDKDataLossProtect this_obj_conv;
21144 this_obj_conv.inner = (void*)(this_obj & (~1));
21145 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21146 DataLossProtect_free(this_obj_conv);
21149 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
21150 LDKDataLossProtect this_ptr_conv;
21151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21152 this_ptr_conv.is_owned = false;
21153 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21154 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
21158 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) {
21159 LDKDataLossProtect this_ptr_conv;
21160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21161 this_ptr_conv.is_owned = false;
21162 LDKThirtyTwoBytes val_ref;
21163 CHECK((*env)->GetArrayLength(env, val) == 32);
21164 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21165 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
21168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21169 LDKDataLossProtect this_ptr_conv;
21170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21171 this_ptr_conv.is_owned = false;
21172 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21173 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
21177 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) {
21178 LDKDataLossProtect this_ptr_conv;
21179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21180 this_ptr_conv.is_owned = false;
21181 LDKPublicKey val_ref;
21182 CHECK((*env)->GetArrayLength(env, val) == 33);
21183 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21184 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
21187 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) {
21188 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
21189 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
21190 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
21191 LDKPublicKey my_current_per_commitment_point_arg_ref;
21192 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
21193 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
21194 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
21195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21197 uint64_t ret_ref = (uint64_t)ret_var.inner;
21198 if (ret_var.is_owned) {
21204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21205 LDKDataLossProtect orig_conv;
21206 orig_conv.inner = (void*)(orig & (~1));
21207 orig_conv.is_owned = false;
21208 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
21209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21211 uint64_t ret_ref = (uint64_t)ret_var.inner;
21212 if (ret_var.is_owned) {
21218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21219 LDKChannelReestablish this_obj_conv;
21220 this_obj_conv.inner = (void*)(this_obj & (~1));
21221 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21222 ChannelReestablish_free(this_obj_conv);
21225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21226 LDKChannelReestablish this_ptr_conv;
21227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21228 this_ptr_conv.is_owned = false;
21229 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21230 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
21234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21235 LDKChannelReestablish this_ptr_conv;
21236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21237 this_ptr_conv.is_owned = false;
21238 LDKThirtyTwoBytes val_ref;
21239 CHECK((*env)->GetArrayLength(env, val) == 32);
21240 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21241 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
21244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21245 LDKChannelReestablish this_ptr_conv;
21246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21247 this_ptr_conv.is_owned = false;
21248 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
21252 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) {
21253 LDKChannelReestablish this_ptr_conv;
21254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21255 this_ptr_conv.is_owned = false;
21256 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
21259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
21260 LDKChannelReestablish this_ptr_conv;
21261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21262 this_ptr_conv.is_owned = false;
21263 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
21267 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) {
21268 LDKChannelReestablish this_ptr_conv;
21269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21270 this_ptr_conv.is_owned = false;
21271 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
21274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21275 LDKChannelReestablish orig_conv;
21276 orig_conv.inner = (void*)(orig & (~1));
21277 orig_conv.is_owned = false;
21278 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
21279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21281 uint64_t ret_ref = (uint64_t)ret_var.inner;
21282 if (ret_var.is_owned) {
21288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21289 LDKAnnouncementSignatures this_obj_conv;
21290 this_obj_conv.inner = (void*)(this_obj & (~1));
21291 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21292 AnnouncementSignatures_free(this_obj_conv);
21295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21296 LDKAnnouncementSignatures this_ptr_conv;
21297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21298 this_ptr_conv.is_owned = false;
21299 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21300 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
21304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21305 LDKAnnouncementSignatures this_ptr_conv;
21306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21307 this_ptr_conv.is_owned = false;
21308 LDKThirtyTwoBytes val_ref;
21309 CHECK((*env)->GetArrayLength(env, val) == 32);
21310 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21311 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
21314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21315 LDKAnnouncementSignatures this_ptr_conv;
21316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21317 this_ptr_conv.is_owned = false;
21318 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
21322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21323 LDKAnnouncementSignatures this_ptr_conv;
21324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21325 this_ptr_conv.is_owned = false;
21326 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
21329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21330 LDKAnnouncementSignatures this_ptr_conv;
21331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21332 this_ptr_conv.is_owned = false;
21333 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21334 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
21338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21339 LDKAnnouncementSignatures this_ptr_conv;
21340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21341 this_ptr_conv.is_owned = false;
21342 LDKSignature val_ref;
21343 CHECK((*env)->GetArrayLength(env, val) == 64);
21344 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21345 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
21348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21349 LDKAnnouncementSignatures this_ptr_conv;
21350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21351 this_ptr_conv.is_owned = false;
21352 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21353 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
21357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21358 LDKAnnouncementSignatures this_ptr_conv;
21359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21360 this_ptr_conv.is_owned = false;
21361 LDKSignature val_ref;
21362 CHECK((*env)->GetArrayLength(env, val) == 64);
21363 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21364 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
21367 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) {
21368 LDKThirtyTwoBytes channel_id_arg_ref;
21369 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
21370 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
21371 LDKSignature node_signature_arg_ref;
21372 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
21373 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
21374 LDKSignature bitcoin_signature_arg_ref;
21375 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
21376 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
21377 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
21378 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21379 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21380 uint64_t ret_ref = (uint64_t)ret_var.inner;
21381 if (ret_var.is_owned) {
21387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21388 LDKAnnouncementSignatures orig_conv;
21389 orig_conv.inner = (void*)(orig & (~1));
21390 orig_conv.is_owned = false;
21391 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
21392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21394 uint64_t ret_ref = (uint64_t)ret_var.inner;
21395 if (ret_var.is_owned) {
21401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21402 if ((this_ptr & 1) != 0) return;
21403 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
21404 FREE((void*)this_ptr);
21405 NetAddress_free(this_ptr_conv);
21408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21409 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
21410 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21411 *ret_copy = NetAddress_clone(orig_conv);
21412 uint64_t ret_ref = (uint64_t)ret_copy;
21416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21417 LDKFourBytes addr_ref;
21418 CHECK((*env)->GetArrayLength(env, addr) == 4);
21419 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
21420 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21421 *ret_copy = NetAddress_ipv4(addr_ref, port);
21422 uint64_t ret_ref = (uint64_t)ret_copy;
21426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21427 LDKSixteenBytes addr_ref;
21428 CHECK((*env)->GetArrayLength(env, addr) == 16);
21429 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
21430 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21431 *ret_copy = NetAddress_ipv6(addr_ref, port);
21432 uint64_t ret_ref = (uint64_t)ret_copy;
21436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
21437 LDKTenBytes addr_ref;
21438 CHECK((*env)->GetArrayLength(env, addr) == 10);
21439 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
21440 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21441 *ret_copy = NetAddress_onion_v2(addr_ref, port);
21442 uint64_t ret_ref = (uint64_t)ret_copy;
21446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v3(JNIEnv *env, jclass clz, int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
21447 LDKThirtyTwoBytes ed25519_pubkey_ref;
21448 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
21449 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
21450 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
21451 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
21452 uint64_t ret_ref = (uint64_t)ret_copy;
21456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
21457 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
21458 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
21459 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21460 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21461 CVec_u8Z_free(ret_var);
21465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21466 LDKu8slice ser_ref;
21467 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21468 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21469 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
21470 *ret_conv = Result_read(ser_ref);
21471 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21472 return (uint64_t)ret_conv;
21475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21476 LDKu8slice ser_ref;
21477 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21478 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21479 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
21480 *ret_conv = NetAddress_read(ser_ref);
21481 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21482 return (uint64_t)ret_conv;
21485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21486 LDKUnsignedNodeAnnouncement this_obj_conv;
21487 this_obj_conv.inner = (void*)(this_obj & (~1));
21488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21489 UnsignedNodeAnnouncement_free(this_obj_conv);
21492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21493 LDKUnsignedNodeAnnouncement this_ptr_conv;
21494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21495 this_ptr_conv.is_owned = false;
21496 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
21497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21499 uint64_t ret_ref = (uint64_t)ret_var.inner;
21500 if (ret_var.is_owned) {
21506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21507 LDKUnsignedNodeAnnouncement this_ptr_conv;
21508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21509 this_ptr_conv.is_owned = false;
21510 LDKNodeFeatures val_conv;
21511 val_conv.inner = (void*)(val & (~1));
21512 val_conv.is_owned = (val & 1) || (val == 0);
21513 val_conv = NodeFeatures_clone(&val_conv);
21514 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
21517 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
21518 LDKUnsignedNodeAnnouncement this_ptr_conv;
21519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21520 this_ptr_conv.is_owned = false;
21521 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
21525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21526 LDKUnsignedNodeAnnouncement this_ptr_conv;
21527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21528 this_ptr_conv.is_owned = false;
21529 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
21532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21533 LDKUnsignedNodeAnnouncement this_ptr_conv;
21534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21535 this_ptr_conv.is_owned = false;
21536 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
21541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21542 LDKUnsignedNodeAnnouncement this_ptr_conv;
21543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21544 this_ptr_conv.is_owned = false;
21545 LDKPublicKey val_ref;
21546 CHECK((*env)->GetArrayLength(env, val) == 33);
21547 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21548 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
21551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
21552 LDKUnsignedNodeAnnouncement this_ptr_conv;
21553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21554 this_ptr_conv.is_owned = false;
21555 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
21556 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
21560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21561 LDKUnsignedNodeAnnouncement this_ptr_conv;
21562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21563 this_ptr_conv.is_owned = false;
21564 LDKThreeBytes val_ref;
21565 CHECK((*env)->GetArrayLength(env, val) == 3);
21566 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
21567 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
21570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
21571 LDKUnsignedNodeAnnouncement this_ptr_conv;
21572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21573 this_ptr_conv.is_owned = false;
21574 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21575 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
21579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21580 LDKUnsignedNodeAnnouncement this_ptr_conv;
21581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21582 this_ptr_conv.is_owned = false;
21583 LDKThirtyTwoBytes val_ref;
21584 CHECK((*env)->GetArrayLength(env, val) == 32);
21585 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21586 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
21589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21590 LDKUnsignedNodeAnnouncement this_ptr_conv;
21591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21592 this_ptr_conv.is_owned = false;
21593 LDKCVec_NetAddressZ val_constr;
21594 val_constr.datalen = (*env)->GetArrayLength(env, val);
21595 if (val_constr.datalen > 0)
21596 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
21598 val_constr.data = NULL;
21599 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21600 for (size_t m = 0; m < val_constr.datalen; m++) {
21601 int64_t val_conv_12 = val_vals[m];
21602 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
21603 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
21604 val_constr.data[m] = val_conv_12_conv;
21606 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21607 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
21610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21611 LDKUnsignedNodeAnnouncement orig_conv;
21612 orig_conv.inner = (void*)(orig & (~1));
21613 orig_conv.is_owned = false;
21614 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
21615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21617 uint64_t ret_ref = (uint64_t)ret_var.inner;
21618 if (ret_var.is_owned) {
21624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21625 LDKNodeAnnouncement this_obj_conv;
21626 this_obj_conv.inner = (void*)(this_obj & (~1));
21627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21628 NodeAnnouncement_free(this_obj_conv);
21631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
21632 LDKNodeAnnouncement this_ptr_conv;
21633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21634 this_ptr_conv.is_owned = false;
21635 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
21640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21641 LDKNodeAnnouncement this_ptr_conv;
21642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21643 this_ptr_conv.is_owned = false;
21644 LDKSignature val_ref;
21645 CHECK((*env)->GetArrayLength(env, val) == 64);
21646 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21647 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
21650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
21651 LDKNodeAnnouncement this_ptr_conv;
21652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21653 this_ptr_conv.is_owned = false;
21654 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
21655 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21656 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21657 uint64_t ret_ref = (uint64_t)ret_var.inner;
21658 if (ret_var.is_owned) {
21664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21665 LDKNodeAnnouncement this_ptr_conv;
21666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21667 this_ptr_conv.is_owned = false;
21668 LDKUnsignedNodeAnnouncement val_conv;
21669 val_conv.inner = (void*)(val & (~1));
21670 val_conv.is_owned = (val & 1) || (val == 0);
21671 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
21672 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
21675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
21676 LDKSignature signature_arg_ref;
21677 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
21678 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
21679 LDKUnsignedNodeAnnouncement contents_arg_conv;
21680 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21681 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21682 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
21683 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
21684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21686 uint64_t ret_ref = (uint64_t)ret_var.inner;
21687 if (ret_var.is_owned) {
21693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21694 LDKNodeAnnouncement orig_conv;
21695 orig_conv.inner = (void*)(orig & (~1));
21696 orig_conv.is_owned = false;
21697 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
21698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21700 uint64_t ret_ref = (uint64_t)ret_var.inner;
21701 if (ret_var.is_owned) {
21707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21708 LDKUnsignedChannelAnnouncement this_obj_conv;
21709 this_obj_conv.inner = (void*)(this_obj & (~1));
21710 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21711 UnsignedChannelAnnouncement_free(this_obj_conv);
21714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
21715 LDKUnsignedChannelAnnouncement this_ptr_conv;
21716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21717 this_ptr_conv.is_owned = false;
21718 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
21719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21721 uint64_t ret_ref = (uint64_t)ret_var.inner;
21722 if (ret_var.is_owned) {
21728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21729 LDKUnsignedChannelAnnouncement this_ptr_conv;
21730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21731 this_ptr_conv.is_owned = false;
21732 LDKChannelFeatures val_conv;
21733 val_conv.inner = (void*)(val & (~1));
21734 val_conv.is_owned = (val & 1) || (val == 0);
21735 val_conv = ChannelFeatures_clone(&val_conv);
21736 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
21739 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21740 LDKUnsignedChannelAnnouncement this_ptr_conv;
21741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21742 this_ptr_conv.is_owned = false;
21743 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21744 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
21748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21749 LDKUnsignedChannelAnnouncement this_ptr_conv;
21750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21751 this_ptr_conv.is_owned = false;
21752 LDKThirtyTwoBytes val_ref;
21753 CHECK((*env)->GetArrayLength(env, val) == 32);
21754 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21755 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
21758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
21759 LDKUnsignedChannelAnnouncement this_ptr_conv;
21760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21761 this_ptr_conv.is_owned = false;
21762 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
21766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21767 LDKUnsignedChannelAnnouncement this_ptr_conv;
21768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21769 this_ptr_conv.is_owned = false;
21770 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
21773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21774 LDKUnsignedChannelAnnouncement this_ptr_conv;
21775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21776 this_ptr_conv.is_owned = false;
21777 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21778 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
21782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21783 LDKUnsignedChannelAnnouncement this_ptr_conv;
21784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21785 this_ptr_conv.is_owned = false;
21786 LDKPublicKey val_ref;
21787 CHECK((*env)->GetArrayLength(env, val) == 33);
21788 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21789 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
21792 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21793 LDKUnsignedChannelAnnouncement this_ptr_conv;
21794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21795 this_ptr_conv.is_owned = false;
21796 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21797 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
21801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21802 LDKUnsignedChannelAnnouncement this_ptr_conv;
21803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21804 this_ptr_conv.is_owned = false;
21805 LDKPublicKey val_ref;
21806 CHECK((*env)->GetArrayLength(env, val) == 33);
21807 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21808 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
21811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21812 LDKUnsignedChannelAnnouncement this_ptr_conv;
21813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21814 this_ptr_conv.is_owned = false;
21815 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21816 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
21820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21821 LDKUnsignedChannelAnnouncement this_ptr_conv;
21822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21823 this_ptr_conv.is_owned = false;
21824 LDKPublicKey val_ref;
21825 CHECK((*env)->GetArrayLength(env, val) == 33);
21826 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21827 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
21830 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21831 LDKUnsignedChannelAnnouncement this_ptr_conv;
21832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21833 this_ptr_conv.is_owned = false;
21834 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21835 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
21839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21840 LDKUnsignedChannelAnnouncement this_ptr_conv;
21841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21842 this_ptr_conv.is_owned = false;
21843 LDKPublicKey val_ref;
21844 CHECK((*env)->GetArrayLength(env, val) == 33);
21845 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21846 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
21849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21850 LDKUnsignedChannelAnnouncement orig_conv;
21851 orig_conv.inner = (void*)(orig & (~1));
21852 orig_conv.is_owned = false;
21853 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
21854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21856 uint64_t ret_ref = (uint64_t)ret_var.inner;
21857 if (ret_var.is_owned) {
21863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21864 LDKChannelAnnouncement this_obj_conv;
21865 this_obj_conv.inner = (void*)(this_obj & (~1));
21866 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21867 ChannelAnnouncement_free(this_obj_conv);
21870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21871 LDKChannelAnnouncement this_ptr_conv;
21872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21873 this_ptr_conv.is_owned = false;
21874 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
21879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21880 LDKChannelAnnouncement this_ptr_conv;
21881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21882 this_ptr_conv.is_owned = false;
21883 LDKSignature val_ref;
21884 CHECK((*env)->GetArrayLength(env, val) == 64);
21885 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21886 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
21889 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21890 LDKChannelAnnouncement this_ptr_conv;
21891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21892 this_ptr_conv.is_owned = false;
21893 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21894 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
21898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21899 LDKChannelAnnouncement this_ptr_conv;
21900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21901 this_ptr_conv.is_owned = false;
21902 LDKSignature val_ref;
21903 CHECK((*env)->GetArrayLength(env, val) == 64);
21904 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21905 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
21908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
21909 LDKChannelAnnouncement this_ptr_conv;
21910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21911 this_ptr_conv.is_owned = false;
21912 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21913 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
21917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21918 LDKChannelAnnouncement this_ptr_conv;
21919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21920 this_ptr_conv.is_owned = false;
21921 LDKSignature val_ref;
21922 CHECK((*env)->GetArrayLength(env, val) == 64);
21923 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21924 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
21927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
21928 LDKChannelAnnouncement this_ptr_conv;
21929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21930 this_ptr_conv.is_owned = false;
21931 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
21936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21937 LDKChannelAnnouncement this_ptr_conv;
21938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21939 this_ptr_conv.is_owned = false;
21940 LDKSignature val_ref;
21941 CHECK((*env)->GetArrayLength(env, val) == 64);
21942 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21943 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
21946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
21947 LDKChannelAnnouncement this_ptr_conv;
21948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21949 this_ptr_conv.is_owned = false;
21950 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
21951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21953 uint64_t ret_ref = (uint64_t)ret_var.inner;
21954 if (ret_var.is_owned) {
21960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21961 LDKChannelAnnouncement this_ptr_conv;
21962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21963 this_ptr_conv.is_owned = false;
21964 LDKUnsignedChannelAnnouncement val_conv;
21965 val_conv.inner = (void*)(val & (~1));
21966 val_conv.is_owned = (val & 1) || (val == 0);
21967 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
21968 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
21971 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) {
21972 LDKSignature node_signature_1_arg_ref;
21973 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
21974 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
21975 LDKSignature node_signature_2_arg_ref;
21976 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
21977 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
21978 LDKSignature bitcoin_signature_1_arg_ref;
21979 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
21980 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
21981 LDKSignature bitcoin_signature_2_arg_ref;
21982 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
21983 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
21984 LDKUnsignedChannelAnnouncement contents_arg_conv;
21985 contents_arg_conv.inner = (void*)(contents_arg & (~1));
21986 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
21987 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
21988 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);
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 int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21999 LDKChannelAnnouncement orig_conv;
22000 orig_conv.inner = (void*)(orig & (~1));
22001 orig_conv.is_owned = false;
22002 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
22003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22005 uint64_t ret_ref = (uint64_t)ret_var.inner;
22006 if (ret_var.is_owned) {
22012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22013 LDKUnsignedChannelUpdate this_obj_conv;
22014 this_obj_conv.inner = (void*)(this_obj & (~1));
22015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22016 UnsignedChannelUpdate_free(this_obj_conv);
22019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22020 LDKUnsignedChannelUpdate this_ptr_conv;
22021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22022 this_ptr_conv.is_owned = false;
22023 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22024 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
22028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22029 LDKUnsignedChannelUpdate this_ptr_conv;
22030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22031 this_ptr_conv.is_owned = false;
22032 LDKThirtyTwoBytes val_ref;
22033 CHECK((*env)->GetArrayLength(env, val) == 32);
22034 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22035 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
22038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22039 LDKUnsignedChannelUpdate this_ptr_conv;
22040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22041 this_ptr_conv.is_owned = false;
22042 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
22046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22047 LDKUnsignedChannelUpdate this_ptr_conv;
22048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22049 this_ptr_conv.is_owned = false;
22050 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
22053 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22054 LDKUnsignedChannelUpdate this_ptr_conv;
22055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22056 this_ptr_conv.is_owned = false;
22057 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
22061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22062 LDKUnsignedChannelUpdate this_ptr_conv;
22063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22064 this_ptr_conv.is_owned = false;
22065 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
22068 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
22069 LDKUnsignedChannelUpdate this_ptr_conv;
22070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22071 this_ptr_conv.is_owned = false;
22072 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
22076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
22077 LDKUnsignedChannelUpdate this_ptr_conv;
22078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22079 this_ptr_conv.is_owned = false;
22080 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
22083 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22084 LDKUnsignedChannelUpdate this_ptr_conv;
22085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22086 this_ptr_conv.is_owned = false;
22087 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
22091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22092 LDKUnsignedChannelUpdate this_ptr_conv;
22093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22094 this_ptr_conv.is_owned = false;
22095 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
22098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22099 LDKUnsignedChannelUpdate this_ptr_conv;
22100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22101 this_ptr_conv.is_owned = false;
22102 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
22106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22107 LDKUnsignedChannelUpdate this_ptr_conv;
22108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22109 this_ptr_conv.is_owned = false;
22110 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
22113 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22114 LDKUnsignedChannelUpdate this_ptr_conv;
22115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22116 this_ptr_conv.is_owned = false;
22117 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
22121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22122 LDKUnsignedChannelUpdate this_ptr_conv;
22123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22124 this_ptr_conv.is_owned = false;
22125 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
22128 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
22129 LDKUnsignedChannelUpdate this_ptr_conv;
22130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22131 this_ptr_conv.is_owned = false;
22132 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
22136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22137 LDKUnsignedChannelUpdate this_ptr_conv;
22138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22139 this_ptr_conv.is_owned = false;
22140 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
22143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22144 LDKUnsignedChannelUpdate orig_conv;
22145 orig_conv.inner = (void*)(orig & (~1));
22146 orig_conv.is_owned = false;
22147 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
22148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22150 uint64_t ret_ref = (uint64_t)ret_var.inner;
22151 if (ret_var.is_owned) {
22157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22158 LDKChannelUpdate this_obj_conv;
22159 this_obj_conv.inner = (void*)(this_obj & (~1));
22160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22161 ChannelUpdate_free(this_obj_conv);
22164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
22165 LDKChannelUpdate this_ptr_conv;
22166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22167 this_ptr_conv.is_owned = false;
22168 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22169 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
22173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22174 LDKChannelUpdate this_ptr_conv;
22175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22176 this_ptr_conv.is_owned = false;
22177 LDKSignature val_ref;
22178 CHECK((*env)->GetArrayLength(env, val) == 64);
22179 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22180 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
22183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
22184 LDKChannelUpdate this_ptr_conv;
22185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22186 this_ptr_conv.is_owned = false;
22187 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
22188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22190 uint64_t ret_ref = (uint64_t)ret_var.inner;
22191 if (ret_var.is_owned) {
22197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22198 LDKChannelUpdate this_ptr_conv;
22199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22200 this_ptr_conv.is_owned = false;
22201 LDKUnsignedChannelUpdate val_conv;
22202 val_conv.inner = (void*)(val & (~1));
22203 val_conv.is_owned = (val & 1) || (val == 0);
22204 val_conv = UnsignedChannelUpdate_clone(&val_conv);
22205 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
22208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
22209 LDKSignature signature_arg_ref;
22210 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
22211 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
22212 LDKUnsignedChannelUpdate contents_arg_conv;
22213 contents_arg_conv.inner = (void*)(contents_arg & (~1));
22214 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
22215 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
22216 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
22217 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22218 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22219 uint64_t ret_ref = (uint64_t)ret_var.inner;
22220 if (ret_var.is_owned) {
22226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22227 LDKChannelUpdate orig_conv;
22228 orig_conv.inner = (void*)(orig & (~1));
22229 orig_conv.is_owned = false;
22230 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
22231 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22232 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22233 uint64_t ret_ref = (uint64_t)ret_var.inner;
22234 if (ret_var.is_owned) {
22240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22241 LDKQueryChannelRange this_obj_conv;
22242 this_obj_conv.inner = (void*)(this_obj & (~1));
22243 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22244 QueryChannelRange_free(this_obj_conv);
22247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22248 LDKQueryChannelRange this_ptr_conv;
22249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22250 this_ptr_conv.is_owned = false;
22251 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22252 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
22256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22257 LDKQueryChannelRange this_ptr_conv;
22258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22259 this_ptr_conv.is_owned = false;
22260 LDKThirtyTwoBytes val_ref;
22261 CHECK((*env)->GetArrayLength(env, val) == 32);
22262 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22263 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22267 LDKQueryChannelRange this_ptr_conv;
22268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22269 this_ptr_conv.is_owned = false;
22270 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
22274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22275 LDKQueryChannelRange this_ptr_conv;
22276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22277 this_ptr_conv.is_owned = false;
22278 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
22281 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22282 LDKQueryChannelRange this_ptr_conv;
22283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22284 this_ptr_conv.is_owned = false;
22285 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
22289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22290 LDKQueryChannelRange this_ptr_conv;
22291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22292 this_ptr_conv.is_owned = false;
22293 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22296 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) {
22297 LDKThirtyTwoBytes chain_hash_arg_ref;
22298 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22299 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22300 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
22301 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22302 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22303 uint64_t ret_ref = (uint64_t)ret_var.inner;
22304 if (ret_var.is_owned) {
22310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22311 LDKQueryChannelRange orig_conv;
22312 orig_conv.inner = (void*)(orig & (~1));
22313 orig_conv.is_owned = false;
22314 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
22315 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22316 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22317 uint64_t ret_ref = (uint64_t)ret_var.inner;
22318 if (ret_var.is_owned) {
22324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22325 LDKReplyChannelRange this_obj_conv;
22326 this_obj_conv.inner = (void*)(this_obj & (~1));
22327 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22328 ReplyChannelRange_free(this_obj_conv);
22331 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22332 LDKReplyChannelRange this_ptr_conv;
22333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22334 this_ptr_conv.is_owned = false;
22335 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22336 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
22340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22341 LDKReplyChannelRange this_ptr_conv;
22342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22343 this_ptr_conv.is_owned = false;
22344 LDKThirtyTwoBytes val_ref;
22345 CHECK((*env)->GetArrayLength(env, val) == 32);
22346 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22347 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
22350 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
22351 LDKReplyChannelRange this_ptr_conv;
22352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22353 this_ptr_conv.is_owned = false;
22354 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
22358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22359 LDKReplyChannelRange this_ptr_conv;
22360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22361 this_ptr_conv.is_owned = false;
22362 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
22365 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
22366 LDKReplyChannelRange this_ptr_conv;
22367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22368 this_ptr_conv.is_owned = false;
22369 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
22373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22374 LDKReplyChannelRange this_ptr_conv;
22375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22376 this_ptr_conv.is_owned = false;
22377 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
22380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
22381 LDKReplyChannelRange this_ptr_conv;
22382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22383 this_ptr_conv.is_owned = false;
22384 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
22388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22389 LDKReplyChannelRange this_ptr_conv;
22390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22391 this_ptr_conv.is_owned = false;
22392 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
22395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22396 LDKReplyChannelRange this_ptr_conv;
22397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22398 this_ptr_conv.is_owned = false;
22399 LDKCVec_u64Z val_constr;
22400 val_constr.datalen = (*env)->GetArrayLength(env, val);
22401 if (val_constr.datalen > 0)
22402 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22404 val_constr.data = NULL;
22405 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22406 for (size_t g = 0; g < val_constr.datalen; g++) {
22407 int64_t val_conv_6 = val_vals[g];
22408 val_constr.data[g] = val_conv_6;
22410 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22411 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
22414 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) {
22415 LDKThirtyTwoBytes chain_hash_arg_ref;
22416 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22417 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22418 LDKCVec_u64Z short_channel_ids_arg_constr;
22419 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22420 if (short_channel_ids_arg_constr.datalen > 0)
22421 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22423 short_channel_ids_arg_constr.data = NULL;
22424 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22425 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22426 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22427 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22429 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22430 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
22431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22433 uint64_t ret_ref = (uint64_t)ret_var.inner;
22434 if (ret_var.is_owned) {
22440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22441 LDKReplyChannelRange orig_conv;
22442 orig_conv.inner = (void*)(orig & (~1));
22443 orig_conv.is_owned = false;
22444 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
22445 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22446 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22447 uint64_t ret_ref = (uint64_t)ret_var.inner;
22448 if (ret_var.is_owned) {
22454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22455 LDKQueryShortChannelIds this_obj_conv;
22456 this_obj_conv.inner = (void*)(this_obj & (~1));
22457 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22458 QueryShortChannelIds_free(this_obj_conv);
22461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22462 LDKQueryShortChannelIds this_ptr_conv;
22463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22464 this_ptr_conv.is_owned = false;
22465 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22466 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
22470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22471 LDKQueryShortChannelIds this_ptr_conv;
22472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22473 this_ptr_conv.is_owned = false;
22474 LDKThirtyTwoBytes val_ref;
22475 CHECK((*env)->GetArrayLength(env, val) == 32);
22476 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22477 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
22480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22481 LDKQueryShortChannelIds this_ptr_conv;
22482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22483 this_ptr_conv.is_owned = false;
22484 LDKCVec_u64Z val_constr;
22485 val_constr.datalen = (*env)->GetArrayLength(env, val);
22486 if (val_constr.datalen > 0)
22487 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22489 val_constr.data = NULL;
22490 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22491 for (size_t g = 0; g < val_constr.datalen; g++) {
22492 int64_t val_conv_6 = val_vals[g];
22493 val_constr.data[g] = val_conv_6;
22495 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22496 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
22499 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) {
22500 LDKThirtyTwoBytes chain_hash_arg_ref;
22501 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22502 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22503 LDKCVec_u64Z short_channel_ids_arg_constr;
22504 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
22505 if (short_channel_ids_arg_constr.datalen > 0)
22506 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
22508 short_channel_ids_arg_constr.data = NULL;
22509 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
22510 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
22511 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
22512 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
22514 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
22515 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
22516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22518 uint64_t ret_ref = (uint64_t)ret_var.inner;
22519 if (ret_var.is_owned) {
22525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22526 LDKQueryShortChannelIds orig_conv;
22527 orig_conv.inner = (void*)(orig & (~1));
22528 orig_conv.is_owned = false;
22529 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
22530 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22531 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22532 uint64_t ret_ref = (uint64_t)ret_var.inner;
22533 if (ret_var.is_owned) {
22539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22540 LDKReplyShortChannelIdsEnd this_obj_conv;
22541 this_obj_conv.inner = (void*)(this_obj & (~1));
22542 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22543 ReplyShortChannelIdsEnd_free(this_obj_conv);
22546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22547 LDKReplyShortChannelIdsEnd this_ptr_conv;
22548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22549 this_ptr_conv.is_owned = false;
22550 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22551 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
22555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22556 LDKReplyShortChannelIdsEnd this_ptr_conv;
22557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22558 this_ptr_conv.is_owned = false;
22559 LDKThirtyTwoBytes val_ref;
22560 CHECK((*env)->GetArrayLength(env, val) == 32);
22561 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22562 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
22565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
22566 LDKReplyShortChannelIdsEnd this_ptr_conv;
22567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22568 this_ptr_conv.is_owned = false;
22569 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
22573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22574 LDKReplyShortChannelIdsEnd this_ptr_conv;
22575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22576 this_ptr_conv.is_owned = false;
22577 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
22580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
22581 LDKThirtyTwoBytes chain_hash_arg_ref;
22582 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22583 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22584 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
22585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22587 uint64_t ret_ref = (uint64_t)ret_var.inner;
22588 if (ret_var.is_owned) {
22594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22595 LDKReplyShortChannelIdsEnd orig_conv;
22596 orig_conv.inner = (void*)(orig & (~1));
22597 orig_conv.is_owned = false;
22598 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
22599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22601 uint64_t ret_ref = (uint64_t)ret_var.inner;
22602 if (ret_var.is_owned) {
22608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22609 LDKGossipTimestampFilter this_obj_conv;
22610 this_obj_conv.inner = (void*)(this_obj & (~1));
22611 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22612 GossipTimestampFilter_free(this_obj_conv);
22615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22616 LDKGossipTimestampFilter this_ptr_conv;
22617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22618 this_ptr_conv.is_owned = false;
22619 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22620 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
22624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22625 LDKGossipTimestampFilter this_ptr_conv;
22626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22627 this_ptr_conv.is_owned = false;
22628 LDKThirtyTwoBytes val_ref;
22629 CHECK((*env)->GetArrayLength(env, val) == 32);
22630 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22631 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
22634 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
22635 LDKGossipTimestampFilter this_ptr_conv;
22636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22637 this_ptr_conv.is_owned = false;
22638 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
22642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22643 LDKGossipTimestampFilter this_ptr_conv;
22644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22645 this_ptr_conv.is_owned = false;
22646 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
22649 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
22650 LDKGossipTimestampFilter this_ptr_conv;
22651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22652 this_ptr_conv.is_owned = false;
22653 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
22657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22658 LDKGossipTimestampFilter this_ptr_conv;
22659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22660 this_ptr_conv.is_owned = false;
22661 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
22664 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) {
22665 LDKThirtyTwoBytes chain_hash_arg_ref;
22666 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
22667 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
22668 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
22669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22671 uint64_t ret_ref = (uint64_t)ret_var.inner;
22672 if (ret_var.is_owned) {
22678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22679 LDKGossipTimestampFilter orig_conv;
22680 orig_conv.inner = (void*)(orig & (~1));
22681 orig_conv.is_owned = false;
22682 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
22683 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22684 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22685 uint64_t ret_ref = (uint64_t)ret_var.inner;
22686 if (ret_var.is_owned) {
22692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22693 if ((this_ptr & 1) != 0) return;
22694 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
22695 FREE((void*)this_ptr);
22696 ErrorAction_free(this_ptr_conv);
22699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22700 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
22701 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22702 *ret_copy = ErrorAction_clone(orig_conv);
22703 uint64_t ret_ref = (uint64_t)ret_copy;
22707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
22708 LDKErrorMessage msg_conv;
22709 msg_conv.inner = (void*)(msg & (~1));
22710 msg_conv.is_owned = (msg & 1) || (msg == 0);
22711 msg_conv = ErrorMessage_clone(&msg_conv);
22712 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22713 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
22714 uint64_t ret_ref = (uint64_t)ret_copy;
22718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
22719 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22720 *ret_copy = ErrorAction_ignore_error();
22721 uint64_t ret_ref = (uint64_t)ret_copy;
22725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
22726 LDKLevel a_conv = LDKLevel_from_java(env, a);
22727 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22728 *ret_copy = ErrorAction_ignore_and_log(a_conv);
22729 uint64_t ret_ref = (uint64_t)ret_copy;
22733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
22734 LDKErrorMessage msg_conv;
22735 msg_conv.inner = (void*)(msg & (~1));
22736 msg_conv.is_owned = (msg & 1) || (msg == 0);
22737 msg_conv = ErrorMessage_clone(&msg_conv);
22738 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22739 *ret_copy = ErrorAction_send_error_message(msg_conv);
22740 uint64_t ret_ref = (uint64_t)ret_copy;
22744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22745 LDKLightningError this_obj_conv;
22746 this_obj_conv.inner = (void*)(this_obj & (~1));
22747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22748 LightningError_free(this_obj_conv);
22751 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
22752 LDKLightningError this_ptr_conv;
22753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22754 this_ptr_conv.is_owned = false;
22755 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
22756 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
22761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
22762 LDKLightningError this_ptr_conv;
22763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22764 this_ptr_conv.is_owned = false;
22765 LDKStr val_conv = java_to_owned_str(env, val);
22766 LightningError_set_err(&this_ptr_conv, val_conv);
22769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
22770 LDKLightningError this_ptr_conv;
22771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22772 this_ptr_conv.is_owned = false;
22773 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
22774 *ret_copy = LightningError_get_action(&this_ptr_conv);
22775 uint64_t ret_ref = (uint64_t)ret_copy;
22779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22780 LDKLightningError this_ptr_conv;
22781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22782 this_ptr_conv.is_owned = false;
22783 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
22784 val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
22785 LightningError_set_action(&this_ptr_conv, val_conv);
22788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
22789 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
22790 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
22791 action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
22792 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
22793 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22794 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22795 uint64_t ret_ref = (uint64_t)ret_var.inner;
22796 if (ret_var.is_owned) {
22802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22803 LDKLightningError orig_conv;
22804 orig_conv.inner = (void*)(orig & (~1));
22805 orig_conv.is_owned = false;
22806 LDKLightningError ret_var = LightningError_clone(&orig_conv);
22807 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22808 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22809 uint64_t ret_ref = (uint64_t)ret_var.inner;
22810 if (ret_var.is_owned) {
22816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22817 LDKCommitmentUpdate this_obj_conv;
22818 this_obj_conv.inner = (void*)(this_obj & (~1));
22819 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22820 CommitmentUpdate_free(this_obj_conv);
22823 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22824 LDKCommitmentUpdate this_ptr_conv;
22825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22826 this_ptr_conv.is_owned = false;
22827 LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
22828 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22829 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22830 for (size_t p = 0; p < ret_var.datalen; p++) {
22831 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
22832 CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22833 CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22834 uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
22835 if (ret_conv_15_var.is_owned) {
22836 ret_conv_15_ref |= 1;
22838 ret_arr_ptr[p] = ret_conv_15_ref;
22840 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22841 FREE(ret_var.data);
22845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22846 LDKCommitmentUpdate this_ptr_conv;
22847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22848 this_ptr_conv.is_owned = false;
22849 LDKCVec_UpdateAddHTLCZ val_constr;
22850 val_constr.datalen = (*env)->GetArrayLength(env, val);
22851 if (val_constr.datalen > 0)
22852 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
22854 val_constr.data = NULL;
22855 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22856 for (size_t p = 0; p < val_constr.datalen; p++) {
22857 int64_t val_conv_15 = val_vals[p];
22858 LDKUpdateAddHTLC val_conv_15_conv;
22859 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
22860 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
22861 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
22862 val_constr.data[p] = val_conv_15_conv;
22864 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22865 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
22868 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22869 LDKCommitmentUpdate this_ptr_conv;
22870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22871 this_ptr_conv.is_owned = false;
22872 LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
22873 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22874 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22875 for (size_t t = 0; t < ret_var.datalen; t++) {
22876 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
22877 CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22878 CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22879 uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
22880 if (ret_conv_19_var.is_owned) {
22881 ret_conv_19_ref |= 1;
22883 ret_arr_ptr[t] = ret_conv_19_ref;
22885 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22886 FREE(ret_var.data);
22890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22891 LDKCommitmentUpdate this_ptr_conv;
22892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22893 this_ptr_conv.is_owned = false;
22894 LDKCVec_UpdateFulfillHTLCZ val_constr;
22895 val_constr.datalen = (*env)->GetArrayLength(env, val);
22896 if (val_constr.datalen > 0)
22897 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
22899 val_constr.data = NULL;
22900 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22901 for (size_t t = 0; t < val_constr.datalen; t++) {
22902 int64_t val_conv_19 = val_vals[t];
22903 LDKUpdateFulfillHTLC val_conv_19_conv;
22904 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
22905 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
22906 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
22907 val_constr.data[t] = val_conv_19_conv;
22909 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22910 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
22913 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22914 LDKCommitmentUpdate this_ptr_conv;
22915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22916 this_ptr_conv.is_owned = false;
22917 LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
22918 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22919 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22920 for (size_t q = 0; q < ret_var.datalen; q++) {
22921 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
22922 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22923 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22924 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
22925 if (ret_conv_16_var.is_owned) {
22926 ret_conv_16_ref |= 1;
22928 ret_arr_ptr[q] = ret_conv_16_ref;
22930 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22931 FREE(ret_var.data);
22935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
22936 LDKCommitmentUpdate this_ptr_conv;
22937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22938 this_ptr_conv.is_owned = false;
22939 LDKCVec_UpdateFailHTLCZ val_constr;
22940 val_constr.datalen = (*env)->GetArrayLength(env, val);
22941 if (val_constr.datalen > 0)
22942 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
22944 val_constr.data = NULL;
22945 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22946 for (size_t q = 0; q < val_constr.datalen; q++) {
22947 int64_t val_conv_16 = val_vals[q];
22948 LDKUpdateFailHTLC val_conv_16_conv;
22949 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
22950 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
22951 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
22952 val_constr.data[q] = val_conv_16_conv;
22954 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
22955 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
22958 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
22959 LDKCommitmentUpdate this_ptr_conv;
22960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22961 this_ptr_conv.is_owned = false;
22962 LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
22963 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22964 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22965 for (size_t z = 0; z < ret_var.datalen; z++) {
22966 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
22967 CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22968 CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22969 uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
22970 if (ret_conv_25_var.is_owned) {
22971 ret_conv_25_ref |= 1;
22973 ret_arr_ptr[z] = ret_conv_25_ref;
22975 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22976 FREE(ret_var.data);
22980 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) {
22981 LDKCommitmentUpdate this_ptr_conv;
22982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22983 this_ptr_conv.is_owned = false;
22984 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
22985 val_constr.datalen = (*env)->GetArrayLength(env, val);
22986 if (val_constr.datalen > 0)
22987 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
22989 val_constr.data = NULL;
22990 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
22991 for (size_t z = 0; z < val_constr.datalen; z++) {
22992 int64_t val_conv_25 = val_vals[z];
22993 LDKUpdateFailMalformedHTLC val_conv_25_conv;
22994 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
22995 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
22996 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
22997 val_constr.data[z] = val_conv_25_conv;
22999 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23000 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
23003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
23004 LDKCommitmentUpdate this_ptr_conv;
23005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23006 this_ptr_conv.is_owned = false;
23007 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
23008 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23009 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23010 uint64_t ret_ref = (uint64_t)ret_var.inner;
23011 if (ret_var.is_owned) {
23017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23018 LDKCommitmentUpdate this_ptr_conv;
23019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23020 this_ptr_conv.is_owned = false;
23021 LDKUpdateFee val_conv;
23022 val_conv.inner = (void*)(val & (~1));
23023 val_conv.is_owned = (val & 1) || (val == 0);
23024 val_conv = UpdateFee_clone(&val_conv);
23025 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
23028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
23029 LDKCommitmentUpdate this_ptr_conv;
23030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23031 this_ptr_conv.is_owned = false;
23032 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
23033 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23034 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23035 uint64_t ret_ref = (uint64_t)ret_var.inner;
23036 if (ret_var.is_owned) {
23042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23043 LDKCommitmentUpdate this_ptr_conv;
23044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23045 this_ptr_conv.is_owned = false;
23046 LDKCommitmentSigned val_conv;
23047 val_conv.inner = (void*)(val & (~1));
23048 val_conv.is_owned = (val & 1) || (val == 0);
23049 val_conv = CommitmentSigned_clone(&val_conv);
23050 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
23053 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) {
23054 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
23055 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
23056 if (update_add_htlcs_arg_constr.datalen > 0)
23057 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23059 update_add_htlcs_arg_constr.data = NULL;
23060 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
23061 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
23062 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
23063 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
23064 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
23065 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
23066 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
23067 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
23069 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
23070 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
23071 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
23072 if (update_fulfill_htlcs_arg_constr.datalen > 0)
23073 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23075 update_fulfill_htlcs_arg_constr.data = NULL;
23076 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
23077 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
23078 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
23079 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
23080 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
23081 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
23082 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
23083 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
23085 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
23086 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
23087 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
23088 if (update_fail_htlcs_arg_constr.datalen > 0)
23089 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23091 update_fail_htlcs_arg_constr.data = NULL;
23092 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
23093 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
23094 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
23095 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
23096 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
23097 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
23098 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
23099 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
23101 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
23102 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
23103 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
23104 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
23105 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
23107 update_fail_malformed_htlcs_arg_constr.data = NULL;
23108 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
23109 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
23110 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
23111 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
23112 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
23113 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);
23114 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
23115 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
23117 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
23118 LDKUpdateFee update_fee_arg_conv;
23119 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
23120 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
23121 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
23122 LDKCommitmentSigned commitment_signed_arg_conv;
23123 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
23124 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
23125 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
23126 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);
23127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23129 uint64_t ret_ref = (uint64_t)ret_var.inner;
23130 if (ret_var.is_owned) {
23136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23137 LDKCommitmentUpdate orig_conv;
23138 orig_conv.inner = (void*)(orig & (~1));
23139 orig_conv.is_owned = false;
23140 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
23141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23143 uint64_t ret_ref = (uint64_t)ret_var.inner;
23144 if (ret_var.is_owned) {
23150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23151 if ((this_ptr & 1) != 0) return;
23152 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
23153 FREE((void*)this_ptr);
23154 ChannelMessageHandler_free(this_ptr_conv);
23157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23158 if ((this_ptr & 1) != 0) return;
23159 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
23160 FREE((void*)this_ptr);
23161 RoutingMessageHandler_free(this_ptr_conv);
23164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23165 LDKAcceptChannel obj_conv;
23166 obj_conv.inner = (void*)(obj & (~1));
23167 obj_conv.is_owned = false;
23168 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
23169 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23170 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23171 CVec_u8Z_free(ret_var);
23175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23176 LDKu8slice ser_ref;
23177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23179 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
23180 *ret_conv = AcceptChannel_read(ser_ref);
23181 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23182 return (uint64_t)ret_conv;
23185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23186 LDKAnnouncementSignatures obj_conv;
23187 obj_conv.inner = (void*)(obj & (~1));
23188 obj_conv.is_owned = false;
23189 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
23190 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23191 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23192 CVec_u8Z_free(ret_var);
23196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23197 LDKu8slice ser_ref;
23198 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23199 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23200 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
23201 *ret_conv = AnnouncementSignatures_read(ser_ref);
23202 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23203 return (uint64_t)ret_conv;
23206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
23207 LDKChannelReestablish obj_conv;
23208 obj_conv.inner = (void*)(obj & (~1));
23209 obj_conv.is_owned = false;
23210 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
23211 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23212 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23213 CVec_u8Z_free(ret_var);
23217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23218 LDKu8slice ser_ref;
23219 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23220 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23221 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
23222 *ret_conv = ChannelReestablish_read(ser_ref);
23223 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23224 return (uint64_t)ret_conv;
23227 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23228 LDKClosingSigned obj_conv;
23229 obj_conv.inner = (void*)(obj & (~1));
23230 obj_conv.is_owned = false;
23231 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
23232 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23233 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23234 CVec_u8Z_free(ret_var);
23238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23239 LDKu8slice ser_ref;
23240 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23241 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23242 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
23243 *ret_conv = ClosingSigned_read(ser_ref);
23244 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23245 return (uint64_t)ret_conv;
23248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23249 LDKClosingSignedFeeRange obj_conv;
23250 obj_conv.inner = (void*)(obj & (~1));
23251 obj_conv.is_owned = false;
23252 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
23253 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23254 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23255 CVec_u8Z_free(ret_var);
23259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23260 LDKu8slice ser_ref;
23261 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23262 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23263 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
23264 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
23265 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23266 return (uint64_t)ret_conv;
23269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23270 LDKCommitmentSigned obj_conv;
23271 obj_conv.inner = (void*)(obj & (~1));
23272 obj_conv.is_owned = false;
23273 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
23274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23276 CVec_u8Z_free(ret_var);
23280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23281 LDKu8slice ser_ref;
23282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23284 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
23285 *ret_conv = CommitmentSigned_read(ser_ref);
23286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23287 return (uint64_t)ret_conv;
23290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
23291 LDKFundingCreated obj_conv;
23292 obj_conv.inner = (void*)(obj & (~1));
23293 obj_conv.is_owned = false;
23294 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
23295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23297 CVec_u8Z_free(ret_var);
23301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23302 LDKu8slice ser_ref;
23303 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23304 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23305 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
23306 *ret_conv = FundingCreated_read(ser_ref);
23307 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23308 return (uint64_t)ret_conv;
23311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
23312 LDKFundingSigned obj_conv;
23313 obj_conv.inner = (void*)(obj & (~1));
23314 obj_conv.is_owned = false;
23315 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
23316 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23317 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23318 CVec_u8Z_free(ret_var);
23322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23323 LDKu8slice ser_ref;
23324 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23325 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23326 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
23327 *ret_conv = FundingSigned_read(ser_ref);
23328 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23329 return (uint64_t)ret_conv;
23332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
23333 LDKFundingLocked obj_conv;
23334 obj_conv.inner = (void*)(obj & (~1));
23335 obj_conv.is_owned = false;
23336 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
23337 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23338 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23339 CVec_u8Z_free(ret_var);
23343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23344 LDKu8slice ser_ref;
23345 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23346 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23347 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
23348 *ret_conv = FundingLocked_read(ser_ref);
23349 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23350 return (uint64_t)ret_conv;
23353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
23355 obj_conv.inner = (void*)(obj & (~1));
23356 obj_conv.is_owned = false;
23357 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
23358 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23359 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23360 CVec_u8Z_free(ret_var);
23364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23365 LDKu8slice ser_ref;
23366 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23367 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23368 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
23369 *ret_conv = Init_read(ser_ref);
23370 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23371 return (uint64_t)ret_conv;
23374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
23375 LDKOpenChannel obj_conv;
23376 obj_conv.inner = (void*)(obj & (~1));
23377 obj_conv.is_owned = false;
23378 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
23379 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23380 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23381 CVec_u8Z_free(ret_var);
23385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23386 LDKu8slice ser_ref;
23387 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23388 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23389 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
23390 *ret_conv = OpenChannel_read(ser_ref);
23391 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23392 return (uint64_t)ret_conv;
23395 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
23396 LDKRevokeAndACK obj_conv;
23397 obj_conv.inner = (void*)(obj & (~1));
23398 obj_conv.is_owned = false;
23399 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
23400 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23401 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23402 CVec_u8Z_free(ret_var);
23406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23407 LDKu8slice ser_ref;
23408 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23409 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23410 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
23411 *ret_conv = RevokeAndACK_read(ser_ref);
23412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23413 return (uint64_t)ret_conv;
23416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
23417 LDKShutdown obj_conv;
23418 obj_conv.inner = (void*)(obj & (~1));
23419 obj_conv.is_owned = false;
23420 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
23421 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23422 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23423 CVec_u8Z_free(ret_var);
23427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23428 LDKu8slice ser_ref;
23429 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23430 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23431 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
23432 *ret_conv = Shutdown_read(ser_ref);
23433 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23434 return (uint64_t)ret_conv;
23437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23438 LDKUpdateFailHTLC obj_conv;
23439 obj_conv.inner = (void*)(obj & (~1));
23440 obj_conv.is_owned = false;
23441 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
23442 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23443 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23444 CVec_u8Z_free(ret_var);
23448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23449 LDKu8slice ser_ref;
23450 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23451 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23452 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
23453 *ret_conv = UpdateFailHTLC_read(ser_ref);
23454 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23455 return (uint64_t)ret_conv;
23458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23459 LDKUpdateFailMalformedHTLC obj_conv;
23460 obj_conv.inner = (void*)(obj & (~1));
23461 obj_conv.is_owned = false;
23462 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
23463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23465 CVec_u8Z_free(ret_var);
23469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23470 LDKu8slice ser_ref;
23471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23473 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
23474 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
23475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23476 return (uint64_t)ret_conv;
23479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
23480 LDKUpdateFee obj_conv;
23481 obj_conv.inner = (void*)(obj & (~1));
23482 obj_conv.is_owned = false;
23483 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
23484 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23485 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23486 CVec_u8Z_free(ret_var);
23490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23491 LDKu8slice ser_ref;
23492 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23493 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23494 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
23495 *ret_conv = UpdateFee_read(ser_ref);
23496 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23497 return (uint64_t)ret_conv;
23500 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23501 LDKUpdateFulfillHTLC obj_conv;
23502 obj_conv.inner = (void*)(obj & (~1));
23503 obj_conv.is_owned = false;
23504 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
23505 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23506 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23507 CVec_u8Z_free(ret_var);
23511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23512 LDKu8slice ser_ref;
23513 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23514 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23515 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
23516 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
23517 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23518 return (uint64_t)ret_conv;
23521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
23522 LDKUpdateAddHTLC obj_conv;
23523 obj_conv.inner = (void*)(obj & (~1));
23524 obj_conv.is_owned = false;
23525 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
23526 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23527 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23528 CVec_u8Z_free(ret_var);
23532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23533 LDKu8slice ser_ref;
23534 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23535 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23536 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
23537 *ret_conv = UpdateAddHTLC_read(ser_ref);
23538 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23539 return (uint64_t)ret_conv;
23542 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
23544 obj_conv.inner = (void*)(obj & (~1));
23545 obj_conv.is_owned = false;
23546 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
23547 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23548 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23549 CVec_u8Z_free(ret_var);
23553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23554 LDKu8slice ser_ref;
23555 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23556 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23557 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
23558 *ret_conv = Ping_read(ser_ref);
23559 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23560 return (uint64_t)ret_conv;
23563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
23565 obj_conv.inner = (void*)(obj & (~1));
23566 obj_conv.is_owned = false;
23567 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
23568 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23569 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23570 CVec_u8Z_free(ret_var);
23574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23575 LDKu8slice ser_ref;
23576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23578 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
23579 *ret_conv = Pong_read(ser_ref);
23580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23581 return (uint64_t)ret_conv;
23584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23585 LDKUnsignedChannelAnnouncement obj_conv;
23586 obj_conv.inner = (void*)(obj & (~1));
23587 obj_conv.is_owned = false;
23588 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
23589 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23590 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23591 CVec_u8Z_free(ret_var);
23595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23596 LDKu8slice ser_ref;
23597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23599 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
23600 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
23601 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23602 return (uint64_t)ret_conv;
23605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23606 LDKChannelAnnouncement obj_conv;
23607 obj_conv.inner = (void*)(obj & (~1));
23608 obj_conv.is_owned = false;
23609 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
23610 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23611 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23612 CVec_u8Z_free(ret_var);
23616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23617 LDKu8slice ser_ref;
23618 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23619 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23620 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
23621 *ret_conv = ChannelAnnouncement_read(ser_ref);
23622 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23623 return (uint64_t)ret_conv;
23626 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23627 LDKUnsignedChannelUpdate obj_conv;
23628 obj_conv.inner = (void*)(obj & (~1));
23629 obj_conv.is_owned = false;
23630 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
23631 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23632 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23633 CVec_u8Z_free(ret_var);
23637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23638 LDKu8slice ser_ref;
23639 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23640 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23641 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
23642 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
23643 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23644 return (uint64_t)ret_conv;
23647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
23648 LDKChannelUpdate obj_conv;
23649 obj_conv.inner = (void*)(obj & (~1));
23650 obj_conv.is_owned = false;
23651 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
23652 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23653 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23654 CVec_u8Z_free(ret_var);
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23659 LDKu8slice ser_ref;
23660 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23661 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23662 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
23663 *ret_conv = ChannelUpdate_read(ser_ref);
23664 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23665 return (uint64_t)ret_conv;
23668 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
23669 LDKErrorMessage obj_conv;
23670 obj_conv.inner = (void*)(obj & (~1));
23671 obj_conv.is_owned = false;
23672 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
23673 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23674 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23675 CVec_u8Z_free(ret_var);
23679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23680 LDKu8slice ser_ref;
23681 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23682 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23683 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
23684 *ret_conv = ErrorMessage_read(ser_ref);
23685 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23686 return (uint64_t)ret_conv;
23689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23690 LDKUnsignedNodeAnnouncement obj_conv;
23691 obj_conv.inner = (void*)(obj & (~1));
23692 obj_conv.is_owned = false;
23693 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
23694 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23695 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23696 CVec_u8Z_free(ret_var);
23700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23701 LDKu8slice ser_ref;
23702 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23703 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23704 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
23705 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
23706 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23707 return (uint64_t)ret_conv;
23710 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
23711 LDKNodeAnnouncement obj_conv;
23712 obj_conv.inner = (void*)(obj & (~1));
23713 obj_conv.is_owned = false;
23714 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
23715 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23716 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23717 CVec_u8Z_free(ret_var);
23721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23722 LDKu8slice ser_ref;
23723 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23724 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23725 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
23726 *ret_conv = NodeAnnouncement_read(ser_ref);
23727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23728 return (uint64_t)ret_conv;
23731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23732 LDKu8slice ser_ref;
23733 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23734 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23735 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
23736 *ret_conv = QueryShortChannelIds_read(ser_ref);
23737 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23738 return (uint64_t)ret_conv;
23741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
23742 LDKQueryShortChannelIds obj_conv;
23743 obj_conv.inner = (void*)(obj & (~1));
23744 obj_conv.is_owned = false;
23745 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
23746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23748 CVec_u8Z_free(ret_var);
23752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
23753 LDKReplyShortChannelIdsEnd obj_conv;
23754 obj_conv.inner = (void*)(obj & (~1));
23755 obj_conv.is_owned = false;
23756 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
23757 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23758 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23759 CVec_u8Z_free(ret_var);
23763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23764 LDKu8slice ser_ref;
23765 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23766 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23767 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
23768 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
23769 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23770 return (uint64_t)ret_conv;
23773 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
23774 LDKQueryChannelRange this_arg_conv;
23775 this_arg_conv.inner = (void*)(this_arg & (~1));
23776 this_arg_conv.is_owned = false;
23777 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
23781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23782 LDKQueryChannelRange obj_conv;
23783 obj_conv.inner = (void*)(obj & (~1));
23784 obj_conv.is_owned = false;
23785 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
23786 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23787 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23788 CVec_u8Z_free(ret_var);
23792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23793 LDKu8slice ser_ref;
23794 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23795 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23796 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
23797 *ret_conv = QueryChannelRange_read(ser_ref);
23798 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23799 return (uint64_t)ret_conv;
23802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23803 LDKu8slice ser_ref;
23804 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23805 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23806 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
23807 *ret_conv = ReplyChannelRange_read(ser_ref);
23808 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23809 return (uint64_t)ret_conv;
23812 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
23813 LDKReplyChannelRange obj_conv;
23814 obj_conv.inner = (void*)(obj & (~1));
23815 obj_conv.is_owned = false;
23816 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
23817 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23818 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23819 CVec_u8Z_free(ret_var);
23823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
23824 LDKGossipTimestampFilter obj_conv;
23825 obj_conv.inner = (void*)(obj & (~1));
23826 obj_conv.is_owned = false;
23827 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
23828 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23829 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23830 CVec_u8Z_free(ret_var);
23834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23835 LDKu8slice ser_ref;
23836 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23837 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23838 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
23839 *ret_conv = GossipTimestampFilter_read(ser_ref);
23840 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23841 return (uint64_t)ret_conv;
23844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
23845 if ((this_ptr & 1) != 0) return;
23846 LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
23847 FREE((void*)this_ptr);
23848 CustomMessageHandler_free(this_ptr_conv);
23851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23852 LDKIgnoringMessageHandler this_obj_conv;
23853 this_obj_conv.inner = (void*)(this_obj & (~1));
23854 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23855 IgnoringMessageHandler_free(this_obj_conv);
23858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
23859 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
23860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23862 uint64_t ret_ref = (uint64_t)ret_var.inner;
23863 if (ret_var.is_owned) {
23869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23870 LDKIgnoringMessageHandler this_arg_conv;
23871 this_arg_conv.inner = (void*)(this_arg & (~1));
23872 this_arg_conv.is_owned = false;
23873 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23874 *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23875 return (uint64_t)ret_ret;
23878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23879 LDKIgnoringMessageHandler this_arg_conv;
23880 this_arg_conv.inner = (void*)(this_arg & (~1));
23881 this_arg_conv.is_owned = false;
23882 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23883 *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
23884 return (uint64_t)ret_ret;
23887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
23888 LDKIgnoringMessageHandler this_arg_conv;
23889 this_arg_conv.inner = (void*)(this_arg & (~1));
23890 this_arg_conv.is_owned = false;
23891 LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
23892 *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
23893 return (uint64_t)ret_ret;
23896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23897 LDKIgnoringMessageHandler this_arg_conv;
23898 this_arg_conv.inner = (void*)(this_arg & (~1));
23899 this_arg_conv.is_owned = false;
23900 LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
23901 *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
23902 return (uint64_t)ret_ret;
23905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23906 LDKErroringMessageHandler this_obj_conv;
23907 this_obj_conv.inner = (void*)(this_obj & (~1));
23908 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23909 ErroringMessageHandler_free(this_obj_conv);
23912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
23913 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
23914 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23915 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23916 uint64_t ret_ref = (uint64_t)ret_var.inner;
23917 if (ret_var.is_owned) {
23923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23924 LDKErroringMessageHandler this_arg_conv;
23925 this_arg_conv.inner = (void*)(this_arg & (~1));
23926 this_arg_conv.is_owned = false;
23927 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23928 *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
23929 return (uint64_t)ret_ret;
23932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23933 LDKErroringMessageHandler this_arg_conv;
23934 this_arg_conv.inner = (void*)(this_arg & (~1));
23935 this_arg_conv.is_owned = false;
23936 LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
23937 *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
23938 return (uint64_t)ret_ret;
23941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23942 LDKMessageHandler this_obj_conv;
23943 this_obj_conv.inner = (void*)(this_obj & (~1));
23944 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23945 MessageHandler_free(this_obj_conv);
23948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
23949 LDKMessageHandler this_ptr_conv;
23950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23951 this_ptr_conv.is_owned = false;
23952 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
23956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23957 LDKMessageHandler this_ptr_conv;
23958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23959 this_ptr_conv.is_owned = false;
23960 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
23961 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
23962 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23963 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
23965 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
23968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
23969 LDKMessageHandler this_ptr_conv;
23970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23971 this_ptr_conv.is_owned = false;
23972 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
23976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23977 LDKMessageHandler this_ptr_conv;
23978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23979 this_ptr_conv.is_owned = false;
23980 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
23981 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
23982 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23983 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
23985 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
23988 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) {
23989 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
23990 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
23991 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23992 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
23994 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
23995 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
23996 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23997 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
23999 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
24000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24002 uint64_t ret_ref = (uint64_t)ret_var.inner;
24003 if (ret_var.is_owned) {
24009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24010 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
24011 LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
24012 *ret_ret = SocketDescriptor_clone(orig_conv);
24013 return (uint64_t)ret_ret;
24016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24017 if ((this_ptr & 1) != 0) return;
24018 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
24019 FREE((void*)this_ptr);
24020 SocketDescriptor_free(this_ptr_conv);
24023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24024 LDKPeerHandleError this_obj_conv;
24025 this_obj_conv.inner = (void*)(this_obj & (~1));
24026 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24027 PeerHandleError_free(this_obj_conv);
24030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
24031 LDKPeerHandleError this_ptr_conv;
24032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24033 this_ptr_conv.is_owned = false;
24034 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
24038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24039 LDKPeerHandleError this_ptr_conv;
24040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24041 this_ptr_conv.is_owned = false;
24042 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
24045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
24046 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
24047 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24048 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24049 uint64_t ret_ref = (uint64_t)ret_var.inner;
24050 if (ret_var.is_owned) {
24056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24057 LDKPeerHandleError orig_conv;
24058 orig_conv.inner = (void*)(orig & (~1));
24059 orig_conv.is_owned = false;
24060 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
24061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24063 uint64_t ret_ref = (uint64_t)ret_var.inner;
24064 if (ret_var.is_owned) {
24070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24071 LDKPeerManager 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 PeerManager_free(this_obj_conv);
24077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
24078 LDKMessageHandler message_handler_conv;
24079 message_handler_conv.inner = (void*)(message_handler & (~1));
24080 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
24081 // Warning: we need a move here but no clone is available for LDKMessageHandler
24082 LDKSecretKey our_node_secret_ref;
24083 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
24084 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
24085 unsigned char ephemeral_random_data_arr[32];
24086 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
24087 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
24088 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
24089 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24090 if (logger_conv.free == LDKLogger_JCalls_free) {
24091 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24092 LDKLogger_JCalls_cloned(&logger_conv);
24094 LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
24095 if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
24096 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24097 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
24099 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
24100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24102 uint64_t ret_ref = (uint64_t)ret_var.inner;
24103 if (ret_var.is_owned) {
24109 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
24110 LDKPeerManager this_arg_conv;
24111 this_arg_conv.inner = (void*)(this_arg & (~1));
24112 this_arg_conv.is_owned = false;
24113 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
24114 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
24116 for (size_t i = 0; i < ret_var.datalen; i++) {
24117 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
24118 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
24119 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
24121 FREE(ret_var.data);
24125 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) {
24126 LDKPeerManager this_arg_conv;
24127 this_arg_conv.inner = (void*)(this_arg & (~1));
24128 this_arg_conv.is_owned = false;
24129 LDKPublicKey their_node_id_ref;
24130 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
24131 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
24132 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24133 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24134 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24135 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24137 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
24138 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
24139 return (uint64_t)ret_conv;
24142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24143 LDKPeerManager this_arg_conv;
24144 this_arg_conv.inner = (void*)(this_arg & (~1));
24145 this_arg_conv.is_owned = false;
24146 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24147 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
24148 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24149 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
24151 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24152 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
24153 return (uint64_t)ret_conv;
24156 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) {
24157 LDKPeerManager this_arg_conv;
24158 this_arg_conv.inner = (void*)(this_arg & (~1));
24159 this_arg_conv.is_owned = false;
24160 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24161 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
24162 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
24163 return (uint64_t)ret_conv;
24166 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) {
24167 LDKPeerManager this_arg_conv;
24168 this_arg_conv.inner = (void*)(this_arg & (~1));
24169 this_arg_conv.is_owned = false;
24170 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
24171 LDKu8slice data_ref;
24172 data_ref.datalen = (*env)->GetArrayLength(env, data);
24173 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
24174 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
24175 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
24176 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
24177 return (uint64_t)ret_conv;
24180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
24181 LDKPeerManager this_arg_conv;
24182 this_arg_conv.inner = (void*)(this_arg & (~1));
24183 this_arg_conv.is_owned = false;
24184 PeerManager_process_events(&this_arg_conv);
24187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
24188 LDKPeerManager this_arg_conv;
24189 this_arg_conv.inner = (void*)(this_arg & (~1));
24190 this_arg_conv.is_owned = false;
24191 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
24192 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
24195 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) {
24196 LDKPeerManager this_arg_conv;
24197 this_arg_conv.inner = (void*)(this_arg & (~1));
24198 this_arg_conv.is_owned = false;
24199 LDKPublicKey node_id_ref;
24200 CHECK((*env)->GetArrayLength(env, node_id) == 33);
24201 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
24202 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
24205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
24206 LDKPeerManager this_arg_conv;
24207 this_arg_conv.inner = (void*)(this_arg & (~1));
24208 this_arg_conv.is_owned = false;
24209 PeerManager_timer_tick_occurred(&this_arg_conv);
24212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
24213 unsigned char commitment_seed_arr[32];
24214 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
24215 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
24216 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
24217 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
24222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
24223 LDKCVec_u8Z to_holder_script_ref;
24224 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
24225 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
24226 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
24227 LDKCVec_u8Z to_counterparty_script_ref;
24228 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
24229 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
24230 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
24231 LDKOutPoint funding_outpoint_conv;
24232 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
24233 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
24234 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
24235 LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
24236 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24237 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24238 Transaction_free(ret_var);
24242 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) {
24243 LDKPublicKey per_commitment_point_ref;
24244 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24245 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24246 unsigned char base_secret_arr[32];
24247 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
24248 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
24249 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
24250 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24251 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
24252 return (uint64_t)ret_conv;
24255 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) {
24256 LDKPublicKey per_commitment_point_ref;
24257 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24258 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24259 LDKPublicKey base_point_ref;
24260 CHECK((*env)->GetArrayLength(env, base_point) == 33);
24261 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
24262 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24263 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
24264 return (uint64_t)ret_conv;
24267 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) {
24268 unsigned char per_commitment_secret_arr[32];
24269 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
24270 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
24271 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
24272 unsigned char countersignatory_revocation_base_secret_arr[32];
24273 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
24274 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
24275 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
24276 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
24277 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
24278 return (uint64_t)ret_conv;
24281 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) {
24282 LDKPublicKey per_commitment_point_ref;
24283 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24284 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24285 LDKPublicKey countersignatory_revocation_base_point_ref;
24286 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
24287 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
24288 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
24289 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
24290 return (uint64_t)ret_conv;
24293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24294 LDKTxCreationKeys this_obj_conv;
24295 this_obj_conv.inner = (void*)(this_obj & (~1));
24296 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24297 TxCreationKeys_free(this_obj_conv);
24300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24301 LDKTxCreationKeys this_ptr_conv;
24302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24303 this_ptr_conv.is_owned = false;
24304 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24305 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
24309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24310 LDKTxCreationKeys this_ptr_conv;
24311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24312 this_ptr_conv.is_owned = false;
24313 LDKPublicKey val_ref;
24314 CHECK((*env)->GetArrayLength(env, val) == 33);
24315 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24316 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
24319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24320 LDKTxCreationKeys this_ptr_conv;
24321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24322 this_ptr_conv.is_owned = false;
24323 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
24328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24329 LDKTxCreationKeys this_ptr_conv;
24330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24331 this_ptr_conv.is_owned = false;
24332 LDKPublicKey val_ref;
24333 CHECK((*env)->GetArrayLength(env, val) == 33);
24334 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24335 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
24338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24339 LDKTxCreationKeys this_ptr_conv;
24340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24341 this_ptr_conv.is_owned = false;
24342 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24343 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
24347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24348 LDKTxCreationKeys this_ptr_conv;
24349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24350 this_ptr_conv.is_owned = false;
24351 LDKPublicKey val_ref;
24352 CHECK((*env)->GetArrayLength(env, val) == 33);
24353 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24354 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
24357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24358 LDKTxCreationKeys this_ptr_conv;
24359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24360 this_ptr_conv.is_owned = false;
24361 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
24366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24367 LDKTxCreationKeys this_ptr_conv;
24368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24369 this_ptr_conv.is_owned = false;
24370 LDKPublicKey val_ref;
24371 CHECK((*env)->GetArrayLength(env, val) == 33);
24372 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24373 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
24376 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
24377 LDKTxCreationKeys this_ptr_conv;
24378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24379 this_ptr_conv.is_owned = false;
24380 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24381 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
24385 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) {
24386 LDKTxCreationKeys this_ptr_conv;
24387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24388 this_ptr_conv.is_owned = false;
24389 LDKPublicKey val_ref;
24390 CHECK((*env)->GetArrayLength(env, val) == 33);
24391 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24392 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
24395 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) {
24396 LDKPublicKey per_commitment_point_arg_ref;
24397 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
24398 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
24399 LDKPublicKey revocation_key_arg_ref;
24400 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
24401 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
24402 LDKPublicKey broadcaster_htlc_key_arg_ref;
24403 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
24404 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
24405 LDKPublicKey countersignatory_htlc_key_arg_ref;
24406 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
24407 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
24408 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
24409 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
24410 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
24411 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);
24412 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24413 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24414 uint64_t ret_ref = (uint64_t)ret_var.inner;
24415 if (ret_var.is_owned) {
24421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24422 LDKTxCreationKeys orig_conv;
24423 orig_conv.inner = (void*)(orig & (~1));
24424 orig_conv.is_owned = false;
24425 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
24426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24428 uint64_t ret_ref = (uint64_t)ret_var.inner;
24429 if (ret_var.is_owned) {
24435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24436 LDKTxCreationKeys obj_conv;
24437 obj_conv.inner = (void*)(obj & (~1));
24438 obj_conv.is_owned = false;
24439 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
24440 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24441 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24442 CVec_u8Z_free(ret_var);
24446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24447 LDKu8slice ser_ref;
24448 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24449 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24450 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
24451 *ret_conv = TxCreationKeys_read(ser_ref);
24452 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24453 return (uint64_t)ret_conv;
24456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24457 LDKChannelPublicKeys this_obj_conv;
24458 this_obj_conv.inner = (void*)(this_obj & (~1));
24459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24460 ChannelPublicKeys_free(this_obj_conv);
24463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24464 LDKChannelPublicKeys this_ptr_conv;
24465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24466 this_ptr_conv.is_owned = false;
24467 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
24472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24473 LDKChannelPublicKeys this_ptr_conv;
24474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24475 this_ptr_conv.is_owned = false;
24476 LDKPublicKey val_ref;
24477 CHECK((*env)->GetArrayLength(env, val) == 33);
24478 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24479 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
24482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24483 LDKChannelPublicKeys this_ptr_conv;
24484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24485 this_ptr_conv.is_owned = false;
24486 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24487 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
24491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24492 LDKChannelPublicKeys this_ptr_conv;
24493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24494 this_ptr_conv.is_owned = false;
24495 LDKPublicKey val_ref;
24496 CHECK((*env)->GetArrayLength(env, val) == 33);
24497 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24498 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
24501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
24502 LDKChannelPublicKeys this_ptr_conv;
24503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24504 this_ptr_conv.is_owned = false;
24505 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
24510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24511 LDKChannelPublicKeys this_ptr_conv;
24512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24513 this_ptr_conv.is_owned = false;
24514 LDKPublicKey val_ref;
24515 CHECK((*env)->GetArrayLength(env, val) == 33);
24516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24517 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
24520 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24521 LDKChannelPublicKeys this_ptr_conv;
24522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24523 this_ptr_conv.is_owned = false;
24524 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24525 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
24529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24530 LDKChannelPublicKeys this_ptr_conv;
24531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24532 this_ptr_conv.is_owned = false;
24533 LDKPublicKey val_ref;
24534 CHECK((*env)->GetArrayLength(env, val) == 33);
24535 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24536 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
24539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24540 LDKChannelPublicKeys this_ptr_conv;
24541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24542 this_ptr_conv.is_owned = false;
24543 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24544 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
24548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24549 LDKChannelPublicKeys this_ptr_conv;
24550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24551 this_ptr_conv.is_owned = false;
24552 LDKPublicKey val_ref;
24553 CHECK((*env)->GetArrayLength(env, val) == 33);
24554 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24555 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
24558 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) {
24559 LDKPublicKey funding_pubkey_arg_ref;
24560 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
24561 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
24562 LDKPublicKey revocation_basepoint_arg_ref;
24563 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
24564 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
24565 LDKPublicKey payment_point_arg_ref;
24566 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
24567 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
24568 LDKPublicKey delayed_payment_basepoint_arg_ref;
24569 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
24570 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
24571 LDKPublicKey htlc_basepoint_arg_ref;
24572 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
24573 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
24574 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);
24575 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24576 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24577 uint64_t ret_ref = (uint64_t)ret_var.inner;
24578 if (ret_var.is_owned) {
24584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24585 LDKChannelPublicKeys orig_conv;
24586 orig_conv.inner = (void*)(orig & (~1));
24587 orig_conv.is_owned = false;
24588 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
24589 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24590 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24591 uint64_t ret_ref = (uint64_t)ret_var.inner;
24592 if (ret_var.is_owned) {
24598 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
24599 LDKChannelPublicKeys obj_conv;
24600 obj_conv.inner = (void*)(obj & (~1));
24601 obj_conv.is_owned = false;
24602 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
24603 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24604 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24605 CVec_u8Z_free(ret_var);
24609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24610 LDKu8slice ser_ref;
24611 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24612 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24613 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
24614 *ret_conv = ChannelPublicKeys_read(ser_ref);
24615 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24616 return (uint64_t)ret_conv;
24619 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) {
24620 LDKPublicKey per_commitment_point_ref;
24621 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24622 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24623 LDKPublicKey broadcaster_delayed_payment_base_ref;
24624 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
24625 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
24626 LDKPublicKey broadcaster_htlc_base_ref;
24627 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
24628 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
24629 LDKPublicKey countersignatory_revocation_base_ref;
24630 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
24631 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
24632 LDKPublicKey countersignatory_htlc_base_ref;
24633 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
24634 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
24635 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24636 *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);
24637 return (uint64_t)ret_conv;
24640 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) {
24641 LDKPublicKey per_commitment_point_ref;
24642 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
24643 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
24644 LDKChannelPublicKeys broadcaster_keys_conv;
24645 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24646 broadcaster_keys_conv.is_owned = false;
24647 LDKChannelPublicKeys countersignatory_keys_conv;
24648 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24649 countersignatory_keys_conv.is_owned = false;
24650 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
24651 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
24652 return (uint64_t)ret_conv;
24655 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) {
24656 LDKPublicKey revocation_key_ref;
24657 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
24658 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
24659 LDKPublicKey broadcaster_delayed_payment_key_ref;
24660 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
24661 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
24662 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
24663 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24664 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24665 CVec_u8Z_free(ret_var);
24669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24670 LDKHTLCOutputInCommitment this_obj_conv;
24671 this_obj_conv.inner = (void*)(this_obj & (~1));
24672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24673 HTLCOutputInCommitment_free(this_obj_conv);
24676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
24677 LDKHTLCOutputInCommitment this_ptr_conv;
24678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24679 this_ptr_conv.is_owned = false;
24680 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
24684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24685 LDKHTLCOutputInCommitment this_ptr_conv;
24686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24687 this_ptr_conv.is_owned = false;
24688 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
24691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24692 LDKHTLCOutputInCommitment this_ptr_conv;
24693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24694 this_ptr_conv.is_owned = false;
24695 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
24699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24700 LDKHTLCOutputInCommitment this_ptr_conv;
24701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24702 this_ptr_conv.is_owned = false;
24703 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
24706 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
24707 LDKHTLCOutputInCommitment this_ptr_conv;
24708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24709 this_ptr_conv.is_owned = false;
24710 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
24714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24715 LDKHTLCOutputInCommitment this_ptr_conv;
24716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24717 this_ptr_conv.is_owned = false;
24718 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
24721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
24722 LDKHTLCOutputInCommitment this_ptr_conv;
24723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24724 this_ptr_conv.is_owned = false;
24725 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24726 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
24730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24731 LDKHTLCOutputInCommitment this_ptr_conv;
24732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24733 this_ptr_conv.is_owned = false;
24734 LDKThirtyTwoBytes val_ref;
24735 CHECK((*env)->GetArrayLength(env, val) == 32);
24736 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24737 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
24740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
24741 LDKHTLCOutputInCommitment this_ptr_conv;
24742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24743 this_ptr_conv.is_owned = false;
24744 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
24745 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
24746 uint64_t ret_ref = (uint64_t)ret_copy;
24750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24751 LDKHTLCOutputInCommitment this_ptr_conv;
24752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24753 this_ptr_conv.is_owned = false;
24754 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
24755 val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
24756 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
24759 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) {
24760 LDKThirtyTwoBytes payment_hash_arg_ref;
24761 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
24762 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
24763 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
24764 transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
24765 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
24766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24768 uint64_t ret_ref = (uint64_t)ret_var.inner;
24769 if (ret_var.is_owned) {
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24776 LDKHTLCOutputInCommitment orig_conv;
24777 orig_conv.inner = (void*)(orig & (~1));
24778 orig_conv.is_owned = false;
24779 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
24780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24782 uint64_t ret_ref = (uint64_t)ret_var.inner;
24783 if (ret_var.is_owned) {
24789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
24790 LDKHTLCOutputInCommitment obj_conv;
24791 obj_conv.inner = (void*)(obj & (~1));
24792 obj_conv.is_owned = false;
24793 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
24794 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24795 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24796 CVec_u8Z_free(ret_var);
24800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24801 LDKu8slice ser_ref;
24802 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24803 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24804 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
24805 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
24806 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24807 return (uint64_t)ret_conv;
24810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
24811 LDKHTLCOutputInCommitment htlc_conv;
24812 htlc_conv.inner = (void*)(htlc & (~1));
24813 htlc_conv.is_owned = false;
24814 LDKTxCreationKeys keys_conv;
24815 keys_conv.inner = (void*)(keys & (~1));
24816 keys_conv.is_owned = false;
24817 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
24818 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24819 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24820 CVec_u8Z_free(ret_var);
24824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
24825 LDKPublicKey broadcaster_ref;
24826 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
24827 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
24828 LDKPublicKey countersignatory_ref;
24829 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
24830 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
24831 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
24832 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24833 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24834 CVec_u8Z_free(ret_var);
24838 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) {
24839 unsigned char commitment_txid_arr[32];
24840 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
24841 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
24842 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
24843 LDKHTLCOutputInCommitment htlc_conv;
24844 htlc_conv.inner = (void*)(htlc & (~1));
24845 htlc_conv.is_owned = false;
24846 LDKPublicKey broadcaster_delayed_payment_key_ref;
24847 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
24848 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
24849 LDKPublicKey revocation_key_ref;
24850 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
24851 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
24852 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
24853 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24854 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24855 Transaction_free(ret_var);
24859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24860 LDKChannelTransactionParameters this_obj_conv;
24861 this_obj_conv.inner = (void*)(this_obj & (~1));
24862 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24863 ChannelTransactionParameters_free(this_obj_conv);
24866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
24867 LDKChannelTransactionParameters this_ptr_conv;
24868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24869 this_ptr_conv.is_owned = false;
24870 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
24871 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24872 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24873 uint64_t ret_ref = (uint64_t)ret_var.inner;
24874 if (ret_var.is_owned) {
24880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24881 LDKChannelTransactionParameters this_ptr_conv;
24882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24883 this_ptr_conv.is_owned = false;
24884 LDKChannelPublicKeys val_conv;
24885 val_conv.inner = (void*)(val & (~1));
24886 val_conv.is_owned = (val & 1) || (val == 0);
24887 val_conv = ChannelPublicKeys_clone(&val_conv);
24888 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
24891 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
24892 LDKChannelTransactionParameters this_ptr_conv;
24893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24894 this_ptr_conv.is_owned = false;
24895 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
24899 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) {
24900 LDKChannelTransactionParameters this_ptr_conv;
24901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24902 this_ptr_conv.is_owned = false;
24903 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
24906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
24907 LDKChannelTransactionParameters this_ptr_conv;
24908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24909 this_ptr_conv.is_owned = false;
24910 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
24914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24915 LDKChannelTransactionParameters this_ptr_conv;
24916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24917 this_ptr_conv.is_owned = false;
24918 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
24921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
24922 LDKChannelTransactionParameters this_ptr_conv;
24923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24924 this_ptr_conv.is_owned = false;
24925 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
24926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24928 uint64_t ret_ref = (uint64_t)ret_var.inner;
24929 if (ret_var.is_owned) {
24935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24936 LDKChannelTransactionParameters this_ptr_conv;
24937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24938 this_ptr_conv.is_owned = false;
24939 LDKCounterpartyChannelTransactionParameters val_conv;
24940 val_conv.inner = (void*)(val & (~1));
24941 val_conv.is_owned = (val & 1) || (val == 0);
24942 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
24943 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
24946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
24947 LDKChannelTransactionParameters this_ptr_conv;
24948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24949 this_ptr_conv.is_owned = false;
24950 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
24951 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24952 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24953 uint64_t ret_ref = (uint64_t)ret_var.inner;
24954 if (ret_var.is_owned) {
24960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24961 LDKChannelTransactionParameters this_ptr_conv;
24962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24963 this_ptr_conv.is_owned = false;
24964 LDKOutPoint val_conv;
24965 val_conv.inner = (void*)(val & (~1));
24966 val_conv.is_owned = (val & 1) || (val == 0);
24967 val_conv = OutPoint_clone(&val_conv);
24968 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
24971 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) {
24972 LDKChannelPublicKeys holder_pubkeys_arg_conv;
24973 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
24974 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
24975 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
24976 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
24977 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
24978 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
24979 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
24980 LDKOutPoint funding_outpoint_arg_conv;
24981 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
24982 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
24983 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
24984 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);
24985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24987 uint64_t ret_ref = (uint64_t)ret_var.inner;
24988 if (ret_var.is_owned) {
24994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24995 LDKChannelTransactionParameters orig_conv;
24996 orig_conv.inner = (void*)(orig & (~1));
24997 orig_conv.is_owned = false;
24998 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
24999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25001 uint64_t ret_ref = (uint64_t)ret_var.inner;
25002 if (ret_var.is_owned) {
25008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25009 LDKCounterpartyChannelTransactionParameters this_obj_conv;
25010 this_obj_conv.inner = (void*)(this_obj & (~1));
25011 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25012 CounterpartyChannelTransactionParameters_free(this_obj_conv);
25015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
25016 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25018 this_ptr_conv.is_owned = false;
25019 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
25020 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25021 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25022 uint64_t ret_ref = (uint64_t)ret_var.inner;
25023 if (ret_var.is_owned) {
25029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25030 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25032 this_ptr_conv.is_owned = false;
25033 LDKChannelPublicKeys val_conv;
25034 val_conv.inner = (void*)(val & (~1));
25035 val_conv.is_owned = (val & 1) || (val == 0);
25036 val_conv = ChannelPublicKeys_clone(&val_conv);
25037 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
25040 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
25041 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25043 this_ptr_conv.is_owned = false;
25044 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
25048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25049 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
25050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25051 this_ptr_conv.is_owned = false;
25052 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
25055 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) {
25056 LDKChannelPublicKeys pubkeys_arg_conv;
25057 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
25058 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
25059 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
25060 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
25061 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25062 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25063 uint64_t ret_ref = (uint64_t)ret_var.inner;
25064 if (ret_var.is_owned) {
25070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25071 LDKCounterpartyChannelTransactionParameters orig_conv;
25072 orig_conv.inner = (void*)(orig & (~1));
25073 orig_conv.is_owned = false;
25074 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
25075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25077 uint64_t ret_ref = (uint64_t)ret_var.inner;
25078 if (ret_var.is_owned) {
25084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
25085 LDKChannelTransactionParameters this_arg_conv;
25086 this_arg_conv.inner = (void*)(this_arg & (~1));
25087 this_arg_conv.is_owned = false;
25088 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
25092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25093 LDKChannelTransactionParameters this_arg_conv;
25094 this_arg_conv.inner = (void*)(this_arg & (~1));
25095 this_arg_conv.is_owned = false;
25096 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
25097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25099 uint64_t ret_ref = (uint64_t)ret_var.inner;
25100 if (ret_var.is_owned) {
25106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
25107 LDKChannelTransactionParameters this_arg_conv;
25108 this_arg_conv.inner = (void*)(this_arg & (~1));
25109 this_arg_conv.is_owned = false;
25110 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
25111 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25112 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25113 uint64_t ret_ref = (uint64_t)ret_var.inner;
25114 if (ret_var.is_owned) {
25120 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25121 LDKCounterpartyChannelTransactionParameters obj_conv;
25122 obj_conv.inner = (void*)(obj & (~1));
25123 obj_conv.is_owned = false;
25124 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
25125 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25126 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25127 CVec_u8Z_free(ret_var);
25131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25132 LDKu8slice ser_ref;
25133 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25134 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25135 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
25136 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
25137 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25138 return (uint64_t)ret_conv;
25141 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
25142 LDKChannelTransactionParameters obj_conv;
25143 obj_conv.inner = (void*)(obj & (~1));
25144 obj_conv.is_owned = false;
25145 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
25146 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25147 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25148 CVec_u8Z_free(ret_var);
25152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25153 LDKu8slice ser_ref;
25154 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25155 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25156 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
25157 *ret_conv = ChannelTransactionParameters_read(ser_ref);
25158 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25159 return (uint64_t)ret_conv;
25162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25163 LDKDirectedChannelTransactionParameters this_obj_conv;
25164 this_obj_conv.inner = (void*)(this_obj & (~1));
25165 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25166 DirectedChannelTransactionParameters_free(this_obj_conv);
25169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25170 LDKDirectedChannelTransactionParameters this_arg_conv;
25171 this_arg_conv.inner = (void*)(this_arg & (~1));
25172 this_arg_conv.is_owned = false;
25173 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
25174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25176 uint64_t ret_ref = (uint64_t)ret_var.inner;
25177 if (ret_var.is_owned) {
25183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
25184 LDKDirectedChannelTransactionParameters this_arg_conv;
25185 this_arg_conv.inner = (void*)(this_arg & (~1));
25186 this_arg_conv.is_owned = false;
25187 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
25188 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25189 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25190 uint64_t ret_ref = (uint64_t)ret_var.inner;
25191 if (ret_var.is_owned) {
25197 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
25198 LDKDirectedChannelTransactionParameters this_arg_conv;
25199 this_arg_conv.inner = (void*)(this_arg & (~1));
25200 this_arg_conv.is_owned = false;
25201 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
25205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
25206 LDKDirectedChannelTransactionParameters this_arg_conv;
25207 this_arg_conv.inner = (void*)(this_arg & (~1));
25208 this_arg_conv.is_owned = false;
25209 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
25213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
25214 LDKDirectedChannelTransactionParameters this_arg_conv;
25215 this_arg_conv.inner = (void*)(this_arg & (~1));
25216 this_arg_conv.is_owned = false;
25217 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
25218 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25219 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25220 uint64_t ret_ref = (uint64_t)ret_var.inner;
25221 if (ret_var.is_owned) {
25227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25228 LDKHolderCommitmentTransaction this_obj_conv;
25229 this_obj_conv.inner = (void*)(this_obj & (~1));
25230 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25231 HolderCommitmentTransaction_free(this_obj_conv);
25234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
25235 LDKHolderCommitmentTransaction this_ptr_conv;
25236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25237 this_ptr_conv.is_owned = false;
25238 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25239 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
25243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25244 LDKHolderCommitmentTransaction this_ptr_conv;
25245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25246 this_ptr_conv.is_owned = false;
25247 LDKSignature val_ref;
25248 CHECK((*env)->GetArrayLength(env, val) == 64);
25249 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
25250 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
25253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
25254 LDKHolderCommitmentTransaction this_ptr_conv;
25255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25256 this_ptr_conv.is_owned = false;
25257 LDKCVec_SignatureZ val_constr;
25258 val_constr.datalen = (*env)->GetArrayLength(env, val);
25259 if (val_constr.datalen > 0)
25260 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25262 val_constr.data = NULL;
25263 for (size_t i = 0; i < val_constr.datalen; i++) {
25264 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
25265 LDKSignature val_conv_8_ref;
25266 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
25267 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
25268 val_constr.data[i] = val_conv_8_ref;
25270 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
25273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25274 LDKHolderCommitmentTransaction orig_conv;
25275 orig_conv.inner = (void*)(orig & (~1));
25276 orig_conv.is_owned = false;
25277 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
25278 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25279 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25280 uint64_t ret_ref = (uint64_t)ret_var.inner;
25281 if (ret_var.is_owned) {
25287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25288 LDKHolderCommitmentTransaction obj_conv;
25289 obj_conv.inner = (void*)(obj & (~1));
25290 obj_conv.is_owned = false;
25291 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
25292 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25293 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25294 CVec_u8Z_free(ret_var);
25298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25299 LDKu8slice ser_ref;
25300 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25301 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25302 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
25303 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
25304 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25305 return (uint64_t)ret_conv;
25308 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) {
25309 LDKCommitmentTransaction commitment_tx_conv;
25310 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
25311 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
25312 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
25313 LDKSignature counterparty_sig_ref;
25314 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
25315 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
25316 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
25317 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
25318 if (counterparty_htlc_sigs_constr.datalen > 0)
25319 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
25321 counterparty_htlc_sigs_constr.data = NULL;
25322 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
25323 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
25324 LDKSignature counterparty_htlc_sigs_conv_8_ref;
25325 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
25326 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
25327 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
25329 LDKPublicKey holder_funding_key_ref;
25330 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
25331 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
25332 LDKPublicKey counterparty_funding_key_ref;
25333 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
25334 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
25335 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
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 void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25346 LDKBuiltCommitmentTransaction this_obj_conv;
25347 this_obj_conv.inner = (void*)(this_obj & (~1));
25348 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25349 BuiltCommitmentTransaction_free(this_obj_conv);
25352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
25353 LDKBuiltCommitmentTransaction this_ptr_conv;
25354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25355 this_ptr_conv.is_owned = false;
25356 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
25357 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25358 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25359 Transaction_free(ret_var);
25363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25364 LDKBuiltCommitmentTransaction this_ptr_conv;
25365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25366 this_ptr_conv.is_owned = false;
25367 LDKTransaction val_ref;
25368 val_ref.datalen = (*env)->GetArrayLength(env, val);
25369 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
25370 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
25371 val_ref.data_is_owned = true;
25372 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
25375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
25376 LDKBuiltCommitmentTransaction this_ptr_conv;
25377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25378 this_ptr_conv.is_owned = false;
25379 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25380 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
25384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25385 LDKBuiltCommitmentTransaction this_ptr_conv;
25386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25387 this_ptr_conv.is_owned = false;
25388 LDKThirtyTwoBytes val_ref;
25389 CHECK((*env)->GetArrayLength(env, val) == 32);
25390 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25391 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
25394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
25395 LDKTransaction transaction_arg_ref;
25396 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
25397 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
25398 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
25399 transaction_arg_ref.data_is_owned = true;
25400 LDKThirtyTwoBytes txid_arg_ref;
25401 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
25402 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
25403 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
25404 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25405 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25406 uint64_t ret_ref = (uint64_t)ret_var.inner;
25407 if (ret_var.is_owned) {
25413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25414 LDKBuiltCommitmentTransaction orig_conv;
25415 orig_conv.inner = (void*)(orig & (~1));
25416 orig_conv.is_owned = false;
25417 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
25418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25420 uint64_t ret_ref = (uint64_t)ret_var.inner;
25421 if (ret_var.is_owned) {
25427 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25428 LDKBuiltCommitmentTransaction obj_conv;
25429 obj_conv.inner = (void*)(obj & (~1));
25430 obj_conv.is_owned = false;
25431 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
25432 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25433 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25434 CVec_u8Z_free(ret_var);
25438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25439 LDKu8slice ser_ref;
25440 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25441 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25442 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
25443 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
25444 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25445 return (uint64_t)ret_conv;
25448 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) {
25449 LDKBuiltCommitmentTransaction this_arg_conv;
25450 this_arg_conv.inner = (void*)(this_arg & (~1));
25451 this_arg_conv.is_owned = false;
25452 LDKu8slice funding_redeemscript_ref;
25453 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25454 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25455 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25456 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25457 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25461 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) {
25462 LDKBuiltCommitmentTransaction this_arg_conv;
25463 this_arg_conv.inner = (void*)(this_arg & (~1));
25464 this_arg_conv.is_owned = false;
25465 unsigned char funding_key_arr[32];
25466 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25467 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25468 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25469 LDKu8slice funding_redeemscript_ref;
25470 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25471 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25472 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25474 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25479 LDKClosingTransaction this_obj_conv;
25480 this_obj_conv.inner = (void*)(this_obj & (~1));
25481 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25482 ClosingTransaction_free(this_obj_conv);
25485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
25486 LDKCVec_u8Z to_holder_script_ref;
25487 to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
25488 to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
25489 (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
25490 LDKCVec_u8Z to_counterparty_script_ref;
25491 to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
25492 to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
25493 (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
25494 LDKOutPoint funding_outpoint_conv;
25495 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25496 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25497 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25498 LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
25499 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25500 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25501 uint64_t ret_ref = (uint64_t)ret_var.inner;
25502 if (ret_var.is_owned) {
25508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25509 LDKClosingTransaction this_arg_conv;
25510 this_arg_conv.inner = (void*)(this_arg & (~1));
25511 this_arg_conv.is_owned = false;
25512 LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
25513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25515 uint64_t ret_ref = (uint64_t)ret_var.inner;
25516 if (ret_var.is_owned) {
25522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
25523 LDKClosingTransaction this_arg_conv;
25524 this_arg_conv.inner = (void*)(this_arg & (~1));
25525 this_arg_conv.is_owned = false;
25526 LDKOutPoint funding_outpoint_conv;
25527 funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
25528 funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
25529 funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
25530 LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
25531 *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
25532 return (uint64_t)ret_conv;
25535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25536 LDKClosingTransaction this_arg_conv;
25537 this_arg_conv.inner = (void*)(this_arg & (~1));
25538 this_arg_conv.is_owned = false;
25539 int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
25543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25544 LDKClosingTransaction this_arg_conv;
25545 this_arg_conv.inner = (void*)(this_arg & (~1));
25546 this_arg_conv.is_owned = false;
25547 int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
25551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25552 LDKClosingTransaction this_arg_conv;
25553 this_arg_conv.inner = (void*)(this_arg & (~1));
25554 this_arg_conv.is_owned = false;
25555 LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
25556 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25557 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
25562 LDKClosingTransaction this_arg_conv;
25563 this_arg_conv.inner = (void*)(this_arg & (~1));
25564 this_arg_conv.is_owned = false;
25565 LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
25566 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25567 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25572 LDKTrustedClosingTransaction this_obj_conv;
25573 this_obj_conv.inner = (void*)(this_obj & (~1));
25574 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25575 TrustedClosingTransaction_free(this_obj_conv);
25578 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25579 LDKTrustedClosingTransaction this_arg_conv;
25580 this_arg_conv.inner = (void*)(this_arg & (~1));
25581 this_arg_conv.is_owned = false;
25582 LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
25583 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25584 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25585 Transaction_free(ret_var);
25589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25590 LDKTrustedClosingTransaction this_arg_conv;
25591 this_arg_conv.inner = (void*)(this_arg & (~1));
25592 this_arg_conv.is_owned = false;
25593 LDKu8slice funding_redeemscript_ref;
25594 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25595 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25596 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
25598 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
25603 LDKTrustedClosingTransaction this_arg_conv;
25604 this_arg_conv.inner = (void*)(this_arg & (~1));
25605 this_arg_conv.is_owned = false;
25606 unsigned char funding_key_arr[32];
25607 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
25608 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
25609 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
25610 LDKu8slice funding_redeemscript_ref;
25611 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
25612 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
25613 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
25614 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
25615 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
25619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25620 LDKCommitmentTransaction this_obj_conv;
25621 this_obj_conv.inner = (void*)(this_obj & (~1));
25622 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25623 CommitmentTransaction_free(this_obj_conv);
25626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25627 LDKCommitmentTransaction orig_conv;
25628 orig_conv.inner = (void*)(orig & (~1));
25629 orig_conv.is_owned = false;
25630 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
25631 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25632 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25633 uint64_t ret_ref = (uint64_t)ret_var.inner;
25634 if (ret_var.is_owned) {
25640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
25641 LDKCommitmentTransaction obj_conv;
25642 obj_conv.inner = (void*)(obj & (~1));
25643 obj_conv.is_owned = false;
25644 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
25645 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25646 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25647 CVec_u8Z_free(ret_var);
25651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25652 LDKu8slice ser_ref;
25653 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25654 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25655 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
25656 *ret_conv = CommitmentTransaction_read(ser_ref);
25657 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25658 return (uint64_t)ret_conv;
25661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
25662 LDKCommitmentTransaction this_arg_conv;
25663 this_arg_conv.inner = (void*)(this_arg & (~1));
25664 this_arg_conv.is_owned = false;
25665 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
25669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25670 LDKCommitmentTransaction this_arg_conv;
25671 this_arg_conv.inner = (void*)(this_arg & (~1));
25672 this_arg_conv.is_owned = false;
25673 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
25677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
25678 LDKCommitmentTransaction this_arg_conv;
25679 this_arg_conv.inner = (void*)(this_arg & (~1));
25680 this_arg_conv.is_owned = false;
25681 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
25685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
25686 LDKCommitmentTransaction this_arg_conv;
25687 this_arg_conv.inner = (void*)(this_arg & (~1));
25688 this_arg_conv.is_owned = false;
25689 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
25693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
25694 LDKCommitmentTransaction this_arg_conv;
25695 this_arg_conv.inner = (void*)(this_arg & (~1));
25696 this_arg_conv.is_owned = false;
25697 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
25698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25700 uint64_t ret_ref = (uint64_t)ret_var.inner;
25701 if (ret_var.is_owned) {
25707 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) {
25708 LDKCommitmentTransaction this_arg_conv;
25709 this_arg_conv.inner = (void*)(this_arg & (~1));
25710 this_arg_conv.is_owned = false;
25711 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25712 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25713 channel_parameters_conv.is_owned = false;
25714 LDKChannelPublicKeys broadcaster_keys_conv;
25715 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
25716 broadcaster_keys_conv.is_owned = false;
25717 LDKChannelPublicKeys countersignatory_keys_conv;
25718 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
25719 countersignatory_keys_conv.is_owned = false;
25720 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
25721 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
25722 return (uint64_t)ret_conv;
25725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25726 LDKTrustedCommitmentTransaction this_obj_conv;
25727 this_obj_conv.inner = (void*)(this_obj & (~1));
25728 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25729 TrustedCommitmentTransaction_free(this_obj_conv);
25732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
25733 LDKTrustedCommitmentTransaction this_arg_conv;
25734 this_arg_conv.inner = (void*)(this_arg & (~1));
25735 this_arg_conv.is_owned = false;
25736 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25737 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
25741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
25742 LDKTrustedCommitmentTransaction this_arg_conv;
25743 this_arg_conv.inner = (void*)(this_arg & (~1));
25744 this_arg_conv.is_owned = false;
25745 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
25746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25748 uint64_t ret_ref = (uint64_t)ret_var.inner;
25749 if (ret_var.is_owned) {
25755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
25756 LDKTrustedCommitmentTransaction this_arg_conv;
25757 this_arg_conv.inner = (void*)(this_arg & (~1));
25758 this_arg_conv.is_owned = false;
25759 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
25760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25762 uint64_t ret_ref = (uint64_t)ret_var.inner;
25763 if (ret_var.is_owned) {
25769 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) {
25770 LDKTrustedCommitmentTransaction this_arg_conv;
25771 this_arg_conv.inner = (void*)(this_arg & (~1));
25772 this_arg_conv.is_owned = false;
25773 unsigned char htlc_base_key_arr[32];
25774 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
25775 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
25776 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
25777 LDKDirectedChannelTransactionParameters channel_parameters_conv;
25778 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
25779 channel_parameters_conv.is_owned = false;
25780 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
25781 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
25782 return (uint64_t)ret_conv;
25785 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) {
25786 LDKPublicKey broadcaster_payment_basepoint_ref;
25787 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
25788 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
25789 LDKPublicKey countersignatory_payment_basepoint_ref;
25790 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
25791 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
25792 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
25796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25797 LDKInitFeatures a_conv;
25798 a_conv.inner = (void*)(a & (~1));
25799 a_conv.is_owned = false;
25800 LDKInitFeatures b_conv;
25801 b_conv.inner = (void*)(b & (~1));
25802 b_conv.is_owned = false;
25803 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
25807 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25808 LDKNodeFeatures a_conv;
25809 a_conv.inner = (void*)(a & (~1));
25810 a_conv.is_owned = false;
25811 LDKNodeFeatures b_conv;
25812 b_conv.inner = (void*)(b & (~1));
25813 b_conv.is_owned = false;
25814 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
25818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25819 LDKChannelFeatures a_conv;
25820 a_conv.inner = (void*)(a & (~1));
25821 a_conv.is_owned = false;
25822 LDKChannelFeatures b_conv;
25823 b_conv.inner = (void*)(b & (~1));
25824 b_conv.is_owned = false;
25825 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
25829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25830 LDKInvoiceFeatures a_conv;
25831 a_conv.inner = (void*)(a & (~1));
25832 a_conv.is_owned = false;
25833 LDKInvoiceFeatures b_conv;
25834 b_conv.inner = (void*)(b & (~1));
25835 b_conv.is_owned = false;
25836 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
25840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25841 LDKInitFeatures orig_conv;
25842 orig_conv.inner = (void*)(orig & (~1));
25843 orig_conv.is_owned = false;
25844 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
25845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25847 uint64_t ret_ref = (uint64_t)ret_var.inner;
25848 if (ret_var.is_owned) {
25854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25855 LDKNodeFeatures orig_conv;
25856 orig_conv.inner = (void*)(orig & (~1));
25857 orig_conv.is_owned = false;
25858 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
25859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25861 uint64_t ret_ref = (uint64_t)ret_var.inner;
25862 if (ret_var.is_owned) {
25868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25869 LDKChannelFeatures orig_conv;
25870 orig_conv.inner = (void*)(orig & (~1));
25871 orig_conv.is_owned = false;
25872 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
25873 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25874 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25875 uint64_t ret_ref = (uint64_t)ret_var.inner;
25876 if (ret_var.is_owned) {
25882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25883 LDKInvoiceFeatures orig_conv;
25884 orig_conv.inner = (void*)(orig & (~1));
25885 orig_conv.is_owned = false;
25886 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
25887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25889 uint64_t ret_ref = (uint64_t)ret_var.inner;
25890 if (ret_var.is_owned) {
25896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25897 LDKInitFeatures this_obj_conv;
25898 this_obj_conv.inner = (void*)(this_obj & (~1));
25899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25900 InitFeatures_free(this_obj_conv);
25903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25904 LDKNodeFeatures this_obj_conv;
25905 this_obj_conv.inner = (void*)(this_obj & (~1));
25906 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25907 NodeFeatures_free(this_obj_conv);
25910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25911 LDKChannelFeatures this_obj_conv;
25912 this_obj_conv.inner = (void*)(this_obj & (~1));
25913 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25914 ChannelFeatures_free(this_obj_conv);
25917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25918 LDKInvoiceFeatures this_obj_conv;
25919 this_obj_conv.inner = (void*)(this_obj & (~1));
25920 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25921 InvoiceFeatures_free(this_obj_conv);
25924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
25925 LDKInitFeatures ret_var = InitFeatures_empty();
25926 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25927 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25928 uint64_t ret_ref = (uint64_t)ret_var.inner;
25929 if (ret_var.is_owned) {
25935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
25936 LDKInitFeatures ret_var = InitFeatures_known();
25937 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25938 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25939 uint64_t ret_ref = (uint64_t)ret_var.inner;
25940 if (ret_var.is_owned) {
25946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
25947 LDKInitFeatures this_arg_conv;
25948 this_arg_conv.inner = (void*)(this_arg & (~1));
25949 this_arg_conv.is_owned = false;
25950 jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
25954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
25955 LDKNodeFeatures ret_var = NodeFeatures_empty();
25956 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25957 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25958 uint64_t ret_ref = (uint64_t)ret_var.inner;
25959 if (ret_var.is_owned) {
25965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
25966 LDKNodeFeatures ret_var = NodeFeatures_known();
25967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25969 uint64_t ret_ref = (uint64_t)ret_var.inner;
25970 if (ret_var.is_owned) {
25976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
25977 LDKNodeFeatures this_arg_conv;
25978 this_arg_conv.inner = (void*)(this_arg & (~1));
25979 this_arg_conv.is_owned = false;
25980 jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
25984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
25985 LDKChannelFeatures ret_var = ChannelFeatures_empty();
25986 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25987 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25988 uint64_t ret_ref = (uint64_t)ret_var.inner;
25989 if (ret_var.is_owned) {
25995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
25996 LDKChannelFeatures ret_var = ChannelFeatures_known();
25997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25999 uint64_t ret_ref = (uint64_t)ret_var.inner;
26000 if (ret_var.is_owned) {
26006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26007 LDKChannelFeatures this_arg_conv;
26008 this_arg_conv.inner = (void*)(this_arg & (~1));
26009 this_arg_conv.is_owned = false;
26010 jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
26014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
26015 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
26016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26018 uint64_t ret_ref = (uint64_t)ret_var.inner;
26019 if (ret_var.is_owned) {
26025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
26026 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
26027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26029 uint64_t ret_ref = (uint64_t)ret_var.inner;
26030 if (ret_var.is_owned) {
26036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
26037 LDKInvoiceFeatures this_arg_conv;
26038 this_arg_conv.inner = (void*)(this_arg & (~1));
26039 this_arg_conv.is_owned = false;
26040 jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
26044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26045 LDKInitFeatures this_arg_conv;
26046 this_arg_conv.inner = (void*)(this_arg & (~1));
26047 this_arg_conv.is_owned = false;
26048 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
26052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26053 LDKNodeFeatures this_arg_conv;
26054 this_arg_conv.inner = (void*)(this_arg & (~1));
26055 this_arg_conv.is_owned = false;
26056 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
26060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26061 LDKInvoiceFeatures this_arg_conv;
26062 this_arg_conv.inner = (void*)(this_arg & (~1));
26063 this_arg_conv.is_owned = false;
26064 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
26068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26069 LDKInitFeatures obj_conv;
26070 obj_conv.inner = (void*)(obj & (~1));
26071 obj_conv.is_owned = false;
26072 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
26073 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26074 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26075 CVec_u8Z_free(ret_var);
26079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26080 LDKNodeFeatures obj_conv;
26081 obj_conv.inner = (void*)(obj & (~1));
26082 obj_conv.is_owned = false;
26083 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
26084 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26085 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26086 CVec_u8Z_free(ret_var);
26090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26091 LDKChannelFeatures obj_conv;
26092 obj_conv.inner = (void*)(obj & (~1));
26093 obj_conv.is_owned = false;
26094 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
26095 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26096 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26097 CVec_u8Z_free(ret_var);
26101 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
26102 LDKInvoiceFeatures obj_conv;
26103 obj_conv.inner = (void*)(obj & (~1));
26104 obj_conv.is_owned = false;
26105 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
26106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26108 CVec_u8Z_free(ret_var);
26112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26113 LDKu8slice ser_ref;
26114 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26115 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26116 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
26117 *ret_conv = InitFeatures_read(ser_ref);
26118 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26119 return (uint64_t)ret_conv;
26122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26123 LDKu8slice ser_ref;
26124 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26125 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26126 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
26127 *ret_conv = NodeFeatures_read(ser_ref);
26128 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26129 return (uint64_t)ret_conv;
26132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26133 LDKu8slice ser_ref;
26134 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26135 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26136 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
26137 *ret_conv = ChannelFeatures_read(ser_ref);
26138 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26139 return (uint64_t)ret_conv;
26142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26143 LDKu8slice ser_ref;
26144 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26145 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26146 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
26147 *ret_conv = InvoiceFeatures_read(ser_ref);
26148 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26149 return (uint64_t)ret_conv;
26152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26153 LDKShutdownScript this_obj_conv;
26154 this_obj_conv.inner = (void*)(this_obj & (~1));
26155 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26156 ShutdownScript_free(this_obj_conv);
26159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26160 LDKShutdownScript orig_conv;
26161 orig_conv.inner = (void*)(orig & (~1));
26162 orig_conv.is_owned = false;
26163 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
26164 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26165 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26166 uint64_t ret_ref = (uint64_t)ret_var.inner;
26167 if (ret_var.is_owned) {
26173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26174 LDKInvalidShutdownScript this_obj_conv;
26175 this_obj_conv.inner = (void*)(this_obj & (~1));
26176 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26177 InvalidShutdownScript_free(this_obj_conv);
26180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
26181 LDKInvalidShutdownScript this_ptr_conv;
26182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26183 this_ptr_conv.is_owned = false;
26184 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
26185 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26186 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26191 LDKInvalidShutdownScript this_ptr_conv;
26192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26193 this_ptr_conv.is_owned = false;
26194 LDKCVec_u8Z val_ref;
26195 val_ref.datalen = (*env)->GetArrayLength(env, val);
26196 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
26197 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
26198 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
26201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
26202 LDKCVec_u8Z script_arg_ref;
26203 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
26204 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
26205 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
26206 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
26207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26209 uint64_t ret_ref = (uint64_t)ret_var.inner;
26210 if (ret_var.is_owned) {
26216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
26217 LDKShutdownScript obj_conv;
26218 obj_conv.inner = (void*)(obj & (~1));
26219 obj_conv.is_owned = false;
26220 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
26221 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26222 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26223 CVec_u8Z_free(ret_var);
26227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26228 LDKu8slice ser_ref;
26229 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26230 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26231 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
26232 *ret_conv = ShutdownScript_read(ser_ref);
26233 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26234 return (uint64_t)ret_conv;
26237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26238 unsigned char pubkey_hash_arr[20];
26239 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26240 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26241 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26242 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
26243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26245 uint64_t ret_ref = (uint64_t)ret_var.inner;
26246 if (ret_var.is_owned) {
26252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26253 unsigned char script_hash_arr[20];
26254 CHECK((*env)->GetArrayLength(env, script_hash) == 20);
26255 (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
26256 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
26257 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
26258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26260 uint64_t ret_ref = (uint64_t)ret_var.inner;
26261 if (ret_var.is_owned) {
26267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
26268 unsigned char pubkey_hash_arr[20];
26269 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
26270 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
26271 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
26272 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
26273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26275 uint64_t ret_ref = (uint64_t)ret_var.inner;
26276 if (ret_var.is_owned) {
26282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
26283 unsigned char script_hash_arr[32];
26284 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
26285 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
26286 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
26287 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
26288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26290 uint64_t ret_ref = (uint64_t)ret_var.inner;
26291 if (ret_var.is_owned) {
26297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
26298 LDKu8slice program_ref;
26299 program_ref.datalen = (*env)->GetArrayLength(env, program);
26300 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
26301 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
26302 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
26303 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
26304 return (uint64_t)ret_conv;
26307 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
26308 LDKShutdownScript this_arg_conv;
26309 this_arg_conv.inner = (void*)(this_arg & (~1));
26310 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26311 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
26312 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
26313 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26314 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26315 CVec_u8Z_free(ret_var);
26319 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
26320 LDKShutdownScript this_arg_conv;
26321 this_arg_conv.inner = (void*)(this_arg & (~1));
26322 this_arg_conv.is_owned = false;
26323 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26324 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
26328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
26329 LDKShutdownScript this_arg_conv;
26330 this_arg_conv.inner = (void*)(this_arg & (~1));
26331 this_arg_conv.is_owned = false;
26332 LDKInitFeatures features_conv;
26333 features_conv.inner = (void*)(features & (~1));
26334 features_conv.is_owned = false;
26335 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
26339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26340 if ((this_ptr & 1) != 0) return;
26341 LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
26342 FREE((void*)this_ptr);
26343 CustomMessageReader_free(this_ptr_conv);
26346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26347 LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
26348 LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
26349 *ret_ret = Type_clone(orig_conv);
26350 return (uint64_t)ret_ret;
26353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26354 if ((this_ptr & 1) != 0) return;
26355 LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
26356 FREE((void*)this_ptr);
26357 Type_free(this_ptr_conv);
26360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26361 LDKRouteHop this_obj_conv;
26362 this_obj_conv.inner = (void*)(this_obj & (~1));
26363 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26364 RouteHop_free(this_obj_conv);
26367 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
26368 LDKRouteHop this_ptr_conv;
26369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26370 this_ptr_conv.is_owned = false;
26371 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26372 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
26376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26377 LDKRouteHop this_ptr_conv;
26378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26379 this_ptr_conv.is_owned = false;
26380 LDKPublicKey val_ref;
26381 CHECK((*env)->GetArrayLength(env, val) == 33);
26382 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26383 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
26386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26387 LDKRouteHop this_ptr_conv;
26388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26389 this_ptr_conv.is_owned = false;
26390 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
26391 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26392 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26393 uint64_t ret_ref = (uint64_t)ret_var.inner;
26394 if (ret_var.is_owned) {
26400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26401 LDKRouteHop this_ptr_conv;
26402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26403 this_ptr_conv.is_owned = false;
26404 LDKNodeFeatures val_conv;
26405 val_conv.inner = (void*)(val & (~1));
26406 val_conv.is_owned = (val & 1) || (val == 0);
26407 val_conv = NodeFeatures_clone(&val_conv);
26408 RouteHop_set_node_features(&this_ptr_conv, val_conv);
26411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26412 LDKRouteHop this_ptr_conv;
26413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26414 this_ptr_conv.is_owned = false;
26415 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
26419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26420 LDKRouteHop this_ptr_conv;
26421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26422 this_ptr_conv.is_owned = false;
26423 RouteHop_set_short_channel_id(&this_ptr_conv, val);
26426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
26427 LDKRouteHop this_ptr_conv;
26428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26429 this_ptr_conv.is_owned = false;
26430 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
26431 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26432 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26433 uint64_t ret_ref = (uint64_t)ret_var.inner;
26434 if (ret_var.is_owned) {
26440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26441 LDKRouteHop this_ptr_conv;
26442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26443 this_ptr_conv.is_owned = false;
26444 LDKChannelFeatures val_conv;
26445 val_conv.inner = (void*)(val & (~1));
26446 val_conv.is_owned = (val & 1) || (val == 0);
26447 val_conv = ChannelFeatures_clone(&val_conv);
26448 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
26451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26452 LDKRouteHop this_ptr_conv;
26453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26454 this_ptr_conv.is_owned = false;
26455 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
26459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26460 LDKRouteHop this_ptr_conv;
26461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26462 this_ptr_conv.is_owned = false;
26463 RouteHop_set_fee_msat(&this_ptr_conv, val);
26466 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26467 LDKRouteHop this_ptr_conv;
26468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26469 this_ptr_conv.is_owned = false;
26470 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
26474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
26475 LDKRouteHop this_ptr_conv;
26476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26477 this_ptr_conv.is_owned = false;
26478 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26481 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) {
26482 LDKPublicKey pubkey_arg_ref;
26483 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
26484 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
26485 LDKNodeFeatures node_features_arg_conv;
26486 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
26487 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
26488 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
26489 LDKChannelFeatures channel_features_arg_conv;
26490 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
26491 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
26492 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
26493 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);
26494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26496 uint64_t ret_ref = (uint64_t)ret_var.inner;
26497 if (ret_var.is_owned) {
26503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26504 LDKRouteHop orig_conv;
26505 orig_conv.inner = (void*)(orig & (~1));
26506 orig_conv.is_owned = false;
26507 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
26508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26510 uint64_t ret_ref = (uint64_t)ret_var.inner;
26511 if (ret_var.is_owned) {
26517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
26518 LDKRouteHop o_conv;
26519 o_conv.inner = (void*)(o & (~1));
26520 o_conv.is_owned = false;
26521 int64_t ret_val = RouteHop_hash(&o_conv);
26525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26526 LDKRouteHop a_conv;
26527 a_conv.inner = (void*)(a & (~1));
26528 a_conv.is_owned = false;
26529 LDKRouteHop b_conv;
26530 b_conv.inner = (void*)(b & (~1));
26531 b_conv.is_owned = false;
26532 jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
26536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
26537 LDKRouteHop obj_conv;
26538 obj_conv.inner = (void*)(obj & (~1));
26539 obj_conv.is_owned = false;
26540 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
26541 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26542 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26543 CVec_u8Z_free(ret_var);
26547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26548 LDKu8slice ser_ref;
26549 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26550 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26551 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26552 *ret_conv = RouteHop_read(ser_ref);
26553 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26554 return (uint64_t)ret_conv;
26557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26558 LDKRoute this_obj_conv;
26559 this_obj_conv.inner = (void*)(this_obj & (~1));
26560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26561 Route_free(this_obj_conv);
26564 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
26565 LDKRoute this_ptr_conv;
26566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26567 this_ptr_conv.is_owned = false;
26568 LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
26569 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
26571 for (size_t m = 0; m < ret_var.datalen; m++) {
26572 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
26573 int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
26574 int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
26575 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
26576 LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
26577 CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26578 CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26579 uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
26580 if (ret_conv_12_conv_10_var.is_owned) {
26581 ret_conv_12_conv_10_ref |= 1;
26583 ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
26585 (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
26586 FREE(ret_conv_12_var.data);
26587 (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
26589 FREE(ret_var.data);
26593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
26594 LDKRoute this_ptr_conv;
26595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26596 this_ptr_conv.is_owned = false;
26597 LDKCVec_CVec_RouteHopZZ val_constr;
26598 val_constr.datalen = (*env)->GetArrayLength(env, val);
26599 if (val_constr.datalen > 0)
26600 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26602 val_constr.data = NULL;
26603 for (size_t m = 0; m < val_constr.datalen; m++) {
26604 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
26605 LDKCVec_RouteHopZ val_conv_12_constr;
26606 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
26607 if (val_conv_12_constr.datalen > 0)
26608 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26610 val_conv_12_constr.data = NULL;
26611 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
26612 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
26613 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
26614 LDKRouteHop val_conv_12_conv_10_conv;
26615 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
26616 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
26617 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
26618 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
26620 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
26621 val_constr.data[m] = val_conv_12_constr;
26623 Route_set_paths(&this_ptr_conv, val_constr);
26626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
26627 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
26628 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
26629 if (paths_arg_constr.datalen > 0)
26630 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
26632 paths_arg_constr.data = NULL;
26633 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
26634 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
26635 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
26636 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
26637 if (paths_arg_conv_12_constr.datalen > 0)
26638 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26640 paths_arg_conv_12_constr.data = NULL;
26641 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
26642 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
26643 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
26644 LDKRouteHop paths_arg_conv_12_conv_10_conv;
26645 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
26646 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
26647 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
26648 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
26650 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
26651 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
26653 LDKRoute ret_var = Route_new(paths_arg_constr);
26654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26656 uint64_t ret_ref = (uint64_t)ret_var.inner;
26657 if (ret_var.is_owned) {
26663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26664 LDKRoute orig_conv;
26665 orig_conv.inner = (void*)(orig & (~1));
26666 orig_conv.is_owned = false;
26667 LDKRoute ret_var = Route_clone(&orig_conv);
26668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26670 uint64_t ret_ref = (uint64_t)ret_var.inner;
26671 if (ret_var.is_owned) {
26677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
26679 o_conv.inner = (void*)(o & (~1));
26680 o_conv.is_owned = false;
26681 int64_t ret_val = Route_hash(&o_conv);
26685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26687 a_conv.inner = (void*)(a & (~1));
26688 a_conv.is_owned = false;
26690 b_conv.inner = (void*)(b & (~1));
26691 b_conv.is_owned = false;
26692 jboolean ret_val = Route_eq(&a_conv, &b_conv);
26696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
26697 LDKRoute this_arg_conv;
26698 this_arg_conv.inner = (void*)(this_arg & (~1));
26699 this_arg_conv.is_owned = false;
26700 int64_t ret_val = Route_get_total_fees(&this_arg_conv);
26704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
26705 LDKRoute this_arg_conv;
26706 this_arg_conv.inner = (void*)(this_arg & (~1));
26707 this_arg_conv.is_owned = false;
26708 int64_t ret_val = Route_get_total_amount(&this_arg_conv);
26712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
26714 obj_conv.inner = (void*)(obj & (~1));
26715 obj_conv.is_owned = false;
26716 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
26717 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26718 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26719 CVec_u8Z_free(ret_var);
26723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26724 LDKu8slice ser_ref;
26725 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26726 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26727 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26728 *ret_conv = Route_read(ser_ref);
26729 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26730 return (uint64_t)ret_conv;
26733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26734 LDKRouteHint this_obj_conv;
26735 this_obj_conv.inner = (void*)(this_obj & (~1));
26736 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26737 RouteHint_free(this_obj_conv);
26740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26741 LDKRouteHint orig_conv;
26742 orig_conv.inner = (void*)(orig & (~1));
26743 orig_conv.is_owned = false;
26744 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
26745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26747 uint64_t ret_ref = (uint64_t)ret_var.inner;
26748 if (ret_var.is_owned) {
26754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
26755 LDKRouteHint o_conv;
26756 o_conv.inner = (void*)(o & (~1));
26757 o_conv.is_owned = false;
26758 int64_t ret_val = RouteHint_hash(&o_conv);
26762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26763 LDKRouteHint a_conv;
26764 a_conv.inner = (void*)(a & (~1));
26765 a_conv.is_owned = false;
26766 LDKRouteHint b_conv;
26767 b_conv.inner = (void*)(b & (~1));
26768 b_conv.is_owned = false;
26769 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
26773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26774 LDKRouteHintHop this_obj_conv;
26775 this_obj_conv.inner = (void*)(this_obj & (~1));
26776 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26777 RouteHintHop_free(this_obj_conv);
26780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26781 LDKRouteHintHop this_ptr_conv;
26782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26783 this_ptr_conv.is_owned = false;
26784 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26785 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
26789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
26790 LDKRouteHintHop this_ptr_conv;
26791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26792 this_ptr_conv.is_owned = false;
26793 LDKPublicKey val_ref;
26794 CHECK((*env)->GetArrayLength(env, val) == 33);
26795 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
26796 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
26799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
26800 LDKRouteHintHop this_ptr_conv;
26801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26802 this_ptr_conv.is_owned = false;
26803 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
26807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26808 LDKRouteHintHop this_ptr_conv;
26809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26810 this_ptr_conv.is_owned = false;
26811 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
26814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
26815 LDKRouteHintHop this_ptr_conv;
26816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26817 this_ptr_conv.is_owned = false;
26818 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
26819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26821 uint64_t ret_ref = (uint64_t)ret_var.inner;
26822 if (ret_var.is_owned) {
26828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26829 LDKRouteHintHop this_ptr_conv;
26830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26831 this_ptr_conv.is_owned = false;
26832 LDKRoutingFees val_conv;
26833 val_conv.inner = (void*)(val & (~1));
26834 val_conv.is_owned = (val & 1) || (val == 0);
26835 val_conv = RoutingFees_clone(&val_conv);
26836 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
26839 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
26840 LDKRouteHintHop this_ptr_conv;
26841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26842 this_ptr_conv.is_owned = false;
26843 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
26847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
26848 LDKRouteHintHop this_ptr_conv;
26849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26850 this_ptr_conv.is_owned = false;
26851 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
26854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26855 LDKRouteHintHop this_ptr_conv;
26856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26857 this_ptr_conv.is_owned = false;
26858 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26859 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
26860 uint64_t ret_ref = (uint64_t)ret_copy;
26864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26865 LDKRouteHintHop this_ptr_conv;
26866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26867 this_ptr_conv.is_owned = false;
26868 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
26869 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26870 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
26873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
26874 LDKRouteHintHop this_ptr_conv;
26875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26876 this_ptr_conv.is_owned = false;
26877 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26878 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
26879 uint64_t ret_ref = (uint64_t)ret_copy;
26883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26884 LDKRouteHintHop this_ptr_conv;
26885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26886 this_ptr_conv.is_owned = false;
26887 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
26888 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
26889 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
26892 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) {
26893 LDKPublicKey src_node_id_arg_ref;
26894 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
26895 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
26896 LDKRoutingFees fees_arg_conv;
26897 fees_arg_conv.inner = (void*)(fees_arg & (~1));
26898 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
26899 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
26900 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
26901 htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
26902 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
26903 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
26904 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);
26905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26907 uint64_t ret_ref = (uint64_t)ret_var.inner;
26908 if (ret_var.is_owned) {
26914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26915 LDKRouteHintHop orig_conv;
26916 orig_conv.inner = (void*)(orig & (~1));
26917 orig_conv.is_owned = false;
26918 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
26919 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26920 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26921 uint64_t ret_ref = (uint64_t)ret_var.inner;
26922 if (ret_var.is_owned) {
26928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
26929 LDKRouteHintHop o_conv;
26930 o_conv.inner = (void*)(o & (~1));
26931 o_conv.is_owned = false;
26932 int64_t ret_val = RouteHintHop_hash(&o_conv);
26936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26937 LDKRouteHintHop a_conv;
26938 a_conv.inner = (void*)(a & (~1));
26939 a_conv.is_owned = false;
26940 LDKRouteHintHop b_conv;
26941 b_conv.inner = (void*)(b & (~1));
26942 b_conv.is_owned = false;
26943 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
26947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
26948 LDKPublicKey our_node_id_ref;
26949 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
26950 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
26951 LDKNetworkGraph network_conv;
26952 network_conv.inner = (void*)(network & (~1));
26953 network_conv.is_owned = false;
26954 LDKPublicKey payee_ref;
26955 CHECK((*env)->GetArrayLength(env, payee) == 33);
26956 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
26957 LDKCVec_ChannelDetailsZ first_hops_constr;
26958 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
26959 if (first_hops != NULL) {
26960 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
26961 if (first_hops_constr.datalen > 0)
26962 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26964 first_hops_constr.data = NULL;
26965 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
26966 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
26967 int64_t first_hops_conv_16 = first_hops_vals[q];
26968 LDKChannelDetails first_hops_conv_16_conv;
26969 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
26970 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
26971 first_hops_constr.data[q] = first_hops_conv_16_conv;
26973 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
26974 first_hops_ptr = &first_hops_constr;
26976 LDKCVec_RouteHintZ last_hops_constr;
26977 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
26978 if (last_hops_constr.datalen > 0)
26979 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26981 last_hops_constr.data = NULL;
26982 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
26983 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
26984 int64_t last_hops_conv_11 = last_hops_vals[l];
26985 LDKRouteHint last_hops_conv_11_conv;
26986 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
26987 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
26988 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
26989 last_hops_constr.data[l] = last_hops_conv_11_conv;
26991 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
26992 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
26993 if (logger_conv.free == LDKLogger_JCalls_free) {
26994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26995 LDKLogger_JCalls_cloned(&logger_conv);
26997 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26998 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
26999 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
27000 return (uint64_t)ret_conv;
27003 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) {
27004 LDKPublicKey our_node_id_ref;
27005 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
27006 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
27007 LDKNetworkGraph network_conv;
27008 network_conv.inner = (void*)(network & (~1));
27009 network_conv.is_owned = false;
27010 LDKPublicKey payee_ref;
27011 CHECK((*env)->GetArrayLength(env, payee) == 33);
27012 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
27013 LDKInvoiceFeatures payee_features_conv;
27014 payee_features_conv.inner = (void*)(payee_features & (~1));
27015 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
27016 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
27017 LDKCVec_ChannelDetailsZ first_hops_constr;
27018 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
27019 if (first_hops != NULL) {
27020 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
27021 if (first_hops_constr.datalen > 0)
27022 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27024 first_hops_constr.data = NULL;
27025 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
27026 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
27027 int64_t first_hops_conv_16 = first_hops_vals[q];
27028 LDKChannelDetails first_hops_conv_16_conv;
27029 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
27030 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
27031 first_hops_constr.data[q] = first_hops_conv_16_conv;
27033 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
27034 first_hops_ptr = &first_hops_constr;
27036 LDKCVec_RouteHintZ last_hops_constr;
27037 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
27038 if (last_hops_constr.datalen > 0)
27039 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
27041 last_hops_constr.data = NULL;
27042 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
27043 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
27044 int64_t last_hops_conv_11 = last_hops_vals[l];
27045 LDKRouteHint last_hops_conv_11_conv;
27046 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
27047 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
27048 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
27049 last_hops_constr.data[l] = last_hops_conv_11_conv;
27051 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
27052 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27053 if (logger_conv.free == LDKLogger_JCalls_free) {
27054 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27055 LDKLogger_JCalls_cloned(&logger_conv);
27057 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
27058 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
27059 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
27060 return (uint64_t)ret_conv;
27063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27064 LDKNetworkGraph this_obj_conv;
27065 this_obj_conv.inner = (void*)(this_obj & (~1));
27066 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27067 NetworkGraph_free(this_obj_conv);
27070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27071 LDKReadOnlyNetworkGraph this_obj_conv;
27072 this_obj_conv.inner = (void*)(this_obj & (~1));
27073 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27074 ReadOnlyNetworkGraph_free(this_obj_conv);
27077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27078 if ((this_ptr & 1) != 0) return;
27079 LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
27080 FREE((void*)this_ptr);
27081 NetworkUpdate_free(this_ptr_conv);
27084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27085 LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
27086 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27087 *ret_copy = NetworkUpdate_clone(orig_conv);
27088 uint64_t ret_ref = (uint64_t)ret_copy;
27092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
27093 LDKChannelUpdate msg_conv;
27094 msg_conv.inner = (void*)(msg & (~1));
27095 msg_conv.is_owned = (msg & 1) || (msg == 0);
27096 msg_conv = ChannelUpdate_clone(&msg_conv);
27097 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27098 *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
27099 uint64_t ret_ref = (uint64_t)ret_copy;
27103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
27104 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27105 *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
27106 uint64_t ret_ref = (uint64_t)ret_copy;
27110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
27111 LDKPublicKey node_id_ref;
27112 CHECK((*env)->GetArrayLength(env, node_id) == 33);
27113 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
27114 LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
27115 *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
27116 uint64_t ret_ref = (uint64_t)ret_copy;
27120 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
27121 LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
27122 LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
27123 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27124 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27125 CVec_u8Z_free(ret_var);
27129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27130 LDKNetGraphMsgHandler this_arg_conv;
27131 this_arg_conv.inner = (void*)(this_arg & (~1));
27132 this_arg_conv.is_owned = false;
27133 LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
27134 *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
27135 return (uint64_t)ret_ret;
27138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27139 LDKNetGraphMsgHandler this_obj_conv;
27140 this_obj_conv.inner = (void*)(this_obj & (~1));
27141 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27142 NetGraphMsgHandler_free(this_obj_conv);
27145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
27146 LDKNetGraphMsgHandler this_ptr_conv;
27147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27148 this_ptr_conv.is_owned = false;
27149 LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
27150 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27151 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27152 uint64_t ret_ref = (uint64_t)ret_var.inner;
27153 if (ret_var.is_owned) {
27159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27160 LDKNetGraphMsgHandler this_ptr_conv;
27161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27162 this_ptr_conv.is_owned = false;
27163 LDKNetworkGraph val_conv;
27164 val_conv.inner = (void*)(val & (~1));
27165 val_conv.is_owned = (val & 1) || (val == 0);
27166 // Warning: we need a move here but no clone is available for LDKNetworkGraph
27167 NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
27170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
27171 LDKNetworkGraph network_graph_conv;
27172 network_graph_conv.inner = (void*)(network_graph & (~1));
27173 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
27174 // Warning: we need a move here but no clone is available for LDKNetworkGraph
27175 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27176 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27177 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27178 // Manually implement clone for Java trait instances
27179 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27181 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27184 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
27185 if (logger_conv.free == LDKLogger_JCalls_free) {
27186 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27187 LDKLogger_JCalls_cloned(&logger_conv);
27189 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
27190 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27191 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27192 uint64_t ret_ref = (uint64_t)ret_var.inner;
27193 if (ret_var.is_owned) {
27199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
27200 LDKNetGraphMsgHandler this_arg_conv;
27201 this_arg_conv.inner = (void*)(this_arg & (~1));
27202 this_arg_conv.is_owned = false;
27203 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
27204 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
27205 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
27206 // Manually implement clone for Java trait instances
27207 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
27208 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27209 LDKAccess_JCalls_cloned(&chain_access_conv.some);
27212 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
27215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
27216 LDKNetGraphMsgHandler this_arg_conv;
27217 this_arg_conv.inner = (void*)(this_arg & (~1));
27218 this_arg_conv.is_owned = false;
27219 LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
27220 *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
27221 return (uint64_t)ret_ret;
27224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
27225 LDKNetGraphMsgHandler this_arg_conv;
27226 this_arg_conv.inner = (void*)(this_arg & (~1));
27227 this_arg_conv.is_owned = false;
27228 LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27229 *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
27230 return (uint64_t)ret_ret;
27233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27234 LDKDirectionalChannelInfo this_obj_conv;
27235 this_obj_conv.inner = (void*)(this_obj & (~1));
27236 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27237 DirectionalChannelInfo_free(this_obj_conv);
27240 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27241 LDKDirectionalChannelInfo this_ptr_conv;
27242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27243 this_ptr_conv.is_owned = false;
27244 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
27248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27249 LDKDirectionalChannelInfo this_ptr_conv;
27250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27251 this_ptr_conv.is_owned = false;
27252 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
27255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
27256 LDKDirectionalChannelInfo this_ptr_conv;
27257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27258 this_ptr_conv.is_owned = false;
27259 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
27263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
27264 LDKDirectionalChannelInfo this_ptr_conv;
27265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27266 this_ptr_conv.is_owned = false;
27267 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
27270 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
27271 LDKDirectionalChannelInfo this_ptr_conv;
27272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27273 this_ptr_conv.is_owned = false;
27274 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
27278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
27279 LDKDirectionalChannelInfo this_ptr_conv;
27280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27281 this_ptr_conv.is_owned = false;
27282 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27286 LDKDirectionalChannelInfo this_ptr_conv;
27287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27288 this_ptr_conv.is_owned = false;
27289 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
27293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27294 LDKDirectionalChannelInfo this_ptr_conv;
27295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27296 this_ptr_conv.is_owned = false;
27297 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
27300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27301 LDKDirectionalChannelInfo this_ptr_conv;
27302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27303 this_ptr_conv.is_owned = false;
27304 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27305 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
27306 uint64_t ret_ref = (uint64_t)ret_copy;
27310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27311 LDKDirectionalChannelInfo this_ptr_conv;
27312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27313 this_ptr_conv.is_owned = false;
27314 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27315 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27316 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
27319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27320 LDKDirectionalChannelInfo this_ptr_conv;
27321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27322 this_ptr_conv.is_owned = false;
27323 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
27324 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27325 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27326 uint64_t ret_ref = (uint64_t)ret_var.inner;
27327 if (ret_var.is_owned) {
27333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27334 LDKDirectionalChannelInfo this_ptr_conv;
27335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27336 this_ptr_conv.is_owned = false;
27337 LDKRoutingFees val_conv;
27338 val_conv.inner = (void*)(val & (~1));
27339 val_conv.is_owned = (val & 1) || (val == 0);
27340 val_conv = RoutingFees_clone(&val_conv);
27341 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
27344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27345 LDKDirectionalChannelInfo this_ptr_conv;
27346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27347 this_ptr_conv.is_owned = false;
27348 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
27349 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27350 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27351 uint64_t ret_ref = (uint64_t)ret_var.inner;
27352 if (ret_var.is_owned) {
27358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27359 LDKDirectionalChannelInfo this_ptr_conv;
27360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27361 this_ptr_conv.is_owned = false;
27362 LDKChannelUpdate val_conv;
27363 val_conv.inner = (void*)(val & (~1));
27364 val_conv.is_owned = (val & 1) || (val == 0);
27365 val_conv = ChannelUpdate_clone(&val_conv);
27366 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
27369 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) {
27370 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
27371 htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
27372 LDKRoutingFees fees_arg_conv;
27373 fees_arg_conv.inner = (void*)(fees_arg & (~1));
27374 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
27375 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
27376 LDKChannelUpdate last_update_message_arg_conv;
27377 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
27378 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
27379 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
27380 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);
27381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27383 uint64_t ret_ref = (uint64_t)ret_var.inner;
27384 if (ret_var.is_owned) {
27390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27391 LDKDirectionalChannelInfo orig_conv;
27392 orig_conv.inner = (void*)(orig & (~1));
27393 orig_conv.is_owned = false;
27394 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
27395 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27396 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27397 uint64_t ret_ref = (uint64_t)ret_var.inner;
27398 if (ret_var.is_owned) {
27404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27405 LDKDirectionalChannelInfo obj_conv;
27406 obj_conv.inner = (void*)(obj & (~1));
27407 obj_conv.is_owned = false;
27408 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
27409 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27410 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27411 CVec_u8Z_free(ret_var);
27415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27416 LDKu8slice ser_ref;
27417 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27418 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27419 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
27420 *ret_conv = DirectionalChannelInfo_read(ser_ref);
27421 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27422 return (uint64_t)ret_conv;
27425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27426 LDKChannelInfo this_obj_conv;
27427 this_obj_conv.inner = (void*)(this_obj & (~1));
27428 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27429 ChannelInfo_free(this_obj_conv);
27432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27433 LDKChannelInfo this_ptr_conv;
27434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27435 this_ptr_conv.is_owned = false;
27436 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
27437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27439 uint64_t ret_ref = (uint64_t)ret_var.inner;
27440 if (ret_var.is_owned) {
27446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27447 LDKChannelInfo this_ptr_conv;
27448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27449 this_ptr_conv.is_owned = false;
27450 LDKChannelFeatures val_conv;
27451 val_conv.inner = (void*)(val & (~1));
27452 val_conv.is_owned = (val & 1) || (val == 0);
27453 val_conv = ChannelFeatures_clone(&val_conv);
27454 ChannelInfo_set_features(&this_ptr_conv, val_conv);
27457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27458 LDKChannelInfo this_ptr_conv;
27459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27460 this_ptr_conv.is_owned = false;
27461 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27462 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
27466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27467 LDKChannelInfo this_ptr_conv;
27468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27469 this_ptr_conv.is_owned = false;
27470 LDKPublicKey val_ref;
27471 CHECK((*env)->GetArrayLength(env, val) == 33);
27472 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27473 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
27476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27477 LDKChannelInfo this_ptr_conv;
27478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27479 this_ptr_conv.is_owned = false;
27480 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
27481 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27482 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27483 uint64_t ret_ref = (uint64_t)ret_var.inner;
27484 if (ret_var.is_owned) {
27490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27491 LDKChannelInfo this_ptr_conv;
27492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27493 this_ptr_conv.is_owned = false;
27494 LDKDirectionalChannelInfo val_conv;
27495 val_conv.inner = (void*)(val & (~1));
27496 val_conv.is_owned = (val & 1) || (val == 0);
27497 val_conv = DirectionalChannelInfo_clone(&val_conv);
27498 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
27501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
27502 LDKChannelInfo this_ptr_conv;
27503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27504 this_ptr_conv.is_owned = false;
27505 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
27510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27511 LDKChannelInfo this_ptr_conv;
27512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27513 this_ptr_conv.is_owned = false;
27514 LDKPublicKey val_ref;
27515 CHECK((*env)->GetArrayLength(env, val) == 33);
27516 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
27517 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
27520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
27521 LDKChannelInfo this_ptr_conv;
27522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27523 this_ptr_conv.is_owned = false;
27524 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
27525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27527 uint64_t ret_ref = (uint64_t)ret_var.inner;
27528 if (ret_var.is_owned) {
27534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27535 LDKChannelInfo this_ptr_conv;
27536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27537 this_ptr_conv.is_owned = false;
27538 LDKDirectionalChannelInfo val_conv;
27539 val_conv.inner = (void*)(val & (~1));
27540 val_conv.is_owned = (val & 1) || (val == 0);
27541 val_conv = DirectionalChannelInfo_clone(&val_conv);
27542 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
27545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
27546 LDKChannelInfo this_ptr_conv;
27547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27548 this_ptr_conv.is_owned = false;
27549 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27550 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
27551 uint64_t ret_ref = (uint64_t)ret_copy;
27555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27556 LDKChannelInfo this_ptr_conv;
27557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27558 this_ptr_conv.is_owned = false;
27559 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
27560 val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
27561 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
27564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27565 LDKChannelInfo this_ptr_conv;
27566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27567 this_ptr_conv.is_owned = false;
27568 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
27569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27571 uint64_t ret_ref = (uint64_t)ret_var.inner;
27572 if (ret_var.is_owned) {
27578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27579 LDKChannelInfo this_ptr_conv;
27580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27581 this_ptr_conv.is_owned = false;
27582 LDKChannelAnnouncement val_conv;
27583 val_conv.inner = (void*)(val & (~1));
27584 val_conv.is_owned = (val & 1) || (val == 0);
27585 val_conv = ChannelAnnouncement_clone(&val_conv);
27586 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
27589 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) {
27590 LDKChannelFeatures features_arg_conv;
27591 features_arg_conv.inner = (void*)(features_arg & (~1));
27592 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27593 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
27594 LDKPublicKey node_one_arg_ref;
27595 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
27596 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
27597 LDKDirectionalChannelInfo one_to_two_arg_conv;
27598 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
27599 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
27600 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
27601 LDKPublicKey node_two_arg_ref;
27602 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
27603 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
27604 LDKDirectionalChannelInfo two_to_one_arg_conv;
27605 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
27606 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
27607 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
27608 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
27609 capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
27610 LDKChannelAnnouncement announcement_message_arg_conv;
27611 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27612 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27613 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
27614 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);
27615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27617 uint64_t ret_ref = (uint64_t)ret_var.inner;
27618 if (ret_var.is_owned) {
27624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27625 LDKChannelInfo orig_conv;
27626 orig_conv.inner = (void*)(orig & (~1));
27627 orig_conv.is_owned = false;
27628 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
27629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27631 uint64_t ret_ref = (uint64_t)ret_var.inner;
27632 if (ret_var.is_owned) {
27638 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27639 LDKChannelInfo obj_conv;
27640 obj_conv.inner = (void*)(obj & (~1));
27641 obj_conv.is_owned = false;
27642 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
27643 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27644 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27645 CVec_u8Z_free(ret_var);
27649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27650 LDKu8slice ser_ref;
27651 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27652 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27653 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
27654 *ret_conv = ChannelInfo_read(ser_ref);
27655 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27656 return (uint64_t)ret_conv;
27659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27660 LDKRoutingFees this_obj_conv;
27661 this_obj_conv.inner = (void*)(this_obj & (~1));
27662 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27663 RoutingFees_free(this_obj_conv);
27666 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
27667 LDKRoutingFees this_ptr_conv;
27668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27669 this_ptr_conv.is_owned = false;
27670 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
27674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27675 LDKRoutingFees this_ptr_conv;
27676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27677 this_ptr_conv.is_owned = false;
27678 RoutingFees_set_base_msat(&this_ptr_conv, val);
27681 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
27682 LDKRoutingFees this_ptr_conv;
27683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27684 this_ptr_conv.is_owned = false;
27685 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
27689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27690 LDKRoutingFees this_ptr_conv;
27691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27692 this_ptr_conv.is_owned = false;
27693 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
27696 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) {
27697 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
27698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27700 uint64_t ret_ref = (uint64_t)ret_var.inner;
27701 if (ret_var.is_owned) {
27707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27708 LDKRoutingFees a_conv;
27709 a_conv.inner = (void*)(a & (~1));
27710 a_conv.is_owned = false;
27711 LDKRoutingFees b_conv;
27712 b_conv.inner = (void*)(b & (~1));
27713 b_conv.is_owned = false;
27714 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
27718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27719 LDKRoutingFees orig_conv;
27720 orig_conv.inner = (void*)(orig & (~1));
27721 orig_conv.is_owned = false;
27722 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
27723 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27724 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27725 uint64_t ret_ref = (uint64_t)ret_var.inner;
27726 if (ret_var.is_owned) {
27732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
27733 LDKRoutingFees o_conv;
27734 o_conv.inner = (void*)(o & (~1));
27735 o_conv.is_owned = false;
27736 int64_t ret_val = RoutingFees_hash(&o_conv);
27740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
27741 LDKRoutingFees obj_conv;
27742 obj_conv.inner = (void*)(obj & (~1));
27743 obj_conv.is_owned = false;
27744 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
27745 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27746 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27747 CVec_u8Z_free(ret_var);
27751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27752 LDKu8slice ser_ref;
27753 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27754 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27755 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
27756 *ret_conv = RoutingFees_read(ser_ref);
27757 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27758 return (uint64_t)ret_conv;
27761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27762 LDKNodeAnnouncementInfo this_obj_conv;
27763 this_obj_conv.inner = (void*)(this_obj & (~1));
27764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27765 NodeAnnouncementInfo_free(this_obj_conv);
27768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
27769 LDKNodeAnnouncementInfo this_ptr_conv;
27770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27771 this_ptr_conv.is_owned = false;
27772 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
27773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27775 uint64_t ret_ref = (uint64_t)ret_var.inner;
27776 if (ret_var.is_owned) {
27782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27783 LDKNodeAnnouncementInfo this_ptr_conv;
27784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27785 this_ptr_conv.is_owned = false;
27786 LDKNodeFeatures val_conv;
27787 val_conv.inner = (void*)(val & (~1));
27788 val_conv.is_owned = (val & 1) || (val == 0);
27789 val_conv = NodeFeatures_clone(&val_conv);
27790 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
27793 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
27794 LDKNodeAnnouncementInfo this_ptr_conv;
27795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27796 this_ptr_conv.is_owned = false;
27797 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
27801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
27802 LDKNodeAnnouncementInfo this_ptr_conv;
27803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27804 this_ptr_conv.is_owned = false;
27805 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
27808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
27809 LDKNodeAnnouncementInfo this_ptr_conv;
27810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27811 this_ptr_conv.is_owned = false;
27812 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
27813 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
27817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27818 LDKNodeAnnouncementInfo this_ptr_conv;
27819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27820 this_ptr_conv.is_owned = false;
27821 LDKThreeBytes val_ref;
27822 CHECK((*env)->GetArrayLength(env, val) == 3);
27823 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
27824 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
27827 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
27828 LDKNodeAnnouncementInfo this_ptr_conv;
27829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27830 this_ptr_conv.is_owned = false;
27831 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27832 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
27836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
27837 LDKNodeAnnouncementInfo this_ptr_conv;
27838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27839 this_ptr_conv.is_owned = false;
27840 LDKThirtyTwoBytes val_ref;
27841 CHECK((*env)->GetArrayLength(env, val) == 32);
27842 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
27843 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
27846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
27847 LDKNodeAnnouncementInfo this_ptr_conv;
27848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27849 this_ptr_conv.is_owned = false;
27850 LDKCVec_NetAddressZ val_constr;
27851 val_constr.datalen = (*env)->GetArrayLength(env, val);
27852 if (val_constr.datalen > 0)
27853 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27855 val_constr.data = NULL;
27856 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
27857 for (size_t m = 0; m < val_constr.datalen; m++) {
27858 int64_t val_conv_12 = val_vals[m];
27859 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
27860 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
27861 val_constr.data[m] = val_conv_12_conv;
27863 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
27864 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
27867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
27868 LDKNodeAnnouncementInfo this_ptr_conv;
27869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27870 this_ptr_conv.is_owned = false;
27871 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
27872 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27873 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27874 uint64_t ret_ref = (uint64_t)ret_var.inner;
27875 if (ret_var.is_owned) {
27881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
27882 LDKNodeAnnouncementInfo this_ptr_conv;
27883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27884 this_ptr_conv.is_owned = false;
27885 LDKNodeAnnouncement val_conv;
27886 val_conv.inner = (void*)(val & (~1));
27887 val_conv.is_owned = (val & 1) || (val == 0);
27888 val_conv = NodeAnnouncement_clone(&val_conv);
27889 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
27892 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) {
27893 LDKNodeFeatures features_arg_conv;
27894 features_arg_conv.inner = (void*)(features_arg & (~1));
27895 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
27896 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
27897 LDKThreeBytes rgb_arg_ref;
27898 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
27899 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
27900 LDKThirtyTwoBytes alias_arg_ref;
27901 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
27902 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
27903 LDKCVec_NetAddressZ addresses_arg_constr;
27904 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
27905 if (addresses_arg_constr.datalen > 0)
27906 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
27908 addresses_arg_constr.data = NULL;
27909 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
27910 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
27911 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
27912 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
27913 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
27915 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
27916 LDKNodeAnnouncement announcement_message_arg_conv;
27917 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
27918 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
27919 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
27920 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
27921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27923 uint64_t ret_ref = (uint64_t)ret_var.inner;
27924 if (ret_var.is_owned) {
27930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27931 LDKNodeAnnouncementInfo orig_conv;
27932 orig_conv.inner = (void*)(orig & (~1));
27933 orig_conv.is_owned = false;
27934 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
27935 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27936 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27937 uint64_t ret_ref = (uint64_t)ret_var.inner;
27938 if (ret_var.is_owned) {
27944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
27945 LDKNodeAnnouncementInfo obj_conv;
27946 obj_conv.inner = (void*)(obj & (~1));
27947 obj_conv.is_owned = false;
27948 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
27949 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
27950 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
27951 CVec_u8Z_free(ret_var);
27955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
27956 LDKu8slice ser_ref;
27957 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
27958 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
27959 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
27960 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
27961 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
27962 return (uint64_t)ret_conv;
27965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27966 LDKNodeInfo this_obj_conv;
27967 this_obj_conv.inner = (void*)(this_obj & (~1));
27968 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27969 NodeInfo_free(this_obj_conv);
27972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
27973 LDKNodeInfo this_ptr_conv;
27974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27975 this_ptr_conv.is_owned = false;
27976 LDKCVec_u64Z val_constr;
27977 val_constr.datalen = (*env)->GetArrayLength(env, val);
27978 if (val_constr.datalen > 0)
27979 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
27981 val_constr.data = NULL;
27982 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
27983 for (size_t g = 0; g < val_constr.datalen; g++) {
27984 int64_t val_conv_6 = val_vals[g];
27985 val_constr.data[g] = val_conv_6;
27987 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
27988 NodeInfo_set_channels(&this_ptr_conv, val_constr);
27991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
27992 LDKNodeInfo this_ptr_conv;
27993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
27994 this_ptr_conv.is_owned = false;
27995 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
27996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27998 uint64_t ret_ref = (uint64_t)ret_var.inner;
27999 if (ret_var.is_owned) {
28005 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) {
28006 LDKNodeInfo this_ptr_conv;
28007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28008 this_ptr_conv.is_owned = false;
28009 LDKRoutingFees val_conv;
28010 val_conv.inner = (void*)(val & (~1));
28011 val_conv.is_owned = (val & 1) || (val == 0);
28012 val_conv = RoutingFees_clone(&val_conv);
28013 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
28016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
28017 LDKNodeInfo this_ptr_conv;
28018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28019 this_ptr_conv.is_owned = false;
28020 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
28021 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28022 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28023 uint64_t ret_ref = (uint64_t)ret_var.inner;
28024 if (ret_var.is_owned) {
28030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28031 LDKNodeInfo this_ptr_conv;
28032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28033 this_ptr_conv.is_owned = false;
28034 LDKNodeAnnouncementInfo val_conv;
28035 val_conv.inner = (void*)(val & (~1));
28036 val_conv.is_owned = (val & 1) || (val == 0);
28037 val_conv = NodeAnnouncementInfo_clone(&val_conv);
28038 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
28041 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) {
28042 LDKCVec_u64Z channels_arg_constr;
28043 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
28044 if (channels_arg_constr.datalen > 0)
28045 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
28047 channels_arg_constr.data = NULL;
28048 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
28049 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
28050 int64_t channels_arg_conv_6 = channels_arg_vals[g];
28051 channels_arg_constr.data[g] = channels_arg_conv_6;
28053 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
28054 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
28055 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
28056 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
28057 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
28058 LDKNodeAnnouncementInfo announcement_info_arg_conv;
28059 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
28060 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
28061 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
28062 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
28063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28065 uint64_t ret_ref = (uint64_t)ret_var.inner;
28066 if (ret_var.is_owned) {
28072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28073 LDKNodeInfo orig_conv;
28074 orig_conv.inner = (void*)(orig & (~1));
28075 orig_conv.is_owned = false;
28076 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
28077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28079 uint64_t ret_ref = (uint64_t)ret_var.inner;
28080 if (ret_var.is_owned) {
28086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
28087 LDKNodeInfo obj_conv;
28088 obj_conv.inner = (void*)(obj & (~1));
28089 obj_conv.is_owned = false;
28090 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
28091 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28092 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28093 CVec_u8Z_free(ret_var);
28097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28098 LDKu8slice ser_ref;
28099 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28100 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28101 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
28102 *ret_conv = NodeInfo_read(ser_ref);
28103 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28104 return (uint64_t)ret_conv;
28107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
28108 LDKNetworkGraph obj_conv;
28109 obj_conv.inner = (void*)(obj & (~1));
28110 obj_conv.is_owned = false;
28111 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
28112 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
28113 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
28114 CVec_u8Z_free(ret_var);
28118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
28119 LDKu8slice ser_ref;
28120 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
28121 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
28122 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
28123 *ret_conv = NetworkGraph_read(ser_ref);
28124 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
28125 return (uint64_t)ret_conv;
28128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
28129 LDKThirtyTwoBytes genesis_hash_ref;
28130 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
28131 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
28132 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
28133 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28134 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28135 uint64_t ret_ref = (uint64_t)ret_var.inner;
28136 if (ret_var.is_owned) {
28142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
28143 LDKNetworkGraph this_arg_conv;
28144 this_arg_conv.inner = (void*)(this_arg & (~1));
28145 this_arg_conv.is_owned = false;
28146 LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
28147 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28148 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28149 uint64_t ret_ref = (uint64_t)ret_var.inner;
28150 if (ret_var.is_owned) {
28156 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) {
28157 LDKNetworkGraph this_arg_conv;
28158 this_arg_conv.inner = (void*)(this_arg & (~1));
28159 this_arg_conv.is_owned = false;
28160 LDKNodeAnnouncement msg_conv;
28161 msg_conv.inner = (void*)(msg & (~1));
28162 msg_conv.is_owned = false;
28163 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28164 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
28165 return (uint64_t)ret_conv;
28168 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) {
28169 LDKNetworkGraph this_arg_conv;
28170 this_arg_conv.inner = (void*)(this_arg & (~1));
28171 this_arg_conv.is_owned = false;
28172 LDKUnsignedNodeAnnouncement msg_conv;
28173 msg_conv.inner = (void*)(msg & (~1));
28174 msg_conv.is_owned = false;
28175 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28176 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
28177 return (uint64_t)ret_conv;
28180 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) {
28181 LDKNetworkGraph this_arg_conv;
28182 this_arg_conv.inner = (void*)(this_arg & (~1));
28183 this_arg_conv.is_owned = false;
28184 LDKChannelAnnouncement msg_conv;
28185 msg_conv.inner = (void*)(msg & (~1));
28186 msg_conv.is_owned = false;
28187 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28188 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28189 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28190 // Manually implement clone for Java trait instances
28191 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28192 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28193 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28196 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28197 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28198 return (uint64_t)ret_conv;
28201 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) {
28202 LDKNetworkGraph this_arg_conv;
28203 this_arg_conv.inner = (void*)(this_arg & (~1));
28204 this_arg_conv.is_owned = false;
28205 LDKUnsignedChannelAnnouncement msg_conv;
28206 msg_conv.inner = (void*)(msg & (~1));
28207 msg_conv.is_owned = false;
28208 LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
28209 // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
28210 if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
28211 // Manually implement clone for Java trait instances
28212 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
28213 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28214 LDKAccess_JCalls_cloned(&chain_access_conv.some);
28217 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28218 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
28219 return (uint64_t)ret_conv;
28222 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) {
28223 LDKNetworkGraph this_arg_conv;
28224 this_arg_conv.inner = (void*)(this_arg & (~1));
28225 this_arg_conv.is_owned = false;
28226 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
28229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
28230 LDKNetworkGraph this_arg_conv;
28231 this_arg_conv.inner = (void*)(this_arg & (~1));
28232 this_arg_conv.is_owned = false;
28233 LDKPublicKey _node_id_ref;
28234 CHECK((*env)->GetArrayLength(env, _node_id) == 33);
28235 (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
28236 NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
28239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28240 LDKNetworkGraph this_arg_conv;
28241 this_arg_conv.inner = (void*)(this_arg & (~1));
28242 this_arg_conv.is_owned = false;
28243 LDKChannelUpdate msg_conv;
28244 msg_conv.inner = (void*)(msg & (~1));
28245 msg_conv.is_owned = false;
28246 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28247 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
28248 return (uint64_t)ret_conv;
28251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
28252 LDKNetworkGraph this_arg_conv;
28253 this_arg_conv.inner = (void*)(this_arg & (~1));
28254 this_arg_conv.is_owned = false;
28255 LDKUnsignedChannelUpdate msg_conv;
28256 msg_conv.inner = (void*)(msg & (~1));
28257 msg_conv.is_owned = false;
28258 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28259 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
28260 return (uint64_t)ret_conv;
28263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28264 LDKFilesystemPersister this_obj_conv;
28265 this_obj_conv.inner = (void*)(this_obj & (~1));
28266 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28267 FilesystemPersister_free(this_obj_conv);
28270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
28271 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
28272 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
28273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28275 uint64_t ret_ref = (uint64_t)ret_var.inner;
28276 if (ret_var.is_owned) {
28282 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
28283 LDKFilesystemPersister this_arg_conv;
28284 this_arg_conv.inner = (void*)(this_arg & (~1));
28285 this_arg_conv.is_owned = false;
28286 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
28287 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
28292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
28293 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
28294 LDKChannelManager manager_conv;
28295 manager_conv.inner = (void*)(manager & (~1));
28296 manager_conv.is_owned = false;
28297 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28298 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
28299 return (uint64_t)ret_conv;
28302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
28303 LDKFilesystemPersister this_arg_conv;
28304 this_arg_conv.inner = (void*)(this_arg & (~1));
28305 this_arg_conv.is_owned = false;
28306 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
28307 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28308 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28309 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28311 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
28312 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
28313 return (uint64_t)ret_conv;
28316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
28317 LDKFilesystemPersister this_arg_conv;
28318 this_arg_conv.inner = (void*)(this_arg & (~1));
28319 this_arg_conv.is_owned = false;
28320 LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
28321 *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
28322 return (uint64_t)ret_ret;
28325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28326 LDKBackgroundProcessor this_obj_conv;
28327 this_obj_conv.inner = (void*)(this_obj & (~1));
28328 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28329 BackgroundProcessor_free(this_obj_conv);
28332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28333 if ((this_ptr & 1) != 0) return;
28334 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
28335 FREE((void*)this_ptr);
28336 ChannelManagerPersister_free(this_ptr_conv);
28339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
28340 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
28341 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
28342 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28343 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
28345 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
28346 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
28347 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28348 LDKEventHandler_JCalls_cloned(&event_handler_conv);
28350 LDKChainMonitor chain_monitor_conv;
28351 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
28352 chain_monitor_conv.is_owned = false;
28353 LDKChannelManager channel_manager_conv;
28354 channel_manager_conv.inner = (void*)(channel_manager & (~1));
28355 channel_manager_conv.is_owned = false;
28356 LDKNetGraphMsgHandler net_graph_msg_handler_conv;
28357 net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
28358 net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
28359 LDKPeerManager peer_manager_conv;
28360 peer_manager_conv.inner = (void*)(peer_manager & (~1));
28361 peer_manager_conv.is_owned = false;
28362 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
28363 if (logger_conv.free == LDKLogger_JCalls_free) {
28364 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28365 LDKLogger_JCalls_cloned(&logger_conv);
28367 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
28368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28370 uint64_t ret_ref = (uint64_t)ret_var.inner;
28371 if (ret_var.is_owned) {
28377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
28378 LDKBackgroundProcessor this_arg_conv;
28379 this_arg_conv.inner = (void*)(this_arg & (~1));
28380 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28381 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28382 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28383 *ret_conv = BackgroundProcessor_join(this_arg_conv);
28384 return (uint64_t)ret_conv;
28387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
28388 LDKBackgroundProcessor this_arg_conv;
28389 this_arg_conv.inner = (void*)(this_arg & (~1));
28390 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
28391 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
28392 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
28393 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
28394 return (uint64_t)ret_conv;
28397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
28401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28402 LDKInvoice this_obj_conv;
28403 this_obj_conv.inner = (void*)(this_obj & (~1));
28404 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28405 Invoice_free(this_obj_conv);
28408 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28410 a_conv.inner = (void*)(a & (~1));
28411 a_conv.is_owned = false;
28413 b_conv.inner = (void*)(b & (~1));
28414 b_conv.is_owned = false;
28415 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
28419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28420 LDKInvoice orig_conv;
28421 orig_conv.inner = (void*)(orig & (~1));
28422 orig_conv.is_owned = false;
28423 LDKInvoice ret_var = Invoice_clone(&orig_conv);
28424 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28425 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28426 uint64_t ret_ref = (uint64_t)ret_var.inner;
28427 if (ret_var.is_owned) {
28433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28434 LDKSignedRawInvoice this_obj_conv;
28435 this_obj_conv.inner = (void*)(this_obj & (~1));
28436 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28437 SignedRawInvoice_free(this_obj_conv);
28440 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28441 LDKSignedRawInvoice a_conv;
28442 a_conv.inner = (void*)(a & (~1));
28443 a_conv.is_owned = false;
28444 LDKSignedRawInvoice b_conv;
28445 b_conv.inner = (void*)(b & (~1));
28446 b_conv.is_owned = false;
28447 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
28451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28452 LDKSignedRawInvoice orig_conv;
28453 orig_conv.inner = (void*)(orig & (~1));
28454 orig_conv.is_owned = false;
28455 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
28456 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28457 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28458 uint64_t ret_ref = (uint64_t)ret_var.inner;
28459 if (ret_var.is_owned) {
28465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28466 LDKRawInvoice this_obj_conv;
28467 this_obj_conv.inner = (void*)(this_obj & (~1));
28468 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28469 RawInvoice_free(this_obj_conv);
28472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
28473 LDKRawInvoice this_ptr_conv;
28474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28475 this_ptr_conv.is_owned = false;
28476 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
28477 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28478 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28479 uint64_t ret_ref = (uint64_t)ret_var.inner;
28480 if (ret_var.is_owned) {
28486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28487 LDKRawInvoice this_ptr_conv;
28488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28489 this_ptr_conv.is_owned = false;
28490 LDKRawDataPart val_conv;
28491 val_conv.inner = (void*)(val & (~1));
28492 val_conv.is_owned = (val & 1) || (val == 0);
28493 val_conv = RawDataPart_clone(&val_conv);
28494 RawInvoice_set_data(&this_ptr_conv, val_conv);
28497 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28498 LDKRawInvoice a_conv;
28499 a_conv.inner = (void*)(a & (~1));
28500 a_conv.is_owned = false;
28501 LDKRawInvoice b_conv;
28502 b_conv.inner = (void*)(b & (~1));
28503 b_conv.is_owned = false;
28504 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
28508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28509 LDKRawInvoice orig_conv;
28510 orig_conv.inner = (void*)(orig & (~1));
28511 orig_conv.is_owned = false;
28512 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
28513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28515 uint64_t ret_ref = (uint64_t)ret_var.inner;
28516 if (ret_var.is_owned) {
28522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28523 LDKRawDataPart this_obj_conv;
28524 this_obj_conv.inner = (void*)(this_obj & (~1));
28525 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28526 RawDataPart_free(this_obj_conv);
28529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
28530 LDKRawDataPart this_ptr_conv;
28531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28532 this_ptr_conv.is_owned = false;
28533 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
28534 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28535 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28536 uint64_t ret_ref = (uint64_t)ret_var.inner;
28537 if (ret_var.is_owned) {
28543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
28544 LDKRawDataPart this_ptr_conv;
28545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
28546 this_ptr_conv.is_owned = false;
28547 LDKPositiveTimestamp val_conv;
28548 val_conv.inner = (void*)(val & (~1));
28549 val_conv.is_owned = (val & 1) || (val == 0);
28550 val_conv = PositiveTimestamp_clone(&val_conv);
28551 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
28554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28555 LDKRawDataPart a_conv;
28556 a_conv.inner = (void*)(a & (~1));
28557 a_conv.is_owned = false;
28558 LDKRawDataPart b_conv;
28559 b_conv.inner = (void*)(b & (~1));
28560 b_conv.is_owned = false;
28561 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
28565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28566 LDKRawDataPart orig_conv;
28567 orig_conv.inner = (void*)(orig & (~1));
28568 orig_conv.is_owned = false;
28569 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
28570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28572 uint64_t ret_ref = (uint64_t)ret_var.inner;
28573 if (ret_var.is_owned) {
28579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28580 LDKPositiveTimestamp this_obj_conv;
28581 this_obj_conv.inner = (void*)(this_obj & (~1));
28582 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28583 PositiveTimestamp_free(this_obj_conv);
28586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28587 LDKPositiveTimestamp a_conv;
28588 a_conv.inner = (void*)(a & (~1));
28589 a_conv.is_owned = false;
28590 LDKPositiveTimestamp b_conv;
28591 b_conv.inner = (void*)(b & (~1));
28592 b_conv.is_owned = false;
28593 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
28597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28598 LDKPositiveTimestamp orig_conv;
28599 orig_conv.inner = (void*)(orig & (~1));
28600 orig_conv.is_owned = false;
28601 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
28602 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28603 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28604 uint64_t ret_ref = (uint64_t)ret_var.inner;
28605 if (ret_var.is_owned) {
28611 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28612 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
28613 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
28617 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
28618 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
28622 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
28623 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
28627 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
28628 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
28632 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
28633 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
28637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28638 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
28639 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
28640 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
28644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
28645 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
28646 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
28650 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28651 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
28652 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
28656 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
28657 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
28661 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
28662 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
28666 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
28667 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
28671 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
28672 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
28676 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
28677 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
28681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
28682 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
28683 int64_t ret_val = Currency_hash(o_conv);
28687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28688 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
28689 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
28690 jboolean ret_val = Currency_eq(a_conv, b_conv);
28694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28695 LDKSha256 this_obj_conv;
28696 this_obj_conv.inner = (void*)(this_obj & (~1));
28697 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28698 Sha256_free(this_obj_conv);
28701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28702 LDKSha256 orig_conv;
28703 orig_conv.inner = (void*)(orig & (~1));
28704 orig_conv.is_owned = false;
28705 LDKSha256 ret_var = Sha256_clone(&orig_conv);
28706 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28707 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28708 uint64_t ret_ref = (uint64_t)ret_var.inner;
28709 if (ret_var.is_owned) {
28715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
28717 o_conv.inner = (void*)(o & (~1));
28718 o_conv.is_owned = false;
28719 int64_t ret_val = Sha256_hash(&o_conv);
28723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28725 a_conv.inner = (void*)(a & (~1));
28726 a_conv.is_owned = false;
28728 b_conv.inner = (void*)(b & (~1));
28729 b_conv.is_owned = false;
28730 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
28734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28735 LDKDescription this_obj_conv;
28736 this_obj_conv.inner = (void*)(this_obj & (~1));
28737 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28738 Description_free(this_obj_conv);
28741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28742 LDKDescription orig_conv;
28743 orig_conv.inner = (void*)(orig & (~1));
28744 orig_conv.is_owned = false;
28745 LDKDescription ret_var = Description_clone(&orig_conv);
28746 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28747 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28748 uint64_t ret_ref = (uint64_t)ret_var.inner;
28749 if (ret_var.is_owned) {
28755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
28756 LDKDescription o_conv;
28757 o_conv.inner = (void*)(o & (~1));
28758 o_conv.is_owned = false;
28759 int64_t ret_val = Description_hash(&o_conv);
28763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28764 LDKDescription a_conv;
28765 a_conv.inner = (void*)(a & (~1));
28766 a_conv.is_owned = false;
28767 LDKDescription b_conv;
28768 b_conv.inner = (void*)(b & (~1));
28769 b_conv.is_owned = false;
28770 jboolean ret_val = Description_eq(&a_conv, &b_conv);
28774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28775 LDKPayeePubKey this_obj_conv;
28776 this_obj_conv.inner = (void*)(this_obj & (~1));
28777 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28778 PayeePubKey_free(this_obj_conv);
28781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28782 LDKPayeePubKey orig_conv;
28783 orig_conv.inner = (void*)(orig & (~1));
28784 orig_conv.is_owned = false;
28785 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
28786 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28787 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28788 uint64_t ret_ref = (uint64_t)ret_var.inner;
28789 if (ret_var.is_owned) {
28795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
28796 LDKPayeePubKey o_conv;
28797 o_conv.inner = (void*)(o & (~1));
28798 o_conv.is_owned = false;
28799 int64_t ret_val = PayeePubKey_hash(&o_conv);
28803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28804 LDKPayeePubKey a_conv;
28805 a_conv.inner = (void*)(a & (~1));
28806 a_conv.is_owned = false;
28807 LDKPayeePubKey b_conv;
28808 b_conv.inner = (void*)(b & (~1));
28809 b_conv.is_owned = false;
28810 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
28814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28815 LDKExpiryTime this_obj_conv;
28816 this_obj_conv.inner = (void*)(this_obj & (~1));
28817 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28818 ExpiryTime_free(this_obj_conv);
28821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28822 LDKExpiryTime orig_conv;
28823 orig_conv.inner = (void*)(orig & (~1));
28824 orig_conv.is_owned = false;
28825 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
28826 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28827 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28828 uint64_t ret_ref = (uint64_t)ret_var.inner;
28829 if (ret_var.is_owned) {
28835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
28836 LDKExpiryTime o_conv;
28837 o_conv.inner = (void*)(o & (~1));
28838 o_conv.is_owned = false;
28839 int64_t ret_val = ExpiryTime_hash(&o_conv);
28843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28844 LDKExpiryTime a_conv;
28845 a_conv.inner = (void*)(a & (~1));
28846 a_conv.is_owned = false;
28847 LDKExpiryTime b_conv;
28848 b_conv.inner = (void*)(b & (~1));
28849 b_conv.is_owned = false;
28850 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
28854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28855 LDKMinFinalCltvExpiry this_obj_conv;
28856 this_obj_conv.inner = (void*)(this_obj & (~1));
28857 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28858 MinFinalCltvExpiry_free(this_obj_conv);
28861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28862 LDKMinFinalCltvExpiry orig_conv;
28863 orig_conv.inner = (void*)(orig & (~1));
28864 orig_conv.is_owned = false;
28865 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
28866 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28867 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28868 uint64_t ret_ref = (uint64_t)ret_var.inner;
28869 if (ret_var.is_owned) {
28875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
28876 LDKMinFinalCltvExpiry o_conv;
28877 o_conv.inner = (void*)(o & (~1));
28878 o_conv.is_owned = false;
28879 int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
28883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28884 LDKMinFinalCltvExpiry a_conv;
28885 a_conv.inner = (void*)(a & (~1));
28886 a_conv.is_owned = false;
28887 LDKMinFinalCltvExpiry b_conv;
28888 b_conv.inner = (void*)(b & (~1));
28889 b_conv.is_owned = false;
28890 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
28894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
28895 if ((this_ptr & 1) != 0) return;
28896 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
28897 FREE((void*)this_ptr);
28898 Fallback_free(this_ptr_conv);
28901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28902 LDKFallback* orig_conv = (LDKFallback*)orig;
28903 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28904 *ret_copy = Fallback_clone(orig_conv);
28905 uint64_t ret_ref = (uint64_t)ret_copy;
28909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
28911 LDKCVec_u8Z program_ref;
28912 program_ref.datalen = (*env)->GetArrayLength(env, program);
28913 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
28914 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
28915 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28916 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
28917 uint64_t ret_ref = (uint64_t)ret_copy;
28921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
28922 LDKTwentyBytes a_ref;
28923 CHECK((*env)->GetArrayLength(env, a) == 20);
28924 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
28925 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28926 *ret_copy = Fallback_pub_key_hash(a_ref);
28927 uint64_t ret_ref = (uint64_t)ret_copy;
28931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
28932 LDKTwentyBytes a_ref;
28933 CHECK((*env)->GetArrayLength(env, a) == 20);
28934 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
28935 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
28936 *ret_copy = Fallback_script_hash(a_ref);
28937 uint64_t ret_ref = (uint64_t)ret_copy;
28941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
28942 LDKFallback* o_conv = (LDKFallback*)o;
28943 int64_t ret_val = Fallback_hash(o_conv);
28947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28948 LDKFallback* a_conv = (LDKFallback*)a;
28949 LDKFallback* b_conv = (LDKFallback*)b;
28950 jboolean ret_val = Fallback_eq(a_conv, b_conv);
28954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28955 LDKInvoiceSignature this_obj_conv;
28956 this_obj_conv.inner = (void*)(this_obj & (~1));
28957 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28958 InvoiceSignature_free(this_obj_conv);
28961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28962 LDKInvoiceSignature orig_conv;
28963 orig_conv.inner = (void*)(orig & (~1));
28964 orig_conv.is_owned = false;
28965 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
28966 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28967 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
28968 uint64_t ret_ref = (uint64_t)ret_var.inner;
28969 if (ret_var.is_owned) {
28975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
28976 LDKInvoiceSignature a_conv;
28977 a_conv.inner = (void*)(a & (~1));
28978 a_conv.is_owned = false;
28979 LDKInvoiceSignature b_conv;
28980 b_conv.inner = (void*)(b & (~1));
28981 b_conv.is_owned = false;
28982 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
28986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
28987 LDKPrivateRoute this_obj_conv;
28988 this_obj_conv.inner = (void*)(this_obj & (~1));
28989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
28990 PrivateRoute_free(this_obj_conv);
28993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28994 LDKPrivateRoute orig_conv;
28995 orig_conv.inner = (void*)(orig & (~1));
28996 orig_conv.is_owned = false;
28997 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
28998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
28999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29000 uint64_t ret_ref = (uint64_t)ret_var.inner;
29001 if (ret_var.is_owned) {
29007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
29008 LDKPrivateRoute o_conv;
29009 o_conv.inner = (void*)(o & (~1));
29010 o_conv.is_owned = false;
29011 int64_t ret_val = PrivateRoute_hash(&o_conv);
29015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29016 LDKPrivateRoute a_conv;
29017 a_conv.inner = (void*)(a & (~1));
29018 a_conv.is_owned = false;
29019 LDKPrivateRoute b_conv;
29020 b_conv.inner = (void*)(b & (~1));
29021 b_conv.is_owned = false;
29022 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
29026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
29027 LDKSignedRawInvoice this_arg_conv;
29028 this_arg_conv.inner = (void*)(this_arg & (~1));
29029 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29030 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
29031 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
29032 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
29033 return (uint64_t)ret_ref;
29036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
29037 LDKSignedRawInvoice this_arg_conv;
29038 this_arg_conv.inner = (void*)(this_arg & (~1));
29039 this_arg_conv.is_owned = false;
29040 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
29041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29043 uint64_t ret_ref = (uint64_t)ret_var.inner;
29044 if (ret_var.is_owned) {
29050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29051 LDKSignedRawInvoice this_arg_conv;
29052 this_arg_conv.inner = (void*)(this_arg & (~1));
29053 this_arg_conv.is_owned = false;
29054 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29055 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
29059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29060 LDKSignedRawInvoice this_arg_conv;
29061 this_arg_conv.inner = (void*)(this_arg & (~1));
29062 this_arg_conv.is_owned = false;
29063 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
29064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29066 uint64_t ret_ref = (uint64_t)ret_var.inner;
29067 if (ret_var.is_owned) {
29073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29074 LDKSignedRawInvoice this_arg_conv;
29075 this_arg_conv.inner = (void*)(this_arg & (~1));
29076 this_arg_conv.is_owned = false;
29077 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
29078 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
29079 return (uint64_t)ret_conv;
29082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29083 LDKSignedRawInvoice this_arg_conv;
29084 this_arg_conv.inner = (void*)(this_arg & (~1));
29085 this_arg_conv.is_owned = false;
29086 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
29090 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29091 LDKRawInvoice this_arg_conv;
29092 this_arg_conv.inner = (void*)(this_arg & (~1));
29093 this_arg_conv.is_owned = false;
29094 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29095 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
29099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29100 LDKRawInvoice this_arg_conv;
29101 this_arg_conv.inner = (void*)(this_arg & (~1));
29102 this_arg_conv.is_owned = false;
29103 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
29104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29106 uint64_t ret_ref = (uint64_t)ret_var.inner;
29107 if (ret_var.is_owned) {
29113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
29114 LDKRawInvoice this_arg_conv;
29115 this_arg_conv.inner = (void*)(this_arg & (~1));
29116 this_arg_conv.is_owned = false;
29117 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
29118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29120 uint64_t ret_ref = (uint64_t)ret_var.inner;
29121 if (ret_var.is_owned) {
29127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29128 LDKRawInvoice this_arg_conv;
29129 this_arg_conv.inner = (void*)(this_arg & (~1));
29130 this_arg_conv.is_owned = false;
29131 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
29132 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29133 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29134 uint64_t ret_ref = (uint64_t)ret_var.inner;
29135 if (ret_var.is_owned) {
29141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29142 LDKRawInvoice this_arg_conv;
29143 this_arg_conv.inner = (void*)(this_arg & (~1));
29144 this_arg_conv.is_owned = false;
29145 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
29146 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29147 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29148 uint64_t ret_ref = (uint64_t)ret_var.inner;
29149 if (ret_var.is_owned) {
29155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29156 LDKRawInvoice this_arg_conv;
29157 this_arg_conv.inner = (void*)(this_arg & (~1));
29158 this_arg_conv.is_owned = false;
29159 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
29160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29162 uint64_t ret_ref = (uint64_t)ret_var.inner;
29163 if (ret_var.is_owned) {
29169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29170 LDKRawInvoice this_arg_conv;
29171 this_arg_conv.inner = (void*)(this_arg & (~1));
29172 this_arg_conv.is_owned = false;
29173 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
29174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29176 uint64_t ret_ref = (uint64_t)ret_var.inner;
29177 if (ret_var.is_owned) {
29183 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29184 LDKRawInvoice this_arg_conv;
29185 this_arg_conv.inner = (void*)(this_arg & (~1));
29186 this_arg_conv.is_owned = false;
29187 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29188 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
29192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29193 LDKRawInvoice this_arg_conv;
29194 this_arg_conv.inner = (void*)(this_arg & (~1));
29195 this_arg_conv.is_owned = false;
29196 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
29197 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29198 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29199 uint64_t ret_ref = (uint64_t)ret_var.inner;
29200 if (ret_var.is_owned) {
29206 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29207 LDKRawInvoice this_arg_conv;
29208 this_arg_conv.inner = (void*)(this_arg & (~1));
29209 this_arg_conv.is_owned = false;
29210 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
29211 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29212 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29213 for (size_t o = 0; o < ret_var.datalen; o++) {
29214 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29215 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29216 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29217 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29218 if (ret_conv_14_var.is_owned) {
29219 ret_conv_14_ref |= 1;
29221 ret_arr_ptr[o] = ret_conv_14_ref;
29223 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29224 FREE(ret_var.data);
29228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29229 LDKRawInvoice this_arg_conv;
29230 this_arg_conv.inner = (void*)(this_arg & (~1));
29231 this_arg_conv.is_owned = false;
29232 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29233 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
29234 uint64_t ret_ref = (uint64_t)ret_copy;
29238 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29239 LDKRawInvoice this_arg_conv;
29240 this_arg_conv.inner = (void*)(this_arg & (~1));
29241 this_arg_conv.is_owned = false;
29242 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
29246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
29247 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29248 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
29249 return (uint64_t)ret_conv;
29252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
29253 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
29254 *ret_conv = PositiveTimestamp_from_system_time(time);
29255 return (uint64_t)ret_conv;
29258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29259 LDKPositiveTimestamp this_arg_conv;
29260 this_arg_conv.inner = (void*)(this_arg & (~1));
29261 this_arg_conv.is_owned = false;
29262 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
29266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29267 LDKPositiveTimestamp this_arg_conv;
29268 this_arg_conv.inner = (void*)(this_arg & (~1));
29269 this_arg_conv.is_owned = false;
29270 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
29274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
29275 LDKInvoice this_arg_conv;
29276 this_arg_conv.inner = (void*)(this_arg & (~1));
29277 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29278 this_arg_conv = Invoice_clone(&this_arg_conv);
29279 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
29280 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29281 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29282 uint64_t ret_ref = (uint64_t)ret_var.inner;
29283 if (ret_var.is_owned) {
29289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
29290 LDKInvoice this_arg_conv;
29291 this_arg_conv.inner = (void*)(this_arg & (~1));
29292 this_arg_conv.is_owned = false;
29293 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
29294 *ret_conv = Invoice_check_signature(&this_arg_conv);
29295 return (uint64_t)ret_conv;
29298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
29299 LDKSignedRawInvoice signed_invoice_conv;
29300 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
29301 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
29302 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
29303 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
29304 *ret_conv = Invoice_from_signed(signed_invoice_conv);
29305 return (uint64_t)ret_conv;
29308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
29309 LDKInvoice this_arg_conv;
29310 this_arg_conv.inner = (void*)(this_arg & (~1));
29311 this_arg_conv.is_owned = false;
29312 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
29316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
29317 LDKInvoice this_arg_conv;
29318 this_arg_conv.inner = (void*)(this_arg & (~1));
29319 this_arg_conv.is_owned = false;
29320 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29321 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
29325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29326 LDKInvoice this_arg_conv;
29327 this_arg_conv.inner = (void*)(this_arg & (~1));
29328 this_arg_conv.is_owned = false;
29329 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29330 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
29334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
29335 LDKInvoice this_arg_conv;
29336 this_arg_conv.inner = (void*)(this_arg & (~1));
29337 this_arg_conv.is_owned = false;
29338 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
29339 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
29343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
29344 LDKInvoice this_arg_conv;
29345 this_arg_conv.inner = (void*)(this_arg & (~1));
29346 this_arg_conv.is_owned = false;
29347 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
29348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29350 uint64_t ret_ref = (uint64_t)ret_var.inner;
29351 if (ret_var.is_owned) {
29357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
29358 LDKInvoice this_arg_conv;
29359 this_arg_conv.inner = (void*)(this_arg & (~1));
29360 this_arg_conv.is_owned = false;
29361 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
29362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
29366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
29367 LDKInvoice this_arg_conv;
29368 this_arg_conv.inner = (void*)(this_arg & (~1));
29369 this_arg_conv.is_owned = false;
29370 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
29374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
29375 LDKInvoice this_arg_conv;
29376 this_arg_conv.inner = (void*)(this_arg & (~1));
29377 this_arg_conv.is_owned = false;
29378 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
29382 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
29383 LDKInvoice this_arg_conv;
29384 this_arg_conv.inner = (void*)(this_arg & (~1));
29385 this_arg_conv.is_owned = false;
29386 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
29387 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29388 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29389 for (size_t o = 0; o < ret_var.datalen; o++) {
29390 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
29391 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29392 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29393 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
29394 if (ret_conv_14_var.is_owned) {
29395 ret_conv_14_ref |= 1;
29397 ret_arr_ptr[o] = ret_conv_14_ref;
29399 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29400 FREE(ret_var.data);
29404 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
29405 LDKInvoice this_arg_conv;
29406 this_arg_conv.inner = (void*)(this_arg & (~1));
29407 this_arg_conv.is_owned = false;
29408 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
29409 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
29410 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
29411 for (size_t l = 0; l < ret_var.datalen; l++) {
29412 LDKRouteHint ret_conv_11_var = ret_var.data[l];
29413 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29414 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29415 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
29416 if (ret_conv_11_var.is_owned) {
29417 ret_conv_11_ref |= 1;
29419 ret_arr_ptr[l] = ret_conv_11_ref;
29421 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
29422 FREE(ret_var.data);
29426 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
29427 LDKInvoice this_arg_conv;
29428 this_arg_conv.inner = (void*)(this_arg & (~1));
29429 this_arg_conv.is_owned = false;
29430 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
29434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
29435 LDKInvoice this_arg_conv;
29436 this_arg_conv.inner = (void*)(this_arg & (~1));
29437 this_arg_conv.is_owned = false;
29438 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29439 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
29440 uint64_t ret_ref = (uint64_t)ret_copy;
29444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
29445 LDKStr description_conv = java_to_owned_str(env, description);
29446 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
29447 *ret_conv = Description_new(description_conv);
29448 return (uint64_t)ret_conv;
29451 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29452 LDKDescription this_arg_conv;
29453 this_arg_conv.inner = (void*)(this_arg & (~1));
29454 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29455 this_arg_conv = Description_clone(&this_arg_conv);
29456 LDKStr ret_str = Description_into_inner(this_arg_conv);
29457 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
29463 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29464 *ret_conv = ExpiryTime_from_seconds(seconds);
29465 return (uint64_t)ret_conv;
29468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
29469 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
29470 *ret_conv = ExpiryTime_from_duration(duration);
29471 return (uint64_t)ret_conv;
29474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
29475 LDKExpiryTime this_arg_conv;
29476 this_arg_conv.inner = (void*)(this_arg & (~1));
29477 this_arg_conv.is_owned = false;
29478 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
29482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
29483 LDKExpiryTime this_arg_conv;
29484 this_arg_conv.inner = (void*)(this_arg & (~1));
29485 this_arg_conv.is_owned = false;
29486 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
29490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
29491 LDKRouteHint hops_conv;
29492 hops_conv.inner = (void*)(hops & (~1));
29493 hops_conv.is_owned = (hops & 1) || (hops == 0);
29494 hops_conv = RouteHint_clone(&hops_conv);
29495 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
29496 *ret_conv = PrivateRoute_new(hops_conv);
29497 return (uint64_t)ret_conv;
29500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
29501 LDKPrivateRoute this_arg_conv;
29502 this_arg_conv.inner = (void*)(this_arg & (~1));
29503 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
29504 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
29505 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
29506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
29507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
29508 uint64_t ret_ref = (uint64_t)ret_var.inner;
29509 if (ret_var.is_owned) {
29515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29516 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
29517 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
29521 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
29522 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
29526 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
29527 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
29531 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29532 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
29536 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
29537 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
29541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29542 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
29543 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
29544 jboolean ret_val = CreationError_eq(a_conv, b_conv);
29548 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29549 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
29550 LDKStr ret_str = CreationError_to_str(o_conv);
29551 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29556 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29557 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
29558 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
29562 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
29563 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
29567 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
29568 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
29572 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
29573 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
29577 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
29578 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
29582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
29583 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
29587 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
29588 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
29592 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
29593 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
29597 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
29598 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
29602 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
29603 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
29607 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
29608 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
29612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29613 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
29614 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
29615 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
29619 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29620 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
29621 LDKStr ret_str = SemanticError_to_str(o_conv);
29622 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
29628 if ((this_ptr & 1) != 0) return;
29629 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
29630 FREE((void*)this_ptr);
29631 SignOrCreationError_free(this_ptr_conv);
29634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29635 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
29636 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29637 *ret_copy = SignOrCreationError_clone(orig_conv);
29638 uint64_t ret_ref = (uint64_t)ret_copy;
29642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
29643 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29644 *ret_copy = SignOrCreationError_sign_error();
29645 uint64_t ret_ref = (uint64_t)ret_copy;
29649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
29650 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
29651 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
29652 *ret_copy = SignOrCreationError_creation_error(a_conv);
29653 uint64_t ret_ref = (uint64_t)ret_copy;
29657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
29658 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
29659 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
29660 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
29664 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29665 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
29666 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
29667 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29672 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) {
29673 LDKChannelManager channelmanager_conv;
29674 channelmanager_conv.inner = (void*)(channelmanager & (~1));
29675 channelmanager_conv.is_owned = false;
29676 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
29677 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29678 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29679 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29681 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
29682 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
29683 amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
29684 LDKStr description_conv = java_to_owned_str(env, description);
29685 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
29686 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
29687 return (uint64_t)ret_conv;
29690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29691 LDKStr s_conv = java_to_owned_str(env, s);
29692 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
29693 *ret_conv = SiPrefix_from_str(s_conv);
29694 return (uint64_t)ret_conv;
29697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29698 LDKStr s_conv = java_to_owned_str(env, s);
29699 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
29700 *ret_conv = Invoice_from_str(s_conv);
29701 return (uint64_t)ret_conv;
29704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
29705 LDKStr s_conv = java_to_owned_str(env, s);
29706 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
29707 *ret_conv = SignedRawInvoice_from_str(s_conv);
29708 return (uint64_t)ret_conv;
29711 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29713 o_conv.inner = (void*)(o & (~1));
29714 o_conv.is_owned = false;
29715 LDKStr ret_str = Invoice_to_str(&o_conv);
29716 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29721 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29722 LDKSignedRawInvoice o_conv;
29723 o_conv.inner = (void*)(o & (~1));
29724 o_conv.is_owned = false;
29725 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
29726 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29731 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29732 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
29733 LDKStr ret_str = Currency_to_str(o_conv);
29734 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
29739 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
29740 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
29741 LDKStr ret_str = SiPrefix_to_str(o_conv);
29742 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);