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.100.0", strlen("v0.0.100.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_MultiplePaymentSecrets;
618 case 5: return LDKSemanticError_InvalidFeatures;
619 case 6: return LDKSemanticError_InvalidRecoveryId;
620 case 7: return LDKSemanticError_InvalidSignature;
624 static jclass SemanticError_class = NULL;
625 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
626 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
627 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
628 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
629 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
630 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
631 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
632 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
633 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
634 SemanticError_class = (*env)->NewGlobalRef(env, clz);
635 CHECK(SemanticError_class != NULL);
636 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
637 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
638 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
639 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
640 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
641 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
642 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
644 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
646 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
648 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
650 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
653 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
655 case LDKSemanticError_NoPaymentHash:
656 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
657 case LDKSemanticError_MultiplePaymentHashes:
658 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
659 case LDKSemanticError_NoDescription:
660 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
661 case LDKSemanticError_MultipleDescriptions:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
663 case LDKSemanticError_MultiplePaymentSecrets:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
665 case LDKSemanticError_InvalidFeatures:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
667 case LDKSemanticError_InvalidRecoveryId:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
669 case LDKSemanticError_InvalidSignature:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
675 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
676 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
677 case 0: return LDKSiPrefix_Milli;
678 case 1: return LDKSiPrefix_Micro;
679 case 2: return LDKSiPrefix_Nano;
680 case 3: return LDKSiPrefix_Pico;
684 static jclass SiPrefix_class = NULL;
685 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
686 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
687 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
688 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
689 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
690 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
691 CHECK(SiPrefix_class != NULL);
692 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
693 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
694 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
695 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
696 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
697 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
698 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
699 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
701 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
703 case LDKSiPrefix_Milli:
704 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
705 case LDKSiPrefix_Micro:
706 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
707 case LDKSiPrefix_Nano:
708 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
709 case LDKSiPrefix_Pico:
710 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
716 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
717 ret->datalen = (*env)->GetArrayLength(env, elems);
718 if (ret->datalen == 0) {
721 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
722 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
723 for (size_t i = 0; i < ret->datalen; i++) {
724 ret->data[i] = java_elems[i];
726 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
728 return (uint64_t)ret;
730 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
731 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
732 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
735 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) {
736 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
737 LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
738 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
739 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
740 CVec_u8Z_free(ret_var);
744 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) {
745 LDKTxOut* thing_conv = (LDKTxOut*)(thing & ~1);
746 int64_t ret_val = TxOut_get_value(thing_conv);
750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
751 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
754 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
755 CHECK(val->result_ok);
756 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
757 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
761 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
762 CHECK(!val->result_ok);
763 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
766 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
767 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
770 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
771 CHECK(val->result_ok);
772 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
773 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
776 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
777 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
778 CHECK(!val->result_ok);
779 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
783 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
786 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
787 CHECK(val->result_ok);
788 LDKTxCreationKeys res_var = (*val->contents.result);
789 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
790 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
791 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
795 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
796 CHECK(!val->result_ok);
797 LDKDecodeError err_var = (*val->contents.err);
798 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
800 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
804 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
807 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
808 CHECK(val->result_ok);
809 LDKChannelPublicKeys res_var = (*val->contents.result);
810 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
811 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
812 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
816 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
817 CHECK(!val->result_ok);
818 LDKDecodeError err_var = (*val->contents.err);
819 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
820 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
821 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
825 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
828 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
829 CHECK(val->result_ok);
830 LDKTxCreationKeys res_var = (*val->contents.result);
831 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
832 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
833 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
836 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
837 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
838 CHECK(!val->result_ok);
839 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
842 static jclass LDKCOption_u32Z_Some_class = NULL;
843 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
844 static jclass LDKCOption_u32Z_None_class = NULL;
845 static jmethodID LDKCOption_u32Z_None_meth = NULL;
846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
847 LDKCOption_u32Z_Some_class =
848 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
849 CHECK(LDKCOption_u32Z_Some_class != NULL);
850 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
851 CHECK(LDKCOption_u32Z_Some_meth != NULL);
852 LDKCOption_u32Z_None_class =
853 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
854 CHECK(LDKCOption_u32Z_None_class != NULL);
855 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
856 CHECK(LDKCOption_u32Z_None_meth != NULL);
858 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
859 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
861 case LDKCOption_u32Z_Some: {
862 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
864 case LDKCOption_u32Z_None: {
865 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
871 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
874 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
875 CHECK(val->result_ok);
876 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
877 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
878 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
879 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
883 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
884 CHECK(!val->result_ok);
885 LDKDecodeError err_var = (*val->contents.err);
886 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
887 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
888 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
892 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
895 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
896 CHECK(val->result_ok);
897 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
898 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
899 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
900 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
904 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
905 CHECK(!val->result_ok);
906 LDKDecodeError err_var = (*val->contents.err);
907 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
908 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
909 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
913 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
916 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
917 CHECK(val->result_ok);
918 LDKChannelTransactionParameters res_var = (*val->contents.result);
919 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
920 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
921 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
925 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
926 CHECK(!val->result_ok);
927 LDKDecodeError err_var = (*val->contents.err);
928 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
934 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
937 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
938 CHECK(val->result_ok);
939 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
940 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
946 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
947 CHECK(!val->result_ok);
948 LDKDecodeError err_var = (*val->contents.err);
949 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
954 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
955 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
958 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
959 CHECK(val->result_ok);
960 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
961 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
962 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
963 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
967 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
968 CHECK(!val->result_ok);
969 LDKDecodeError err_var = (*val->contents.err);
970 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
976 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
979 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
980 CHECK(val->result_ok);
981 LDKCommitmentTransaction res_var = (*val->contents.result);
982 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
988 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
989 CHECK(!val->result_ok);
990 LDKDecodeError err_var = (*val->contents.err);
991 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
992 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
993 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
997 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1000 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1001 CHECK(val->result_ok);
1002 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1003 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1004 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1005 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1009 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1010 CHECK(!val->result_ok);
1011 return *val->contents.err;
1013 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1014 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1016 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1017 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1018 CHECK(val->result_ok);
1019 LDKCVec_SignatureZ res_var = (*val->contents.result);
1020 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1022 for (size_t i = 0; i < res_var.datalen; i++) {
1023 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1024 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1025 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1030 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1031 CHECK(!val->result_ok);
1032 return *val->contents.err;
1034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1035 return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
1037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1038 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1039 CHECK(val->result_ok);
1040 LDKShutdownScript res_var = (*val->contents.result);
1041 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1042 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1043 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1047 LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
1048 CHECK(!val->result_ok);
1049 LDKDecodeError err_var = (*val->contents.err);
1050 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1051 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1052 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1055 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1056 return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
1058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1059 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1060 CHECK(val->result_ok);
1061 LDKShutdownScript res_var = (*val->contents.result);
1062 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1063 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1064 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1068 LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
1069 CHECK(!val->result_ok);
1070 LDKInvalidShutdownScript err_var = (*val->contents.err);
1071 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1072 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1073 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1076 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1077 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1080 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1081 CHECK(val->result_ok);
1082 return *val->contents.result;
1084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1085 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1086 CHECK(!val->result_ok);
1087 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1091 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1094 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1095 CHECK(val->result_ok);
1096 LDKRouteHop res_var = (*val->contents.result);
1097 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1098 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1099 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1103 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1104 CHECK(!val->result_ok);
1105 LDKDecodeError err_var = (*val->contents.err);
1106 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1107 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1108 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1112 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1113 ret->datalen = (*env)->GetArrayLength(env, elems);
1114 if (ret->datalen == 0) {
1117 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1118 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1119 for (size_t i = 0; i < ret->datalen; i++) {
1120 int64_t arr_elem = java_elems[i];
1121 LDKRouteHop arr_elem_conv;
1122 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1123 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1124 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1125 ret->data[i] = arr_elem_conv;
1127 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1129 return (uint64_t)ret;
1131 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1132 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1133 for (size_t i = 0; i < ret.datalen; i++) {
1134 ret.data[i] = RouteHop_clone(&orig->data[i]);
1138 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1139 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1140 for (size_t i = 0; i < ret.datalen; i++) {
1141 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1145 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1146 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1149 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1150 CHECK(val->result_ok);
1151 LDKRoute res_var = (*val->contents.result);
1152 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1153 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1154 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1158 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1159 CHECK(!val->result_ok);
1160 LDKDecodeError err_var = (*val->contents.err);
1161 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1162 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1163 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1166 static jclass LDKCOption_u64Z_Some_class = NULL;
1167 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1168 static jclass LDKCOption_u64Z_None_class = NULL;
1169 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1171 LDKCOption_u64Z_Some_class =
1172 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1173 CHECK(LDKCOption_u64Z_Some_class != NULL);
1174 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1175 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1176 LDKCOption_u64Z_None_class =
1177 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1178 CHECK(LDKCOption_u64Z_None_class != NULL);
1179 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1180 CHECK(LDKCOption_u64Z_None_meth != NULL);
1182 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1183 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1185 case LDKCOption_u64Z_Some: {
1186 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1188 case LDKCOption_u64Z_None: {
1189 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1195 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1196 ret->datalen = (*env)->GetArrayLength(env, elems);
1197 if (ret->datalen == 0) {
1200 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1201 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1202 for (size_t i = 0; i < ret->datalen; i++) {
1203 int64_t arr_elem = java_elems[i];
1204 LDKChannelDetails arr_elem_conv;
1205 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1206 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1207 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1208 ret->data[i] = arr_elem_conv;
1210 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1212 return (uint64_t)ret;
1214 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1215 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1216 for (size_t i = 0; i < ret.datalen; i++) {
1217 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1222 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1223 ret->datalen = (*env)->GetArrayLength(env, elems);
1224 if (ret->datalen == 0) {
1227 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1228 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1229 for (size_t i = 0; i < ret->datalen; i++) {
1230 int64_t arr_elem = java_elems[i];
1231 LDKRouteHint arr_elem_conv;
1232 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1233 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1234 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1235 ret->data[i] = arr_elem_conv;
1237 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1239 return (uint64_t)ret;
1241 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1242 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1243 for (size_t i = 0; i < ret.datalen; i++) {
1244 ret.data[i] = RouteHint_clone(&orig->data[i]);
1248 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1249 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1252 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1253 CHECK(val->result_ok);
1254 LDKRoute res_var = (*val->contents.result);
1255 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1256 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1257 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1261 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1262 CHECK(!val->result_ok);
1263 LDKLightningError err_var = (*val->contents.err);
1264 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1265 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1266 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1269 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1270 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1273 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1274 CHECK(val->result_ok);
1275 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1276 return (uint64_t)res_ref;
1278 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1279 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1280 CHECK(!val->result_ok);
1281 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1285 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1287 LDKTransaction b_ref;
1288 b_ref.datalen = (*env)->GetArrayLength(env, b);
1289 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1290 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1291 b_ref.data_is_owned = false;
1293 return (uint64_t)ret;
1295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1296 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1300 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1301 LDKTransaction b_var = tuple->b;
1302 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1303 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1307 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1308 ret->datalen = (*env)->GetArrayLength(env, elems);
1309 if (ret->datalen == 0) {
1312 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1313 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1314 for (size_t i = 0; i < ret->datalen; i++) {
1315 int64_t arr_elem = java_elems[i];
1316 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1317 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1318 ret->data[i] = arr_elem_conv;
1320 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1322 return (uint64_t)ret;
1324 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1325 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1326 for (size_t i = 0; i < ret.datalen; i++) {
1327 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1331 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1332 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1333 for (size_t i = 0; i < ret.datalen; i++) {
1334 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1339 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1342 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1343 CHECK(val->result_ok);
1344 return *val->contents.result;
1346 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1347 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1348 CHECK(!val->result_ok);
1349 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1352 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1353 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1354 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1355 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1357 LDKMonitorEvent_HTLCEvent_class =
1358 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1359 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1360 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1361 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1362 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1363 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1364 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1365 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1366 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1368 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1369 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1371 case LDKMonitorEvent_HTLCEvent: {
1372 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1373 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1374 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1375 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1376 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1378 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1379 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1380 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1381 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1382 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1383 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1389 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1390 ret->datalen = (*env)->GetArrayLength(env, elems);
1391 if (ret->datalen == 0) {
1394 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1395 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1396 for (size_t i = 0; i < ret->datalen; i++) {
1397 int64_t arr_elem = java_elems[i];
1398 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1399 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1400 ret->data[i] = arr_elem_conv;
1402 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1404 return (uint64_t)ret;
1406 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1407 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1408 for (size_t i = 0; i < ret.datalen; i++) {
1409 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1413 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1414 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1415 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1416 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1418 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1419 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1420 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1421 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1422 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1423 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1424 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1425 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1426 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1427 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1429 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1430 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1432 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1433 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1434 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1436 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1437 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1442 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1443 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1444 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1445 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1446 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1447 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1449 LDKSpendableOutputDescriptor_StaticOutput_class =
1450 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1451 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1452 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1453 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1454 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1455 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1456 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1457 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1458 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1459 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1460 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1461 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1462 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1463 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1465 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1466 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1468 case LDKSpendableOutputDescriptor_StaticOutput: {
1469 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1470 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1471 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1472 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1473 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1474 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1476 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1477 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1478 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1479 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1480 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1481 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1483 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1484 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1485 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1486 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1487 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1488 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1494 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1495 ret->datalen = (*env)->GetArrayLength(env, elems);
1496 if (ret->datalen == 0) {
1499 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1500 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1501 for (size_t i = 0; i < ret->datalen; i++) {
1502 int64_t arr_elem = java_elems[i];
1503 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1504 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1505 ret->data[i] = arr_elem_conv;
1507 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1509 return (uint64_t)ret;
1511 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1512 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1513 for (size_t i = 0; i < ret.datalen; i++) {
1514 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1518 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1519 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1520 static jclass LDKErrorAction_IgnoreError_class = NULL;
1521 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1522 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1523 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1524 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1525 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1527 LDKErrorAction_DisconnectPeer_class =
1528 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1529 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1530 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1531 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1532 LDKErrorAction_IgnoreError_class =
1533 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1534 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1535 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1536 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1537 LDKErrorAction_IgnoreAndLog_class =
1538 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1539 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1540 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1541 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1542 LDKErrorAction_SendErrorMessage_class =
1543 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1544 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1545 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1546 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1548 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1549 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1551 case LDKErrorAction_DisconnectPeer: {
1552 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1553 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1554 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1555 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1556 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1558 case LDKErrorAction_IgnoreError: {
1559 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1561 case LDKErrorAction_IgnoreAndLog: {
1562 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1563 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1565 case LDKErrorAction_SendErrorMessage: {
1566 LDKErrorMessage msg_var = obj->send_error_message.msg;
1567 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1568 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1569 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1570 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1575 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1576 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1577 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1578 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1579 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1580 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1582 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1583 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1584 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1585 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1586 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1587 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1588 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1589 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1590 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1591 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1592 LDKHTLCFailChannelUpdate_NodeFailure_class =
1593 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1594 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1595 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1596 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1598 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1599 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1601 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1602 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1603 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1604 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1605 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1606 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1608 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1609 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1611 case LDKHTLCFailChannelUpdate_NodeFailure: {
1612 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1613 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1614 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1619 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1620 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1621 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1622 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1623 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1624 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1625 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1626 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1627 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1628 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1629 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1630 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1631 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1632 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1633 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1634 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1635 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1636 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1637 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1638 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1639 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1640 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1641 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1642 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1643 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1644 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1645 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1646 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1647 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1648 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1649 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1650 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1651 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1652 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1653 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1654 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1655 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1656 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1657 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1658 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1660 LDKMessageSendEvent_SendAcceptChannel_class =
1661 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1662 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1663 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1664 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1665 LDKMessageSendEvent_SendOpenChannel_class =
1666 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1667 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1668 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1669 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1670 LDKMessageSendEvent_SendFundingCreated_class =
1671 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1672 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1673 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1674 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1675 LDKMessageSendEvent_SendFundingSigned_class =
1676 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1677 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1678 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1679 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1680 LDKMessageSendEvent_SendFundingLocked_class =
1681 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1682 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1683 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1684 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1685 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1686 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1687 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1688 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1689 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1690 LDKMessageSendEvent_UpdateHTLCs_class =
1691 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1692 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1693 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1694 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1695 LDKMessageSendEvent_SendRevokeAndACK_class =
1696 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1697 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1698 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1699 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1700 LDKMessageSendEvent_SendClosingSigned_class =
1701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1702 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1703 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1704 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1705 LDKMessageSendEvent_SendShutdown_class =
1706 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1707 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1708 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1709 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1710 LDKMessageSendEvent_SendChannelReestablish_class =
1711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1712 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1713 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1714 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1715 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1716 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1717 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1718 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1719 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1720 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1722 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1723 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1724 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1725 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1726 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1727 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1728 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1729 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1730 LDKMessageSendEvent_SendChannelUpdate_class =
1731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1732 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1733 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1734 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1735 LDKMessageSendEvent_HandleError_class =
1736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1737 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1738 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1739 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1740 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1742 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1743 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1744 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1745 LDKMessageSendEvent_SendChannelRangeQuery_class =
1746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1747 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1748 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1749 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1750 LDKMessageSendEvent_SendShortIdsQuery_class =
1751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1752 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1753 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1754 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1755 LDKMessageSendEvent_SendReplyChannelRange_class =
1756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1757 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1758 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1759 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1761 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1762 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1764 case LDKMessageSendEvent_SendAcceptChannel: {
1765 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1766 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1767 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1768 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1769 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1770 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1771 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1773 case LDKMessageSendEvent_SendOpenChannel: {
1774 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1775 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1776 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1777 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1778 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1779 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1780 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1782 case LDKMessageSendEvent_SendFundingCreated: {
1783 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1784 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1785 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1786 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1787 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1788 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1789 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1791 case LDKMessageSendEvent_SendFundingSigned: {
1792 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1793 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1794 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1795 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1796 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1797 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1798 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1800 case LDKMessageSendEvent_SendFundingLocked: {
1801 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1802 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1803 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1804 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1805 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1806 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1807 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1809 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1810 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1811 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1812 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1813 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1814 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1815 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1816 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1818 case LDKMessageSendEvent_UpdateHTLCs: {
1819 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1820 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1821 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1822 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1823 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1824 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1825 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1827 case LDKMessageSendEvent_SendRevokeAndACK: {
1828 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1829 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1830 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1831 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1832 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1833 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1834 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1836 case LDKMessageSendEvent_SendClosingSigned: {
1837 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1838 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1839 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1840 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1841 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1842 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1843 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1845 case LDKMessageSendEvent_SendShutdown: {
1846 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1847 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1848 LDKShutdown msg_var = obj->send_shutdown.msg;
1849 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1850 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1851 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1852 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1854 case LDKMessageSendEvent_SendChannelReestablish: {
1855 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1856 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1857 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1858 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1859 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1860 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1861 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1863 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1864 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1865 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1866 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1867 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1868 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1869 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1870 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1871 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1872 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1874 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1875 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1876 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1877 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1878 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1879 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1881 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1882 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1883 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1884 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1885 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1886 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1888 case LDKMessageSendEvent_SendChannelUpdate: {
1889 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1890 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1891 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1892 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1893 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1894 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1895 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1897 case LDKMessageSendEvent_HandleError: {
1898 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1899 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1900 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1901 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1903 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1904 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1905 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1907 case LDKMessageSendEvent_SendChannelRangeQuery: {
1908 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1909 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1910 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1911 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1912 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1913 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1914 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1916 case LDKMessageSendEvent_SendShortIdsQuery: {
1917 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1918 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1919 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1920 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1921 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1922 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1923 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1925 case LDKMessageSendEvent_SendReplyChannelRange: {
1926 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1927 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1928 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1929 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1930 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1931 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1932 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1938 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1939 ret->datalen = (*env)->GetArrayLength(env, elems);
1940 if (ret->datalen == 0) {
1943 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1944 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1945 for (size_t i = 0; i < ret->datalen; i++) {
1946 int64_t arr_elem = java_elems[i];
1947 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1948 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1949 ret->data[i] = arr_elem_conv;
1951 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1953 return (uint64_t)ret;
1955 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1956 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1957 for (size_t i = 0; i < ret.datalen; i++) {
1958 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1963 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1966 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1967 CHECK(val->result_ok);
1968 LDKInitFeatures res_var = (*val->contents.result);
1969 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1970 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1971 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1975 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1976 CHECK(!val->result_ok);
1977 LDKDecodeError err_var = (*val->contents.err);
1978 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1979 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1980 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1984 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1987 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1988 CHECK(val->result_ok);
1989 LDKNodeFeatures res_var = (*val->contents.result);
1990 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1991 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1992 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1996 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1997 CHECK(!val->result_ok);
1998 LDKDecodeError err_var = (*val->contents.err);
1999 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2000 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2001 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2005 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2008 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2009 CHECK(val->result_ok);
2010 LDKChannelFeatures res_var = (*val->contents.result);
2011 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2012 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2013 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2017 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2018 CHECK(!val->result_ok);
2019 LDKDecodeError err_var = (*val->contents.err);
2020 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2021 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2022 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2026 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2029 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2030 CHECK(val->result_ok);
2031 LDKInvoiceFeatures res_var = (*val->contents.result);
2032 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2033 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2034 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2038 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2039 CHECK(!val->result_ok);
2040 LDKDecodeError err_var = (*val->contents.err);
2041 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2042 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2043 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2047 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2050 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2051 CHECK(val->result_ok);
2052 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2053 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2054 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2055 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2059 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2060 CHECK(!val->result_ok);
2061 LDKDecodeError err_var = (*val->contents.err);
2062 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2063 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2064 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2068 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2071 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2072 CHECK(val->result_ok);
2073 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2074 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2075 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2076 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2080 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2081 CHECK(!val->result_ok);
2082 LDKDecodeError err_var = (*val->contents.err);
2083 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2084 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2085 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2089 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2092 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2093 CHECK(val->result_ok);
2094 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2098 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2099 CHECK(!val->result_ok);
2100 LDKDecodeError err_var = (*val->contents.err);
2101 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2102 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2103 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2107 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2109 CHECK((*env)->GetArrayLength(env, a) == 64);
2110 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2112 LDKCVec_SignatureZ b_constr;
2113 b_constr.datalen = (*env)->GetArrayLength(env, b);
2114 if (b_constr.datalen > 0)
2115 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2117 b_constr.data = NULL;
2118 for (size_t i = 0; i < b_constr.datalen; i++) {
2119 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2120 LDKSignature b_conv_8_ref;
2121 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2122 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2123 b_constr.data[i] = b_conv_8_ref;
2126 return (uint64_t)ret;
2128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2129 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2130 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2131 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2134 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2135 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2136 LDKCVec_SignatureZ b_var = tuple->b;
2137 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2139 for (size_t i = 0; i < b_var.datalen; i++) {
2140 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2141 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2142 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2147 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2150 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2151 CHECK(val->result_ok);
2152 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2156 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2157 CHECK(!val->result_ok);
2158 return *val->contents.err;
2160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2161 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2164 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2165 CHECK(val->result_ok);
2166 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2167 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2171 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2172 CHECK(!val->result_ok);
2173 return *val->contents.err;
2175 typedef struct LDKBaseSign_JCalls {
2176 atomic_size_t refcnt;
2179 jmethodID get_per_commitment_point_meth;
2180 jmethodID release_commitment_secret_meth;
2181 jmethodID channel_keys_id_meth;
2182 jmethodID sign_counterparty_commitment_meth;
2183 jmethodID sign_holder_commitment_and_htlcs_meth;
2184 jmethodID sign_justice_revoked_output_meth;
2185 jmethodID sign_justice_revoked_htlc_meth;
2186 jmethodID sign_counterparty_htlc_transaction_meth;
2187 jmethodID sign_closing_transaction_meth;
2188 jmethodID sign_channel_announcement_meth;
2189 jmethodID ready_channel_meth;
2190 } LDKBaseSign_JCalls;
2191 static void LDKBaseSign_JCalls_free(void* this_arg) {
2192 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2193 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2195 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2196 if (get_jenv_res == JNI_EDETACHED) {
2197 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2199 DO_ASSERT(get_jenv_res == JNI_OK);
2201 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2202 if (get_jenv_res == JNI_EDETACHED) {
2203 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2208 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2209 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2211 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2212 if (get_jenv_res == JNI_EDETACHED) {
2213 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2215 DO_ASSERT(get_jenv_res == JNI_OK);
2217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2219 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2220 if ((*env)->ExceptionCheck(env)) {
2221 (*env)->ExceptionDescribe(env);
2222 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2224 LDKPublicKey ret_ref;
2225 CHECK((*env)->GetArrayLength(env, ret) == 33);
2226 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2227 if (get_jenv_res == JNI_EDETACHED) {
2228 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2232 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2233 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2235 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2236 if (get_jenv_res == JNI_EDETACHED) {
2237 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2239 DO_ASSERT(get_jenv_res == JNI_OK);
2241 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2243 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2244 if ((*env)->ExceptionCheck(env)) {
2245 (*env)->ExceptionDescribe(env);
2246 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2248 LDKThirtyTwoBytes ret_ref;
2249 CHECK((*env)->GetArrayLength(env, ret) == 32);
2250 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2251 if (get_jenv_res == JNI_EDETACHED) {
2252 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2256 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2257 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2259 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2260 if (get_jenv_res == JNI_EDETACHED) {
2261 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2263 DO_ASSERT(get_jenv_res == JNI_OK);
2265 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2267 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2268 if ((*env)->ExceptionCheck(env)) {
2269 (*env)->ExceptionDescribe(env);
2270 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2272 LDKThirtyTwoBytes ret_ref;
2273 CHECK((*env)->GetArrayLength(env, ret) == 32);
2274 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2275 if (get_jenv_res == JNI_EDETACHED) {
2276 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2280 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2281 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2283 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2284 if (get_jenv_res == JNI_EDETACHED) {
2285 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2287 DO_ASSERT(get_jenv_res == JNI_OK);
2289 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2290 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2291 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2292 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2293 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2294 if (commitment_tx_var.is_owned) {
2295 commitment_tx_ref |= 1;
2297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2299 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2300 if ((*env)->ExceptionCheck(env)) {
2301 (*env)->ExceptionDescribe(env);
2302 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2305 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2306 if (get_jenv_res == JNI_EDETACHED) {
2307 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2311 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2312 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2315 if (get_jenv_res == JNI_EDETACHED) {
2316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2318 DO_ASSERT(get_jenv_res == JNI_OK);
2320 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2321 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2322 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2323 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2324 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2325 if (commitment_tx_var.is_owned) {
2326 commitment_tx_ref |= 1;
2328 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2330 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2331 if ((*env)->ExceptionCheck(env)) {
2332 (*env)->ExceptionDescribe(env);
2333 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2335 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2336 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2337 if (get_jenv_res == JNI_EDETACHED) {
2338 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2342 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]) {
2343 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2345 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2346 if (get_jenv_res == JNI_EDETACHED) {
2347 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2349 DO_ASSERT(get_jenv_res == JNI_OK);
2351 LDKTransaction justice_tx_var = justice_tx;
2352 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2353 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2354 Transaction_free(justice_tx_var);
2355 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2356 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2359 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2360 if ((*env)->ExceptionCheck(env)) {
2361 (*env)->ExceptionDescribe(env);
2362 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2364 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2365 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2366 if (get_jenv_res == JNI_EDETACHED) {
2367 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2371 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) {
2372 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2374 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2375 if (get_jenv_res == JNI_EDETACHED) {
2376 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2378 DO_ASSERT(get_jenv_res == JNI_OK);
2380 LDKTransaction justice_tx_var = justice_tx;
2381 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2382 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2383 Transaction_free(justice_tx_var);
2384 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2385 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2386 LDKHTLCOutputInCommitment htlc_var = *htlc;
2387 htlc_var = HTLCOutputInCommitment_clone(htlc);
2388 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2389 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2390 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2391 if (htlc_var.is_owned) {
2394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2396 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);
2397 if ((*env)->ExceptionCheck(env)) {
2398 (*env)->ExceptionDescribe(env);
2399 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2401 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2402 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2403 if (get_jenv_res == JNI_EDETACHED) {
2404 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2408 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) {
2409 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2411 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2412 if (get_jenv_res == JNI_EDETACHED) {
2413 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2415 DO_ASSERT(get_jenv_res == JNI_OK);
2417 LDKTransaction htlc_tx_var = htlc_tx;
2418 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2419 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2420 Transaction_free(htlc_tx_var);
2421 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2422 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2423 LDKHTLCOutputInCommitment htlc_var = *htlc;
2424 htlc_var = HTLCOutputInCommitment_clone(htlc);
2425 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2426 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2427 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2428 if (htlc_var.is_owned) {
2431 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2433 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);
2434 if ((*env)->ExceptionCheck(env)) {
2435 (*env)->ExceptionDescribe(env);
2436 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2438 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2439 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2440 if (get_jenv_res == JNI_EDETACHED) {
2441 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2445 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2446 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2448 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2449 if (get_jenv_res == JNI_EDETACHED) {
2450 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2452 DO_ASSERT(get_jenv_res == JNI_OK);
2454 LDKTransaction closing_tx_var = closing_tx;
2455 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2456 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2457 Transaction_free(closing_tx_var);
2458 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2460 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2461 if ((*env)->ExceptionCheck(env)) {
2462 (*env)->ExceptionDescribe(env);
2463 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2465 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2466 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2467 if (get_jenv_res == JNI_EDETACHED) {
2468 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2472 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2473 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2475 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2476 if (get_jenv_res == JNI_EDETACHED) {
2477 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2479 DO_ASSERT(get_jenv_res == JNI_OK);
2481 LDKUnsignedChannelAnnouncement msg_var = *msg;
2482 msg_var = UnsignedChannelAnnouncement_clone(msg);
2483 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2484 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2485 uint64_t msg_ref = (uint64_t)msg_var.inner;
2486 if (msg_var.is_owned) {
2489 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2491 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2492 if ((*env)->ExceptionCheck(env)) {
2493 (*env)->ExceptionDescribe(env);
2494 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2496 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2497 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2498 if (get_jenv_res == JNI_EDETACHED) {
2499 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2503 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2504 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2506 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2507 if (get_jenv_res == JNI_EDETACHED) {
2508 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2510 DO_ASSERT(get_jenv_res == JNI_OK);
2512 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2513 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2514 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2515 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2516 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2517 if (channel_parameters_var.is_owned) {
2518 channel_parameters_ref |= 1;
2520 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2522 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2523 if ((*env)->ExceptionCheck(env)) {
2524 (*env)->ExceptionDescribe(env);
2525 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2527 if (get_jenv_res == JNI_EDETACHED) {
2528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2531 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2532 jclass c = (*env)->GetObjectClass(env, o);
2534 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2535 atomic_init(&calls->refcnt, 1);
2536 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2537 calls->o = (*env)->NewWeakGlobalRef(env, o);
2538 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2539 CHECK(calls->get_per_commitment_point_meth != NULL);
2540 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2541 CHECK(calls->release_commitment_secret_meth != NULL);
2542 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2543 CHECK(calls->channel_keys_id_meth != NULL);
2544 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2545 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2546 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2547 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2548 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2549 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2550 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2551 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2552 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2553 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2554 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2555 CHECK(calls->sign_closing_transaction_meth != NULL);
2556 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2557 CHECK(calls->sign_channel_announcement_meth != NULL);
2558 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2559 CHECK(calls->ready_channel_meth != NULL);
2561 LDKChannelPublicKeys pubkeys_conv;
2562 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2563 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2564 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2567 .this_arg = (void*) calls,
2568 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2569 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2570 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2571 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2572 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2573 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2574 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2575 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2576 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2577 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2578 .ready_channel = ready_channel_LDKBaseSign_jcall,
2579 .free = LDKBaseSign_JCalls_free,
2580 .pubkeys = pubkeys_conv,
2581 .set_pubkeys = NULL,
2585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2586 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2587 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2588 return (uint64_t)res_ptr;
2590 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) {
2591 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2592 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2593 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2598 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2599 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2600 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2605 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2606 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2611 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) {
2612 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2613 LDKCommitmentTransaction commitment_tx_conv;
2614 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2615 commitment_tx_conv.is_owned = false;
2616 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2617 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2618 return (uint64_t)ret_conv;
2621 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) {
2622 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2623 LDKHolderCommitmentTransaction commitment_tx_conv;
2624 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2625 commitment_tx_conv.is_owned = false;
2626 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2627 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2628 return (uint64_t)ret_conv;
2631 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) {
2632 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2633 LDKTransaction justice_tx_ref;
2634 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2635 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2636 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2637 justice_tx_ref.data_is_owned = true;
2638 unsigned char per_commitment_key_arr[32];
2639 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2640 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2641 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2642 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2643 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2644 return (uint64_t)ret_conv;
2647 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) {
2648 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2649 LDKTransaction justice_tx_ref;
2650 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2651 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2652 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2653 justice_tx_ref.data_is_owned = true;
2654 unsigned char per_commitment_key_arr[32];
2655 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2656 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2657 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2658 LDKHTLCOutputInCommitment htlc_conv;
2659 htlc_conv.inner = (void*)(htlc & (~1));
2660 htlc_conv.is_owned = false;
2661 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2662 *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);
2663 return (uint64_t)ret_conv;
2666 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) {
2667 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2668 LDKTransaction htlc_tx_ref;
2669 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2670 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2671 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2672 htlc_tx_ref.data_is_owned = true;
2673 LDKPublicKey per_commitment_point_ref;
2674 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2675 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2676 LDKHTLCOutputInCommitment htlc_conv;
2677 htlc_conv.inner = (void*)(htlc & (~1));
2678 htlc_conv.is_owned = false;
2679 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2680 *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);
2681 return (uint64_t)ret_conv;
2684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2685 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2686 LDKTransaction closing_tx_ref;
2687 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2688 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2689 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2690 closing_tx_ref.data_is_owned = true;
2691 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2692 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2693 return (uint64_t)ret_conv;
2696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2697 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2698 LDKUnsignedChannelAnnouncement msg_conv;
2699 msg_conv.inner = (void*)(msg & (~1));
2700 msg_conv.is_owned = false;
2701 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2702 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2703 return (uint64_t)ret_conv;
2706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2707 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2708 LDKChannelTransactionParameters channel_parameters_conv;
2709 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2710 channel_parameters_conv.is_owned = false;
2711 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2714 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2715 if (this_arg->set_pubkeys != NULL)
2716 this_arg->set_pubkeys(this_arg);
2717 return this_arg->pubkeys;
2719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2720 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2721 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2722 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2723 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2724 uint64_t ret_ref = (uint64_t)ret_var.inner;
2725 if (ret_var.is_owned) {
2731 typedef struct LDKSign_JCalls {
2732 atomic_size_t refcnt;
2735 LDKBaseSign_JCalls* BaseSign;
2736 jmethodID write_meth;
2738 static void LDKSign_JCalls_free(void* this_arg) {
2739 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2740 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2742 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2743 if (get_jenv_res == JNI_EDETACHED) {
2744 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2746 DO_ASSERT(get_jenv_res == JNI_OK);
2748 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2749 if (get_jenv_res == JNI_EDETACHED) {
2750 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2755 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2756 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2758 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2759 if (get_jenv_res == JNI_EDETACHED) {
2760 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2762 DO_ASSERT(get_jenv_res == JNI_OK);
2764 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2766 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2767 if ((*env)->ExceptionCheck(env)) {
2768 (*env)->ExceptionDescribe(env);
2769 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2771 LDKCVec_u8Z ret_ref;
2772 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2773 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2774 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2775 if (get_jenv_res == JNI_EDETACHED) {
2776 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2780 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2781 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2782 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2783 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2785 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2786 jclass c = (*env)->GetObjectClass(env, o);
2788 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2789 atomic_init(&calls->refcnt, 1);
2790 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2791 calls->o = (*env)->NewWeakGlobalRef(env, o);
2792 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2793 CHECK(calls->write_meth != NULL);
2795 LDKChannelPublicKeys pubkeys_conv;
2796 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2797 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2798 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2801 .this_arg = (void*) calls,
2802 .write = write_LDKSign_jcall,
2803 .cloned = LDKSign_JCalls_cloned,
2804 .free = LDKSign_JCalls_free,
2805 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2807 calls->BaseSign = ret.BaseSign.this_arg;
2810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2811 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2812 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2813 return (uint64_t)res_ptr;
2815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2816 LDKSign *inp = (LDKSign *)(arg & ~1);
2817 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2818 DO_ASSERT((res_ptr & 1) == 0);
2819 return (int64_t)(res_ptr | 1);
2821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2822 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2823 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2826 CVec_u8Z_free(ret_var);
2830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2831 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2834 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2835 CHECK(val->result_ok);
2836 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2837 *ret = Sign_clone(&(*val->contents.result));
2838 return (uint64_t)ret;
2840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2841 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2842 CHECK(!val->result_ok);
2843 LDKDecodeError err_var = (*val->contents.err);
2844 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2845 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2846 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2850 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2853 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2854 CHECK(val->result_ok);
2855 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2856 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2860 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2861 CHECK(!val->result_ok);
2862 return *val->contents.err;
2864 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2865 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2866 for (size_t i = 0; i < ret.datalen; i++) {
2867 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2872 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2874 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2875 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2876 CHECK(val->result_ok);
2877 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2878 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2880 for (size_t i = 0; i < res_var.datalen; i++) {
2881 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2882 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2883 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2884 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2889 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2890 CHECK(!val->result_ok);
2891 return *val->contents.err;
2893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2894 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2897 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2898 CHECK(val->result_ok);
2899 LDKInMemorySigner res_var = (*val->contents.result);
2900 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2901 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2902 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2906 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2907 CHECK(!val->result_ok);
2908 LDKDecodeError err_var = (*val->contents.err);
2909 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2910 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2911 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2915 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2916 ret->datalen = (*env)->GetArrayLength(env, elems);
2917 if (ret->datalen == 0) {
2920 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2921 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2922 for (size_t i = 0; i < ret->datalen; i++) {
2923 int64_t arr_elem = java_elems[i];
2924 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2925 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2926 ret->data[i] = arr_elem_conv;
2928 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2930 return (uint64_t)ret;
2932 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2933 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2934 for (size_t i = 0; i < ret.datalen; i++) {
2935 ret.data[i] = TxOut_clone(&orig->data[i]);
2939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2940 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2943 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2944 CHECK(val->result_ok);
2945 LDKTransaction res_var = (*val->contents.result);
2946 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2947 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2951 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2952 CHECK(!val->result_ok);
2953 return *val->contents.err;
2955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2956 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2957 LDKThirtyTwoBytes a_ref;
2958 CHECK((*env)->GetArrayLength(env, a) == 32);
2959 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2961 LDKChannelMonitor b_conv;
2962 b_conv.inner = (void*)(b & (~1));
2963 b_conv.is_owned = (b & 1) || (b == 0);
2964 b_conv = ChannelMonitor_clone(&b_conv);
2966 return (uint64_t)ret;
2968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2969 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2970 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2971 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2975 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2976 LDKChannelMonitor b_var = tuple->b;
2977 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2978 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2979 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2983 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2984 ret->datalen = (*env)->GetArrayLength(env, elems);
2985 if (ret->datalen == 0) {
2988 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2989 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2990 for (size_t i = 0; i < ret->datalen; i++) {
2991 int64_t arr_elem = java_elems[i];
2992 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2993 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2994 ret->data[i] = arr_elem_conv;
2996 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2998 return (uint64_t)ret;
3000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3001 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3003 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3004 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3005 CHECK(val->result_ok);
3006 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3007 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3008 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3009 for (size_t i = 0; i < res_var.datalen; i++) {
3010 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
3011 res_arr_ptr[i] = res_conv_34_ref;
3013 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3016 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3017 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3018 CHECK(!val->result_ok);
3019 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3022 static jclass LDKCOption_u16Z_Some_class = NULL;
3023 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3024 static jclass LDKCOption_u16Z_None_class = NULL;
3025 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3027 LDKCOption_u16Z_Some_class =
3028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3029 CHECK(LDKCOption_u16Z_Some_class != NULL);
3030 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3031 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3032 LDKCOption_u16Z_None_class =
3033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3034 CHECK(LDKCOption_u16Z_None_class != NULL);
3035 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3036 CHECK(LDKCOption_u16Z_None_meth != NULL);
3038 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3039 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3041 case LDKCOption_u16Z_Some: {
3042 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3044 case LDKCOption_u16Z_None: {
3045 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3050 static jclass LDKAPIError_APIMisuseError_class = NULL;
3051 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3052 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3053 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3054 static jclass LDKAPIError_RouteError_class = NULL;
3055 static jmethodID LDKAPIError_RouteError_meth = NULL;
3056 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3057 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3058 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3059 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3060 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
3061 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
3062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3063 LDKAPIError_APIMisuseError_class =
3064 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3065 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3066 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3067 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3068 LDKAPIError_FeeRateTooHigh_class =
3069 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3070 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3071 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3072 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3073 LDKAPIError_RouteError_class =
3074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3075 CHECK(LDKAPIError_RouteError_class != NULL);
3076 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3077 CHECK(LDKAPIError_RouteError_meth != NULL);
3078 LDKAPIError_ChannelUnavailable_class =
3079 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3080 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3081 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3082 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3083 LDKAPIError_MonitorUpdateFailed_class =
3084 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3085 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3086 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3087 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3088 LDKAPIError_IncompatibleShutdownScript_class =
3089 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
3090 CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
3091 LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
3092 CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
3094 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3095 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3097 case LDKAPIError_APIMisuseError: {
3098 LDKStr err_str = obj->api_misuse_error.err;
3099 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3100 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3102 case LDKAPIError_FeeRateTooHigh: {
3103 LDKStr err_str = obj->fee_rate_too_high.err;
3104 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3105 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3107 case LDKAPIError_RouteError: {
3108 LDKStr err_str = obj->route_error.err;
3109 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3110 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3112 case LDKAPIError_ChannelUnavailable: {
3113 LDKStr err_str = obj->channel_unavailable.err;
3114 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3115 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3117 case LDKAPIError_MonitorUpdateFailed: {
3118 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3120 case LDKAPIError_IncompatibleShutdownScript: {
3121 LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
3122 CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3123 CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3124 uint64_t script_ref = (uint64_t)script_var.inner & ~1;
3125 return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
3130 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3131 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3134 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3135 CHECK(val->result_ok);
3136 return *val->contents.result;
3138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3139 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3140 CHECK(!val->result_ok);
3141 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3145 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3146 ret->datalen = (*env)->GetArrayLength(env, elems);
3147 if (ret->datalen == 0) {
3150 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3151 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3152 for (size_t i = 0; i < ret->datalen; i++) {
3153 int64_t arr_elem = java_elems[i];
3154 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3155 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3156 ret->data[i] = arr_elem_conv;
3158 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3160 return (uint64_t)ret;
3162 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3163 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3164 for (size_t i = 0; i < ret.datalen; i++) {
3165 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3170 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3171 ret->datalen = (*env)->GetArrayLength(env, elems);
3172 if (ret->datalen == 0) {
3175 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3176 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3177 for (size_t i = 0; i < ret->datalen; i++) {
3178 int64_t arr_elem = java_elems[i];
3179 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3180 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3181 ret->data[i] = arr_elem_conv;
3183 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3185 return (uint64_t)ret;
3187 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3188 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3189 for (size_t i = 0; i < ret.datalen; i++) {
3190 ret.data[i] = APIError_clone(&orig->data[i]);
3194 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3195 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3196 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3197 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3198 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3199 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3200 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3201 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3203 LDKPaymentSendFailure_ParameterError_class =
3204 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3205 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3206 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3207 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3208 LDKPaymentSendFailure_PathParameterError_class =
3209 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3210 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3211 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3212 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3213 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3214 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3215 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3216 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3217 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3218 LDKPaymentSendFailure_PartialFailure_class =
3219 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3220 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3221 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3222 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3224 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3225 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3227 case LDKPaymentSendFailure_ParameterError: {
3228 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3229 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3231 case LDKPaymentSendFailure_PathParameterError: {
3232 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3233 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3234 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3235 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3236 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3237 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3238 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3239 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3241 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3242 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3244 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3245 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3246 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3247 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3248 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3249 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3250 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3252 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3253 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3255 case LDKPaymentSendFailure_PartialFailure: {
3256 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3257 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3258 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3259 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3260 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3261 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3262 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3263 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3265 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3266 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3272 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3275 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3276 CHECK(val->result_ok);
3277 return *val->contents.result;
3279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3280 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3281 CHECK(!val->result_ok);
3282 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3286 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3289 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3290 CHECK(val->result_ok);
3291 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3292 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3296 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3297 CHECK(!val->result_ok);
3298 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3301 static jclass LDKNetAddress_IPv4_class = NULL;
3302 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3303 static jclass LDKNetAddress_IPv6_class = NULL;
3304 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3305 static jclass LDKNetAddress_OnionV2_class = NULL;
3306 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3307 static jclass LDKNetAddress_OnionV3_class = NULL;
3308 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3310 LDKNetAddress_IPv4_class =
3311 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3312 CHECK(LDKNetAddress_IPv4_class != NULL);
3313 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3314 CHECK(LDKNetAddress_IPv4_meth != NULL);
3315 LDKNetAddress_IPv6_class =
3316 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3317 CHECK(LDKNetAddress_IPv6_class != NULL);
3318 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3319 CHECK(LDKNetAddress_IPv6_meth != NULL);
3320 LDKNetAddress_OnionV2_class =
3321 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3322 CHECK(LDKNetAddress_OnionV2_class != NULL);
3323 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3324 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3325 LDKNetAddress_OnionV3_class =
3326 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3327 CHECK(LDKNetAddress_OnionV3_class != NULL);
3328 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3329 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3331 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3332 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3334 case LDKNetAddress_IPv4: {
3335 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3336 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3337 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3339 case LDKNetAddress_IPv6: {
3340 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3341 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3342 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3344 case LDKNetAddress_OnionV2: {
3345 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3346 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3347 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3349 case LDKNetAddress_OnionV3: {
3350 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3351 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3352 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);
3357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3358 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3359 ret->datalen = (*env)->GetArrayLength(env, elems);
3360 if (ret->datalen == 0) {
3363 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3364 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3365 for (size_t i = 0; i < ret->datalen; i++) {
3366 int64_t arr_elem = java_elems[i];
3367 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3368 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3369 ret->data[i] = arr_elem_conv;
3371 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3373 return (uint64_t)ret;
3375 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3376 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3377 for (size_t i = 0; i < ret.datalen; i++) {
3378 ret.data[i] = NetAddress_clone(&orig->data[i]);
3382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3383 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3384 LDKThirtyTwoBytes a_ref;
3385 CHECK((*env)->GetArrayLength(env, a) == 32);
3386 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3388 LDKThirtyTwoBytes b_ref;
3389 CHECK((*env)->GetArrayLength(env, b) == 32);
3390 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3392 return (uint64_t)ret;
3394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3395 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3396 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3397 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3401 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3402 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3403 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3407 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3410 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3411 CHECK(val->result_ok);
3412 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3413 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3417 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3418 CHECK(!val->result_ok);
3419 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3423 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3424 ret->datalen = (*env)->GetArrayLength(env, elems);
3425 if (ret->datalen == 0) {
3428 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3429 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3430 for (size_t i = 0; i < ret->datalen; i++) {
3431 int64_t arr_elem = java_elems[i];
3432 LDKChannelMonitor arr_elem_conv;
3433 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3434 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3435 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3436 ret->data[i] = arr_elem_conv;
3438 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3440 return (uint64_t)ret;
3442 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3443 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3444 for (size_t i = 0; i < ret.datalen; i++) {
3445 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3449 typedef struct LDKWatch_JCalls {
3450 atomic_size_t refcnt;
3453 jmethodID watch_channel_meth;
3454 jmethodID update_channel_meth;
3455 jmethodID release_pending_monitor_events_meth;
3457 static void LDKWatch_JCalls_free(void* this_arg) {
3458 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3459 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3461 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3462 if (get_jenv_res == JNI_EDETACHED) {
3463 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3465 DO_ASSERT(get_jenv_res == JNI_OK);
3467 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3468 if (get_jenv_res == JNI_EDETACHED) {
3469 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3474 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3475 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3477 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3478 if (get_jenv_res == JNI_EDETACHED) {
3479 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3481 DO_ASSERT(get_jenv_res == JNI_OK);
3483 LDKOutPoint funding_txo_var = funding_txo;
3484 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3485 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3486 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3487 if (funding_txo_var.is_owned) {
3488 funding_txo_ref |= 1;
3490 LDKChannelMonitor monitor_var = monitor;
3491 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3492 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3493 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3494 if (monitor_var.is_owned) {
3497 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3499 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3500 if ((*env)->ExceptionCheck(env)) {
3501 (*env)->ExceptionDescribe(env);
3502 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3504 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3505 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3506 if (get_jenv_res == JNI_EDETACHED) {
3507 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3511 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3512 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3514 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3515 if (get_jenv_res == JNI_EDETACHED) {
3516 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3518 DO_ASSERT(get_jenv_res == JNI_OK);
3520 LDKOutPoint funding_txo_var = funding_txo;
3521 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3522 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3523 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3524 if (funding_txo_var.is_owned) {
3525 funding_txo_ref |= 1;
3527 LDKChannelMonitorUpdate update_var = update;
3528 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3529 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3530 uint64_t update_ref = (uint64_t)update_var.inner;
3531 if (update_var.is_owned) {
3534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3536 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3537 if ((*env)->ExceptionCheck(env)) {
3538 (*env)->ExceptionDescribe(env);
3539 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3541 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3542 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3543 if (get_jenv_res == JNI_EDETACHED) {
3544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3548 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3549 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3552 if (get_jenv_res == JNI_EDETACHED) {
3553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3555 DO_ASSERT(get_jenv_res == JNI_OK);
3557 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3559 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3560 if ((*env)->ExceptionCheck(env)) {
3561 (*env)->ExceptionDescribe(env);
3562 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3564 LDKCVec_MonitorEventZ ret_constr;
3565 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3566 if (ret_constr.datalen > 0)
3567 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3569 ret_constr.data = NULL;
3570 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3571 for (size_t o = 0; o < ret_constr.datalen; o++) {
3572 int64_t ret_conv_14 = ret_vals[o];
3573 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3574 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3575 ret_constr.data[o] = ret_conv_14_conv;
3577 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3578 if (get_jenv_res == JNI_EDETACHED) {
3579 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3583 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3584 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3585 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3587 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3588 jclass c = (*env)->GetObjectClass(env, o);
3590 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3591 atomic_init(&calls->refcnt, 1);
3592 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3593 calls->o = (*env)->NewWeakGlobalRef(env, o);
3594 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3595 CHECK(calls->watch_channel_meth != NULL);
3596 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3597 CHECK(calls->update_channel_meth != NULL);
3598 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3599 CHECK(calls->release_pending_monitor_events_meth != NULL);
3602 .this_arg = (void*) calls,
3603 .watch_channel = watch_channel_LDKWatch_jcall,
3604 .update_channel = update_channel_LDKWatch_jcall,
3605 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3606 .free = LDKWatch_JCalls_free,
3610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3611 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3612 *res_ptr = LDKWatch_init(env, clz, o);
3613 return (uint64_t)res_ptr;
3615 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) {
3616 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3617 LDKOutPoint funding_txo_conv;
3618 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3619 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3620 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3621 LDKChannelMonitor monitor_conv;
3622 monitor_conv.inner = (void*)(monitor & (~1));
3623 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3624 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3625 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3626 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3627 return (uint64_t)ret_conv;
3630 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) {
3631 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3632 LDKOutPoint funding_txo_conv;
3633 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3634 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3635 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3636 LDKChannelMonitorUpdate update_conv;
3637 update_conv.inner = (void*)(update & (~1));
3638 update_conv.is_owned = (update & 1) || (update == 0);
3639 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3640 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3641 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3642 return (uint64_t)ret_conv;
3645 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3646 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3647 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3648 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3649 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3650 for (size_t o = 0; o < ret_var.datalen; o++) {
3651 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3652 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3653 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3654 ret_arr_ptr[o] = ret_conv_14_ref;
3656 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3661 typedef struct LDKBroadcasterInterface_JCalls {
3662 atomic_size_t refcnt;
3665 jmethodID broadcast_transaction_meth;
3666 } LDKBroadcasterInterface_JCalls;
3667 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3668 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3669 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3671 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3672 if (get_jenv_res == JNI_EDETACHED) {
3673 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3675 DO_ASSERT(get_jenv_res == JNI_OK);
3677 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3678 if (get_jenv_res == JNI_EDETACHED) {
3679 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3684 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3685 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3687 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3688 if (get_jenv_res == JNI_EDETACHED) {
3689 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3691 DO_ASSERT(get_jenv_res == JNI_OK);
3693 LDKTransaction tx_var = tx;
3694 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3695 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3696 Transaction_free(tx_var);
3697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3699 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3700 if ((*env)->ExceptionCheck(env)) {
3701 (*env)->ExceptionDescribe(env);
3702 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3704 if (get_jenv_res == JNI_EDETACHED) {
3705 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3708 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3709 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3710 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3712 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3713 jclass c = (*env)->GetObjectClass(env, o);
3715 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3716 atomic_init(&calls->refcnt, 1);
3717 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3718 calls->o = (*env)->NewWeakGlobalRef(env, o);
3719 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3720 CHECK(calls->broadcast_transaction_meth != NULL);
3722 LDKBroadcasterInterface ret = {
3723 .this_arg = (void*) calls,
3724 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3725 .free = LDKBroadcasterInterface_JCalls_free,
3729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3730 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3731 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3732 return (uint64_t)res_ptr;
3734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3735 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3736 LDKTransaction tx_ref;
3737 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3738 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3739 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3740 tx_ref.data_is_owned = true;
3741 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3744 typedef struct LDKKeysInterface_JCalls {
3745 atomic_size_t refcnt;
3748 jmethodID get_node_secret_meth;
3749 jmethodID get_destination_script_meth;
3750 jmethodID get_shutdown_scriptpubkey_meth;
3751 jmethodID get_channel_signer_meth;
3752 jmethodID get_secure_random_bytes_meth;
3753 jmethodID read_chan_signer_meth;
3754 jmethodID sign_invoice_meth;
3755 } LDKKeysInterface_JCalls;
3756 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3757 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3758 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3760 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3761 if (get_jenv_res == JNI_EDETACHED) {
3762 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3764 DO_ASSERT(get_jenv_res == JNI_OK);
3766 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3767 if (get_jenv_res == JNI_EDETACHED) {
3768 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3773 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3774 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3776 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3777 if (get_jenv_res == JNI_EDETACHED) {
3778 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3780 DO_ASSERT(get_jenv_res == JNI_OK);
3782 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3784 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3785 if ((*env)->ExceptionCheck(env)) {
3786 (*env)->ExceptionDescribe(env);
3787 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3789 LDKSecretKey ret_ref;
3790 CHECK((*env)->GetArrayLength(env, ret) == 32);
3791 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3792 if (get_jenv_res == JNI_EDETACHED) {
3793 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3797 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3798 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3800 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3801 if (get_jenv_res == JNI_EDETACHED) {
3802 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3804 DO_ASSERT(get_jenv_res == JNI_OK);
3806 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3808 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3809 if ((*env)->ExceptionCheck(env)) {
3810 (*env)->ExceptionDescribe(env);
3811 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
3813 LDKCVec_u8Z ret_ref;
3814 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3815 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3816 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3817 if (get_jenv_res == JNI_EDETACHED) {
3818 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3822 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
3823 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3825 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3826 if (get_jenv_res == JNI_EDETACHED) {
3827 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3829 DO_ASSERT(get_jenv_res == JNI_OK);
3831 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3833 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
3834 if ((*env)->ExceptionCheck(env)) {
3835 (*env)->ExceptionDescribe(env);
3836 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
3838 LDKShutdownScript ret_conv;
3839 ret_conv.inner = (void*)(ret & (~1));
3840 ret_conv.is_owned = (ret & 1) || (ret == 0);
3841 ret_conv = ShutdownScript_clone(&ret_conv);
3842 if (get_jenv_res == JNI_EDETACHED) {
3843 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3847 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3848 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3850 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3851 if (get_jenv_res == JNI_EDETACHED) {
3852 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3854 DO_ASSERT(get_jenv_res == JNI_OK);
3856 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3858 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3859 if ((*env)->ExceptionCheck(env)) {
3860 (*env)->ExceptionDescribe(env);
3861 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
3863 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3864 ret_conv = Sign_clone(&ret_conv);
3865 if (get_jenv_res == JNI_EDETACHED) {
3866 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3870 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3871 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3873 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3874 if (get_jenv_res == JNI_EDETACHED) {
3875 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3877 DO_ASSERT(get_jenv_res == JNI_OK);
3879 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3881 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3882 if ((*env)->ExceptionCheck(env)) {
3883 (*env)->ExceptionDescribe(env);
3884 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
3886 LDKThirtyTwoBytes ret_ref;
3887 CHECK((*env)->GetArrayLength(env, ret) == 32);
3888 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3889 if (get_jenv_res == JNI_EDETACHED) {
3890 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3894 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3895 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3897 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3898 if (get_jenv_res == JNI_EDETACHED) {
3899 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3901 DO_ASSERT(get_jenv_res == JNI_OK);
3903 LDKu8slice reader_var = reader;
3904 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3905 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3906 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3908 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3909 if ((*env)->ExceptionCheck(env)) {
3910 (*env)->ExceptionDescribe(env);
3911 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
3913 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3914 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3915 if (get_jenv_res == JNI_EDETACHED) {
3916 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3920 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
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 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3930 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3931 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3932 CVec_u8Z_free(invoice_preimage_var);
3933 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3935 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3936 if ((*env)->ExceptionCheck(env)) {
3937 (*env)->ExceptionDescribe(env);
3938 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
3940 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3941 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3942 if (get_jenv_res == JNI_EDETACHED) {
3943 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3947 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
3948 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
3949 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3951 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3952 jclass c = (*env)->GetObjectClass(env, o);
3954 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3955 atomic_init(&calls->refcnt, 1);
3956 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3957 calls->o = (*env)->NewWeakGlobalRef(env, o);
3958 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3959 CHECK(calls->get_node_secret_meth != NULL);
3960 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3961 CHECK(calls->get_destination_script_meth != NULL);
3962 calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
3963 CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
3964 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3965 CHECK(calls->get_channel_signer_meth != NULL);
3966 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3967 CHECK(calls->get_secure_random_bytes_meth != NULL);
3968 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3969 CHECK(calls->read_chan_signer_meth != NULL);
3970 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3971 CHECK(calls->sign_invoice_meth != NULL);
3973 LDKKeysInterface ret = {
3974 .this_arg = (void*) calls,
3975 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3976 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3977 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
3978 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3979 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3980 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3981 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3982 .free = LDKKeysInterface_JCalls_free,
3986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3987 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3988 *res_ptr = LDKKeysInterface_init(env, clz, o);
3989 return (uint64_t)res_ptr;
3991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3992 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3993 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3994 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3998 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3999 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4000 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4001 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4002 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4003 CVec_u8Z_free(ret_var);
4007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4008 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4009 LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
4010 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4011 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4012 uint64_t ret_ref = (uint64_t)ret_var.inner;
4013 if (ret_var.is_owned) {
4019 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) {
4020 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4021 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
4022 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4023 return (uint64_t)ret;
4026 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4027 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4028 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4029 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4034 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4035 LDKu8slice reader_ref;
4036 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4037 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4038 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4039 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4040 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4041 return (uint64_t)ret_conv;
4044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4045 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4046 LDKCVec_u8Z invoice_preimage_ref;
4047 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4048 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4049 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4050 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4051 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4052 return (uint64_t)ret_conv;
4055 typedef struct LDKFeeEstimator_JCalls {
4056 atomic_size_t refcnt;
4059 jmethodID get_est_sat_per_1000_weight_meth;
4060 } LDKFeeEstimator_JCalls;
4061 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4062 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4063 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4065 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4066 if (get_jenv_res == JNI_EDETACHED) {
4067 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4069 DO_ASSERT(get_jenv_res == JNI_OK);
4071 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4072 if (get_jenv_res == JNI_EDETACHED) {
4073 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4078 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4079 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4081 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4082 if (get_jenv_res == JNI_EDETACHED) {
4083 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4085 DO_ASSERT(get_jenv_res == JNI_OK);
4087 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4088 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4090 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4091 if ((*env)->ExceptionCheck(env)) {
4092 (*env)->ExceptionDescribe(env);
4093 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4095 if (get_jenv_res == JNI_EDETACHED) {
4096 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4100 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4101 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4102 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4104 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4105 jclass c = (*env)->GetObjectClass(env, o);
4107 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4108 atomic_init(&calls->refcnt, 1);
4109 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4110 calls->o = (*env)->NewWeakGlobalRef(env, o);
4111 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4112 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4114 LDKFeeEstimator ret = {
4115 .this_arg = (void*) calls,
4116 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4117 .free = LDKFeeEstimator_JCalls_free,
4121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4122 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4123 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4124 return (uint64_t)res_ptr;
4126 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) {
4127 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4128 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4129 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4133 typedef struct LDKLogger_JCalls {
4134 atomic_size_t refcnt;
4139 static void LDKLogger_JCalls_free(void* this_arg) {
4140 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4141 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4143 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4144 if (get_jenv_res == JNI_EDETACHED) {
4145 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4147 DO_ASSERT(get_jenv_res == JNI_OK);
4149 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4150 if (get_jenv_res == JNI_EDETACHED) {
4151 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4156 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4157 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4159 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4160 if (get_jenv_res == JNI_EDETACHED) {
4161 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4163 DO_ASSERT(get_jenv_res == JNI_OK);
4165 const char* record_str = record;
4166 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4169 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4170 if ((*env)->ExceptionCheck(env)) {
4171 (*env)->ExceptionDescribe(env);
4172 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4174 if (get_jenv_res == JNI_EDETACHED) {
4175 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4178 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4179 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4180 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4182 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4183 jclass c = (*env)->GetObjectClass(env, o);
4185 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4186 atomic_init(&calls->refcnt, 1);
4187 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4188 calls->o = (*env)->NewWeakGlobalRef(env, o);
4189 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4190 CHECK(calls->log_meth != NULL);
4193 .this_arg = (void*) calls,
4194 .log = log_LDKLogger_jcall,
4195 .free = LDKLogger_JCalls_free,
4199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4200 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4201 *res_ptr = LDKLogger_init(env, clz, o);
4202 return (uint64_t)res_ptr;
4204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4205 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4206 LDKThirtyTwoBytes a_ref;
4207 CHECK((*env)->GetArrayLength(env, a) == 32);
4208 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4210 LDKChannelManager b_conv;
4211 b_conv.inner = (void*)(b & (~1));
4212 b_conv.is_owned = (b & 1) || (b == 0);
4213 // Warning: we need a move here but no clone is available for LDKChannelManager
4215 return (uint64_t)ret;
4217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4218 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4219 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4220 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4224 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4225 LDKChannelManager b_var = tuple->b;
4226 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4227 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4228 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4232 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4235 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4236 CHECK(val->result_ok);
4237 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4241 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4242 CHECK(!val->result_ok);
4243 LDKDecodeError err_var = (*val->contents.err);
4244 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4245 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4246 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4250 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4253 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4254 CHECK(val->result_ok);
4255 LDKChannelConfig res_var = (*val->contents.result);
4256 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4257 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4258 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4262 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4263 CHECK(!val->result_ok);
4264 LDKDecodeError err_var = (*val->contents.err);
4265 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4266 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4267 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4270 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4271 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4274 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4275 CHECK(val->result_ok);
4276 LDKOutPoint res_var = (*val->contents.result);
4277 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4278 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4279 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4283 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4284 CHECK(!val->result_ok);
4285 LDKDecodeError err_var = (*val->contents.err);
4286 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4287 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4288 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4292 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4294 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4295 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4296 CHECK(val->result_ok);
4297 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4301 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4302 CHECK(!val->result_ok);
4303 return *val->contents.err;
4305 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4306 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4309 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4310 CHECK(val->result_ok);
4311 LDKInvoice res_var = (*val->contents.result);
4312 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4313 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4314 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4318 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4319 CHECK(!val->result_ok);
4320 return *val->contents.err;
4322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4323 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4326 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4327 CHECK(val->result_ok);
4328 LDKSignedRawInvoice res_var = (*val->contents.result);
4329 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4330 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4331 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4335 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4336 CHECK(!val->result_ok);
4337 return *val->contents.err;
4339 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) {
4340 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4341 LDKRawInvoice a_conv;
4342 a_conv.inner = (void*)(a & (~1));
4343 a_conv.is_owned = (a & 1) || (a == 0);
4344 a_conv = RawInvoice_clone(&a_conv);
4346 LDKThirtyTwoBytes b_ref;
4347 CHECK((*env)->GetArrayLength(env, b) == 32);
4348 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4350 LDKInvoiceSignature c_conv;
4351 c_conv.inner = (void*)(c & (~1));
4352 c_conv.is_owned = (c & 1) || (c == 0);
4353 c_conv = InvoiceSignature_clone(&c_conv);
4355 return (uint64_t)ret;
4357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4358 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4359 LDKRawInvoice a_var = tuple->a;
4360 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4361 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4362 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4366 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4367 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4368 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4372 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4373 LDKInvoiceSignature c_var = tuple->c;
4374 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4375 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4376 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4379 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4380 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4383 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4384 CHECK(val->result_ok);
4385 LDKPayeePubKey res_var = (*val->contents.result);
4386 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4391 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4392 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4393 CHECK(!val->result_ok);
4394 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4398 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4399 ret->datalen = (*env)->GetArrayLength(env, elems);
4400 if (ret->datalen == 0) {
4403 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4404 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4405 for (size_t i = 0; i < ret->datalen; i++) {
4406 int64_t arr_elem = java_elems[i];
4407 LDKPrivateRoute arr_elem_conv;
4408 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4409 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4410 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4411 ret->data[i] = arr_elem_conv;
4413 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4415 return (uint64_t)ret;
4417 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4418 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4419 for (size_t i = 0; i < ret.datalen; i++) {
4420 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4424 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4425 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4428 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4429 CHECK(val->result_ok);
4430 LDKPositiveTimestamp res_var = (*val->contents.result);
4431 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4432 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4433 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4436 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4437 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4438 CHECK(!val->result_ok);
4439 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4443 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4446 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4447 CHECK(val->result_ok);
4448 return *val->contents.result;
4450 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4451 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4452 CHECK(!val->result_ok);
4453 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4456 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4457 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4460 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4461 CHECK(val->result_ok);
4462 LDKInvoice res_var = (*val->contents.result);
4463 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4464 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4465 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4468 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4469 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4470 CHECK(!val->result_ok);
4471 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4474 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4475 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4478 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4479 CHECK(val->result_ok);
4480 LDKDescription res_var = (*val->contents.result);
4481 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4486 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4487 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4488 CHECK(!val->result_ok);
4489 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4493 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4496 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4497 CHECK(val->result_ok);
4498 LDKExpiryTime res_var = (*val->contents.result);
4499 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4505 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4506 CHECK(!val->result_ok);
4507 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4511 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4514 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4515 CHECK(val->result_ok);
4516 LDKPrivateRoute res_var = (*val->contents.result);
4517 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4518 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4519 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4522 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4523 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4524 CHECK(!val->result_ok);
4525 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4528 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4529 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4531 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4532 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4533 CHECK(val->result_ok);
4534 LDKStr res_str = (*val->contents.result);
4535 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4538 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4539 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4540 CHECK(!val->result_ok);
4541 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4545 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4548 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4549 CHECK(val->result_ok);
4550 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4551 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4552 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4553 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4557 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4558 CHECK(!val->result_ok);
4559 LDKDecodeError err_var = (*val->contents.err);
4560 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4561 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4562 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4566 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4569 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4570 CHECK(val->result_ok);
4571 LDKHTLCUpdate res_var = (*val->contents.result);
4572 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4573 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4574 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4578 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4579 CHECK(!val->result_ok);
4580 LDKDecodeError err_var = (*val->contents.err);
4581 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4582 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4583 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4587 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4590 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4591 CHECK(val->result_ok);
4592 return *val->contents.result;
4594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4595 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4596 CHECK(!val->result_ok);
4597 LDKMonitorUpdateError err_var = (*val->contents.err);
4598 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4599 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4600 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4604 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4606 a_conv.inner = (void*)(a & (~1));
4607 a_conv.is_owned = (a & 1) || (a == 0);
4608 a_conv = OutPoint_clone(&a_conv);
4611 b_ref.datalen = (*env)->GetArrayLength(env, b);
4612 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4613 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4615 return (uint64_t)ret;
4617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4618 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4619 LDKOutPoint a_var = tuple->a;
4620 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4621 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4622 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4626 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4627 LDKCVec_u8Z b_var = tuple->b;
4628 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4629 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4633 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4636 b_ref.datalen = (*env)->GetArrayLength(env, b);
4637 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4638 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4640 return (uint64_t)ret;
4642 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4643 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4646 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4647 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4648 LDKCVec_u8Z b_var = tuple->b;
4649 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4650 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4654 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4655 ret->datalen = (*env)->GetArrayLength(env, elems);
4656 if (ret->datalen == 0) {
4659 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4660 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4661 for (size_t i = 0; i < ret->datalen; i++) {
4662 int64_t arr_elem = java_elems[i];
4663 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4664 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4665 ret->data[i] = arr_elem_conv;
4667 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4669 return (uint64_t)ret;
4671 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4672 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4673 for (size_t i = 0; i < ret.datalen; i++) {
4674 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4679 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4680 LDKThirtyTwoBytes a_ref;
4681 CHECK((*env)->GetArrayLength(env, a) == 32);
4682 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4684 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4685 b_constr.datalen = (*env)->GetArrayLength(env, b);
4686 if (b_constr.datalen > 0)
4687 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4689 b_constr.data = NULL;
4690 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4691 for (size_t b = 0; b < b_constr.datalen; b++) {
4692 int64_t b_conv_27 = b_vals[b];
4693 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4694 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4695 b_constr.data[b] = b_conv_27_conv;
4697 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4699 return (uint64_t)ret;
4701 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4702 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4703 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4704 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4707 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4708 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4709 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4710 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4711 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4712 for (size_t b = 0; b < b_var.datalen; b++) {
4713 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4714 b_arr_ptr[b] = b_conv_27_ref;
4716 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4720 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4721 ret->datalen = (*env)->GetArrayLength(env, elems);
4722 if (ret->datalen == 0) {
4725 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4726 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4727 for (size_t i = 0; i < ret->datalen; i++) {
4728 int64_t arr_elem = java_elems[i];
4729 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4730 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4731 ret->data[i] = arr_elem_conv;
4733 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4735 return (uint64_t)ret;
4737 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4738 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 };
4739 for (size_t i = 0; i < ret.datalen; i++) {
4740 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4744 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
4745 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
4746 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
4747 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
4748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
4749 LDKPaymentPurpose_InvoicePayment_class =
4750 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
4751 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
4752 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
4753 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
4754 LDKPaymentPurpose_SpontaneousPayment_class =
4755 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
4756 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
4757 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
4758 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
4760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4761 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
4763 case LDKPaymentPurpose_InvoicePayment: {
4764 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4765 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
4766 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4767 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
4768 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
4770 case LDKPaymentPurpose_SpontaneousPayment: {
4771 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
4772 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
4773 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
4778 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4779 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4780 static jclass LDKEvent_PaymentReceived_class = NULL;
4781 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4782 static jclass LDKEvent_PaymentSent_class = NULL;
4783 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4784 static jclass LDKEvent_PaymentFailed_class = NULL;
4785 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4786 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4787 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4788 static jclass LDKEvent_SpendableOutputs_class = NULL;
4789 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4790 static jclass LDKEvent_PaymentForwarded_class = NULL;
4791 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
4792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4793 LDKEvent_FundingGenerationReady_class =
4794 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4795 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4796 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4797 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4798 LDKEvent_PaymentReceived_class =
4799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4800 CHECK(LDKEvent_PaymentReceived_class != NULL);
4801 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
4802 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4803 LDKEvent_PaymentSent_class =
4804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4805 CHECK(LDKEvent_PaymentSent_class != NULL);
4806 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4807 CHECK(LDKEvent_PaymentSent_meth != NULL);
4808 LDKEvent_PaymentFailed_class =
4809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4810 CHECK(LDKEvent_PaymentFailed_class != NULL);
4811 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4812 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4813 LDKEvent_PendingHTLCsForwardable_class =
4814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4815 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4816 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4817 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4818 LDKEvent_SpendableOutputs_class =
4819 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4820 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4821 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4822 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4823 LDKEvent_PaymentForwarded_class =
4824 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
4825 CHECK(LDKEvent_PaymentForwarded_class != NULL);
4826 LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
4827 CHECK(LDKEvent_PaymentForwarded_meth != NULL);
4829 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4830 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4832 case LDKEvent_FundingGenerationReady: {
4833 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4834 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4835 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4836 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4837 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4838 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);
4840 case LDKEvent_PaymentReceived: {
4841 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4842 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4843 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
4844 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
4846 case LDKEvent_PaymentSent: {
4847 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4848 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4849 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4851 case LDKEvent_PaymentFailed: {
4852 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4853 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4854 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4856 case LDKEvent_PendingHTLCsForwardable: {
4857 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4859 case LDKEvent_SpendableOutputs: {
4860 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4861 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4862 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4863 for (size_t b = 0; b < outputs_var.datalen; b++) {
4864 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4865 outputs_arr_ptr[b] = outputs_conv_27_ref;
4867 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4868 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4870 case LDKEvent_PaymentForwarded: {
4871 uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
4872 return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
4877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4878 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4879 ret->datalen = (*env)->GetArrayLength(env, elems);
4880 if (ret->datalen == 0) {
4883 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4884 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4885 for (size_t i = 0; i < ret->datalen; i++) {
4886 int64_t arr_elem = java_elems[i];
4887 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4888 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4889 ret->data[i] = arr_elem_conv;
4891 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4893 return (uint64_t)ret;
4895 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4896 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4897 for (size_t i = 0; i < ret.datalen; i++) {
4898 ret.data[i] = Event_clone(&orig->data[i]);
4902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4903 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4905 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4906 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4908 return (uint64_t)ret;
4910 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4911 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4915 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4916 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4917 return (uint64_t)b_ref;
4919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4920 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4921 ret->datalen = (*env)->GetArrayLength(env, elems);
4922 if (ret->datalen == 0) {
4925 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4926 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4927 for (size_t i = 0; i < ret->datalen; i++) {
4928 int64_t arr_elem = java_elems[i];
4929 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4930 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4931 ret->data[i] = arr_elem_conv;
4933 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4935 return (uint64_t)ret;
4937 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4938 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4939 for (size_t i = 0; i < ret.datalen; i++) {
4940 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4945 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4946 LDKThirtyTwoBytes a_ref;
4947 CHECK((*env)->GetArrayLength(env, a) == 32);
4948 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4950 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4951 b_constr.datalen = (*env)->GetArrayLength(env, b);
4952 if (b_constr.datalen > 0)
4953 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4955 b_constr.data = NULL;
4956 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4957 for (size_t a = 0; a < b_constr.datalen; a++) {
4958 int64_t b_conv_26 = b_vals[a];
4959 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4960 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4961 b_constr.data[a] = b_conv_26_conv;
4963 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4965 return (uint64_t)ret;
4967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4968 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4969 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4970 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4973 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4974 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4975 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4976 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4977 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4978 for (size_t a = 0; a < b_var.datalen; a++) {
4979 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4980 b_arr_ptr[a] = b_conv_26_ref;
4982 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4986 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4987 ret->datalen = (*env)->GetArrayLength(env, elems);
4988 if (ret->datalen == 0) {
4991 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4992 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4993 for (size_t i = 0; i < ret->datalen; i++) {
4994 int64_t arr_elem = java_elems[i];
4995 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4996 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4997 ret->data[i] = arr_elem_conv;
4999 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5001 return (uint64_t)ret;
5003 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5004 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 };
5005 for (size_t i = 0; i < ret.datalen; i++) {
5006 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5011 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5014 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5015 CHECK(val->result_ok);
5016 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
5019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5020 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5021 CHECK(!val->result_ok);
5022 LDKDecodeError err_var = (*val->contents.err);
5023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5028 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5029 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5032 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5033 CHECK(val->result_ok);
5034 return *val->contents.result;
5036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5037 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5038 CHECK(!val->result_ok);
5039 LDKLightningError err_var = (*val->contents.err);
5040 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5041 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5042 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5045 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) {
5046 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5047 LDKChannelAnnouncement a_conv;
5048 a_conv.inner = (void*)(a & (~1));
5049 a_conv.is_owned = (a & 1) || (a == 0);
5050 a_conv = ChannelAnnouncement_clone(&a_conv);
5052 LDKChannelUpdate b_conv;
5053 b_conv.inner = (void*)(b & (~1));
5054 b_conv.is_owned = (b & 1) || (b == 0);
5055 b_conv = ChannelUpdate_clone(&b_conv);
5057 LDKChannelUpdate c_conv;
5058 c_conv.inner = (void*)(c & (~1));
5059 c_conv.is_owned = (c & 1) || (c == 0);
5060 c_conv = ChannelUpdate_clone(&c_conv);
5062 return (uint64_t)ret;
5064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5065 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5066 LDKChannelAnnouncement a_var = tuple->a;
5067 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5068 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5069 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
5072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5073 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5074 LDKChannelUpdate b_var = tuple->b;
5075 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5076 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5077 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
5080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
5081 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5082 LDKChannelUpdate c_var = tuple->c;
5083 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5084 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5085 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
5088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5089 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5090 ret->datalen = (*env)->GetArrayLength(env, elems);
5091 if (ret->datalen == 0) {
5094 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5095 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5096 for (size_t i = 0; i < ret->datalen; i++) {
5097 int64_t arr_elem = java_elems[i];
5098 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5099 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5100 ret->data[i] = arr_elem_conv;
5102 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5104 return (uint64_t)ret;
5106 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5107 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5108 for (size_t i = 0; i < ret.datalen; i++) {
5109 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5114 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5115 ret->datalen = (*env)->GetArrayLength(env, elems);
5116 if (ret->datalen == 0) {
5119 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5120 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5121 for (size_t i = 0; i < ret->datalen; i++) {
5122 int64_t arr_elem = java_elems[i];
5123 LDKNodeAnnouncement arr_elem_conv;
5124 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5125 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5126 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5127 ret->data[i] = arr_elem_conv;
5129 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5131 return (uint64_t)ret;
5133 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5134 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5135 for (size_t i = 0; i < ret.datalen; i++) {
5136 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5141 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5144 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5145 CHECK(val->result_ok);
5146 return *val->contents.result;
5148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5149 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5150 CHECK(!val->result_ok);
5151 LDKLightningError err_var = (*val->contents.err);
5152 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5153 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5154 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5158 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5161 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5162 CHECK(val->result_ok);
5163 LDKCVec_u8Z res_var = (*val->contents.result);
5164 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5165 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5169 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5170 CHECK(!val->result_ok);
5171 LDKPeerHandleError err_var = (*val->contents.err);
5172 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5173 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5174 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5177 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5178 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5181 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5182 CHECK(val->result_ok);
5183 return *val->contents.result;
5185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5186 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5187 CHECK(!val->result_ok);
5188 LDKPeerHandleError err_var = (*val->contents.err);
5189 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5190 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5191 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5194 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5195 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5198 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5199 CHECK(val->result_ok);
5200 return *val->contents.result;
5202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5203 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5204 CHECK(!val->result_ok);
5205 LDKPeerHandleError err_var = (*val->contents.err);
5206 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5207 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5208 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5211 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5212 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5215 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5216 CHECK(val->result_ok);
5217 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5218 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5219 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5220 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5224 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5225 CHECK(!val->result_ok);
5226 LDKDecodeError err_var = (*val->contents.err);
5227 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5228 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5229 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5232 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5233 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5236 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5237 CHECK(val->result_ok);
5238 LDKChannelInfo res_var = (*val->contents.result);
5239 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5240 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5241 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5245 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5246 CHECK(!val->result_ok);
5247 LDKDecodeError err_var = (*val->contents.err);
5248 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5249 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5250 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5253 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5254 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5257 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5258 CHECK(val->result_ok);
5259 LDKRoutingFees res_var = (*val->contents.result);
5260 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5261 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5262 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5266 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5267 CHECK(!val->result_ok);
5268 LDKDecodeError err_var = (*val->contents.err);
5269 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5270 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5271 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5275 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5278 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5279 CHECK(val->result_ok);
5280 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5281 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5282 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5283 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5287 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5288 CHECK(!val->result_ok);
5289 LDKDecodeError err_var = (*val->contents.err);
5290 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5291 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5292 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5296 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5297 ret->datalen = (*env)->GetArrayLength(env, elems);
5298 if (ret->datalen == 0) {
5301 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5302 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5303 for (size_t i = 0; i < ret->datalen; i++) {
5304 ret->data[i] = java_elems[i];
5306 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5308 return (uint64_t)ret;
5310 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5311 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5312 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5316 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5319 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5320 CHECK(val->result_ok);
5321 LDKNodeInfo res_var = (*val->contents.result);
5322 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5323 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5324 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5328 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5329 CHECK(!val->result_ok);
5330 LDKDecodeError err_var = (*val->contents.err);
5331 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5332 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5333 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5337 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5340 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5341 CHECK(val->result_ok);
5342 LDKNetworkGraph res_var = (*val->contents.result);
5343 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5344 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5345 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5349 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5350 CHECK(!val->result_ok);
5351 LDKDecodeError err_var = (*val->contents.err);
5352 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5353 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5354 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5358 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5361 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5362 CHECK(val->result_ok);
5363 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5366 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5367 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5368 CHECK(!val->result_ok);
5369 return *val->contents.err;
5371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5372 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5375 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5376 CHECK(val->result_ok);
5377 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5378 *res_conv = (*val->contents.result);
5379 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5380 return (uint64_t)res_conv;
5382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5383 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5384 CHECK(!val->result_ok);
5385 LDKDecodeError err_var = (*val->contents.err);
5386 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5387 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5388 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5391 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5392 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5395 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5396 CHECK(val->result_ok);
5397 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5401 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5402 CHECK(!val->result_ok);
5403 LDKDecodeError err_var = (*val->contents.err);
5404 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5405 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5406 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5410 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5411 ret->datalen = (*env)->GetArrayLength(env, elems);
5412 if (ret->datalen == 0) {
5415 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5416 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5417 for (size_t i = 0; i < ret->datalen; i++) {
5418 int64_t arr_elem = java_elems[i];
5419 LDKUpdateAddHTLC arr_elem_conv;
5420 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5421 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5422 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5423 ret->data[i] = arr_elem_conv;
5425 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5427 return (uint64_t)ret;
5429 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5430 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5431 for (size_t i = 0; i < ret.datalen; i++) {
5432 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5437 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5438 ret->datalen = (*env)->GetArrayLength(env, elems);
5439 if (ret->datalen == 0) {
5442 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ 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 LDKUpdateFulfillHTLC arr_elem_conv;
5447 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5448 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5449 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5450 ret->data[i] = arr_elem_conv;
5452 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5454 return (uint64_t)ret;
5456 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5457 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5458 for (size_t i = 0; i < ret.datalen; i++) {
5459 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5464 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5465 ret->datalen = (*env)->GetArrayLength(env, elems);
5466 if (ret->datalen == 0) {
5469 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5470 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5471 for (size_t i = 0; i < ret->datalen; i++) {
5472 int64_t arr_elem = java_elems[i];
5473 LDKUpdateFailHTLC arr_elem_conv;
5474 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5475 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5476 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5477 ret->data[i] = arr_elem_conv;
5479 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5481 return (uint64_t)ret;
5483 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5484 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5485 for (size_t i = 0; i < ret.datalen; i++) {
5486 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5491 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5492 ret->datalen = (*env)->GetArrayLength(env, elems);
5493 if (ret->datalen == 0) {
5496 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5497 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5498 for (size_t i = 0; i < ret->datalen; i++) {
5499 int64_t arr_elem = java_elems[i];
5500 LDKUpdateFailMalformedHTLC arr_elem_conv;
5501 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5502 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5503 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5504 ret->data[i] = arr_elem_conv;
5506 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5508 return (uint64_t)ret;
5510 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5511 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5512 for (size_t i = 0; i < ret.datalen; i++) {
5513 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5518 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5521 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5522 CHECK(val->result_ok);
5523 LDKAcceptChannel res_var = (*val->contents.result);
5524 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5525 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5526 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5530 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5531 CHECK(!val->result_ok);
5532 LDKDecodeError err_var = (*val->contents.err);
5533 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5534 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5535 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5539 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5542 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5543 CHECK(val->result_ok);
5544 LDKAnnouncementSignatures res_var = (*val->contents.result);
5545 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5551 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5552 CHECK(!val->result_ok);
5553 LDKDecodeError err_var = (*val->contents.err);
5554 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5555 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5556 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5560 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5563 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5564 CHECK(val->result_ok);
5565 LDKChannelReestablish res_var = (*val->contents.result);
5566 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5567 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5568 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5572 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5573 CHECK(!val->result_ok);
5574 LDKDecodeError err_var = (*val->contents.err);
5575 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5576 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5577 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5581 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5584 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5585 CHECK(val->result_ok);
5586 LDKClosingSigned res_var = (*val->contents.result);
5587 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5588 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5589 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5593 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5594 CHECK(!val->result_ok);
5595 LDKDecodeError err_var = (*val->contents.err);
5596 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5597 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5598 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5602 return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
5604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5605 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5606 CHECK(val->result_ok);
5607 LDKClosingSignedFeeRange res_var = (*val->contents.result);
5608 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5609 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5610 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5614 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
5615 CHECK(!val->result_ok);
5616 LDKDecodeError err_var = (*val->contents.err);
5617 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5618 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5619 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5622 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5623 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5626 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5627 CHECK(val->result_ok);
5628 LDKCommitmentSigned res_var = (*val->contents.result);
5629 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5630 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5631 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5635 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5636 CHECK(!val->result_ok);
5637 LDKDecodeError err_var = (*val->contents.err);
5638 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5639 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5640 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5643 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5644 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5647 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5648 CHECK(val->result_ok);
5649 LDKFundingCreated res_var = (*val->contents.result);
5650 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5651 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5652 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5656 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5657 CHECK(!val->result_ok);
5658 LDKDecodeError err_var = (*val->contents.err);
5659 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5660 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5661 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5665 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5668 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5669 CHECK(val->result_ok);
5670 LDKFundingSigned res_var = (*val->contents.result);
5671 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5672 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5673 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5677 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5678 CHECK(!val->result_ok);
5679 LDKDecodeError err_var = (*val->contents.err);
5680 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5681 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5682 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5686 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5689 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5690 CHECK(val->result_ok);
5691 LDKFundingLocked res_var = (*val->contents.result);
5692 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5693 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5694 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5698 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5699 CHECK(!val->result_ok);
5700 LDKDecodeError err_var = (*val->contents.err);
5701 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5702 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5703 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5707 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5710 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5711 CHECK(val->result_ok);
5712 LDKInit res_var = (*val->contents.result);
5713 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5714 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5715 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5719 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5720 CHECK(!val->result_ok);
5721 LDKDecodeError err_var = (*val->contents.err);
5722 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5723 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5724 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5728 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5731 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5732 CHECK(val->result_ok);
5733 LDKOpenChannel res_var = (*val->contents.result);
5734 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5735 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5736 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5740 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5741 CHECK(!val->result_ok);
5742 LDKDecodeError err_var = (*val->contents.err);
5743 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5744 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5745 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5749 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5752 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5753 CHECK(val->result_ok);
5754 LDKRevokeAndACK res_var = (*val->contents.result);
5755 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5756 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5757 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5761 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5762 CHECK(!val->result_ok);
5763 LDKDecodeError err_var = (*val->contents.err);
5764 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5765 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5766 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5770 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5773 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5774 CHECK(val->result_ok);
5775 LDKShutdown res_var = (*val->contents.result);
5776 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5777 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5778 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5782 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5783 CHECK(!val->result_ok);
5784 LDKDecodeError err_var = (*val->contents.err);
5785 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5786 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5787 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5790 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5791 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5794 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5795 CHECK(val->result_ok);
5796 LDKUpdateFailHTLC res_var = (*val->contents.result);
5797 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5798 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5799 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5803 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5804 CHECK(!val->result_ok);
5805 LDKDecodeError err_var = (*val->contents.err);
5806 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5807 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5808 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5812 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5815 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5816 CHECK(val->result_ok);
5817 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5818 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5819 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5820 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5824 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5825 CHECK(!val->result_ok);
5826 LDKDecodeError err_var = (*val->contents.err);
5827 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5828 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5829 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5833 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5836 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5837 CHECK(val->result_ok);
5838 LDKUpdateFee res_var = (*val->contents.result);
5839 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5840 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5841 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5845 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5846 CHECK(!val->result_ok);
5847 LDKDecodeError err_var = (*val->contents.err);
5848 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5849 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5850 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5853 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5854 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5857 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5858 CHECK(val->result_ok);
5859 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5860 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5861 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5862 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5866 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5867 CHECK(!val->result_ok);
5868 LDKDecodeError err_var = (*val->contents.err);
5869 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5870 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5871 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5875 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5878 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5879 CHECK(val->result_ok);
5880 LDKUpdateAddHTLC res_var = (*val->contents.result);
5881 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5882 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5883 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5887 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5888 CHECK(!val->result_ok);
5889 LDKDecodeError err_var = (*val->contents.err);
5890 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5891 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5892 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5896 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5899 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5900 CHECK(val->result_ok);
5901 LDKPing res_var = (*val->contents.result);
5902 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5903 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5904 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5908 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5909 CHECK(!val->result_ok);
5910 LDKDecodeError err_var = (*val->contents.err);
5911 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5912 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5913 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5917 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5920 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5921 CHECK(val->result_ok);
5922 LDKPong res_var = (*val->contents.result);
5923 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5924 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5925 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5929 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5930 CHECK(!val->result_ok);
5931 LDKDecodeError err_var = (*val->contents.err);
5932 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5933 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5934 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5938 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5941 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5942 CHECK(val->result_ok);
5943 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5944 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5945 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5946 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5950 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5951 CHECK(!val->result_ok);
5952 LDKDecodeError err_var = (*val->contents.err);
5953 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5954 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5955 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5959 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5962 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5963 CHECK(val->result_ok);
5964 LDKChannelAnnouncement res_var = (*val->contents.result);
5965 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5966 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5967 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5971 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5972 CHECK(!val->result_ok);
5973 LDKDecodeError err_var = (*val->contents.err);
5974 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5980 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5983 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5984 CHECK(val->result_ok);
5985 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5986 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5987 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5988 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5992 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5993 CHECK(!val->result_ok);
5994 LDKDecodeError err_var = (*val->contents.err);
5995 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5996 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5997 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6001 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6004 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6005 CHECK(val->result_ok);
6006 LDKChannelUpdate res_var = (*val->contents.result);
6007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6009 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6013 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6014 CHECK(!val->result_ok);
6015 LDKDecodeError err_var = (*val->contents.err);
6016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6018 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6022 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6025 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6026 CHECK(val->result_ok);
6027 LDKErrorMessage res_var = (*val->contents.result);
6028 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6029 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6030 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6034 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6035 CHECK(!val->result_ok);
6036 LDKDecodeError err_var = (*val->contents.err);
6037 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6038 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6039 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6043 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6046 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6047 CHECK(val->result_ok);
6048 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6049 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6050 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6051 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6055 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6056 CHECK(!val->result_ok);
6057 LDKDecodeError err_var = (*val->contents.err);
6058 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6059 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6060 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6064 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6067 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6068 CHECK(val->result_ok);
6069 LDKNodeAnnouncement res_var = (*val->contents.result);
6070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6076 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6077 CHECK(!val->result_ok);
6078 LDKDecodeError err_var = (*val->contents.err);
6079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6085 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6088 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6089 CHECK(val->result_ok);
6090 LDKQueryShortChannelIds res_var = (*val->contents.result);
6091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6097 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6098 CHECK(!val->result_ok);
6099 LDKDecodeError err_var = (*val->contents.err);
6100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6106 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6109 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6110 CHECK(val->result_ok);
6111 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6112 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6113 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6114 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6118 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6119 CHECK(!val->result_ok);
6120 LDKDecodeError err_var = (*val->contents.err);
6121 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6122 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6123 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6127 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6130 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6131 CHECK(val->result_ok);
6132 LDKQueryChannelRange res_var = (*val->contents.result);
6133 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6134 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6135 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6139 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6140 CHECK(!val->result_ok);
6141 LDKDecodeError err_var = (*val->contents.err);
6142 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6143 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6144 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6147 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6148 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
6150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6151 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6152 CHECK(val->result_ok);
6153 LDKReplyChannelRange res_var = (*val->contents.result);
6154 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6155 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6156 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6160 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6161 CHECK(!val->result_ok);
6162 LDKDecodeError err_var = (*val->contents.err);
6163 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6164 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6165 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6168 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6169 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
6171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6172 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6173 CHECK(val->result_ok);
6174 LDKGossipTimestampFilter res_var = (*val->contents.result);
6175 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6176 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6177 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6181 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6182 CHECK(!val->result_ok);
6183 LDKDecodeError err_var = (*val->contents.err);
6184 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6185 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6186 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6189 static jclass LDKSignOrCreationError_SignError_class = NULL;
6190 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
6191 static jclass LDKSignOrCreationError_CreationError_class = NULL;
6192 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
6193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
6194 LDKSignOrCreationError_SignError_class =
6195 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
6196 CHECK(LDKSignOrCreationError_SignError_class != NULL);
6197 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
6198 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
6199 LDKSignOrCreationError_CreationError_class =
6200 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6201 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6202 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6203 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6205 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6206 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6208 case LDKSignOrCreationError_SignError: {
6209 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6211 case LDKSignOrCreationError_CreationError: {
6212 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6213 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6219 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6222 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6223 CHECK(val->result_ok);
6224 LDKInvoice res_var = (*val->contents.result);
6225 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6226 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6227 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6231 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6232 CHECK(!val->result_ok);
6233 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6236 typedef struct LDKMessageSendEventsProvider_JCalls {
6237 atomic_size_t refcnt;
6240 jmethodID get_and_clear_pending_msg_events_meth;
6241 } LDKMessageSendEventsProvider_JCalls;
6242 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6243 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6244 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6246 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6247 if (get_jenv_res == JNI_EDETACHED) {
6248 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6250 DO_ASSERT(get_jenv_res == JNI_OK);
6252 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6253 if (get_jenv_res == JNI_EDETACHED) {
6254 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6259 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6260 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6262 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6263 if (get_jenv_res == JNI_EDETACHED) {
6264 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6266 DO_ASSERT(get_jenv_res == JNI_OK);
6268 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6270 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
6271 if ((*env)->ExceptionCheck(env)) {
6272 (*env)->ExceptionDescribe(env);
6273 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
6275 LDKCVec_MessageSendEventZ ret_constr;
6276 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6277 if (ret_constr.datalen > 0)
6278 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6280 ret_constr.data = NULL;
6281 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6282 for (size_t s = 0; s < ret_constr.datalen; s++) {
6283 int64_t ret_conv_18 = ret_vals[s];
6284 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
6285 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
6286 ret_constr.data[s] = ret_conv_18_conv;
6288 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6289 if (get_jenv_res == JNI_EDETACHED) {
6290 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6294 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6295 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6296 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6298 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6299 jclass c = (*env)->GetObjectClass(env, o);
6301 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6302 atomic_init(&calls->refcnt, 1);
6303 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6304 calls->o = (*env)->NewWeakGlobalRef(env, o);
6305 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6306 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6308 LDKMessageSendEventsProvider ret = {
6309 .this_arg = (void*) calls,
6310 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6311 .free = LDKMessageSendEventsProvider_JCalls_free,
6315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6316 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6317 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6318 return (uint64_t)res_ptr;
6320 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6321 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6322 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6323 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6324 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6325 for (size_t s = 0; s < ret_var.datalen; s++) {
6326 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6327 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6328 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6329 ret_arr_ptr[s] = ret_conv_18_ref;
6331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6336 typedef struct LDKEventHandler_JCalls {
6337 atomic_size_t refcnt;
6340 jmethodID handle_event_meth;
6341 } LDKEventHandler_JCalls;
6342 static void LDKEventHandler_JCalls_free(void* this_arg) {
6343 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6344 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6346 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6347 if (get_jenv_res == JNI_EDETACHED) {
6348 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6350 DO_ASSERT(get_jenv_res == JNI_OK);
6352 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6353 if (get_jenv_res == JNI_EDETACHED) {
6354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6359 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6360 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6362 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6363 if (get_jenv_res == JNI_EDETACHED) {
6364 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6366 DO_ASSERT(get_jenv_res == JNI_OK);
6368 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6369 *event_copy = event;
6370 uint64_t event_ref = (uint64_t)event_copy;
6371 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6373 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6374 if ((*env)->ExceptionCheck(env)) {
6375 (*env)->ExceptionDescribe(env);
6376 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
6378 if (get_jenv_res == JNI_EDETACHED) {
6379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6382 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6383 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6384 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6386 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6387 jclass c = (*env)->GetObjectClass(env, o);
6389 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6390 atomic_init(&calls->refcnt, 1);
6391 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6392 calls->o = (*env)->NewWeakGlobalRef(env, o);
6393 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6394 CHECK(calls->handle_event_meth != NULL);
6396 LDKEventHandler ret = {
6397 .this_arg = (void*) calls,
6398 .handle_event = handle_event_LDKEventHandler_jcall,
6399 .free = LDKEventHandler_JCalls_free,
6403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6404 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6405 *res_ptr = LDKEventHandler_init(env, clz, o);
6406 return (uint64_t)res_ptr;
6408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6409 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6410 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6411 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6414 typedef struct LDKEventsProvider_JCalls {
6415 atomic_size_t refcnt;
6418 jmethodID process_pending_events_meth;
6419 } LDKEventsProvider_JCalls;
6420 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6421 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6422 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6424 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6425 if (get_jenv_res == JNI_EDETACHED) {
6426 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6428 DO_ASSERT(get_jenv_res == JNI_OK);
6430 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6431 if (get_jenv_res == JNI_EDETACHED) {
6432 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6437 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6438 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6440 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6441 if (get_jenv_res == JNI_EDETACHED) {
6442 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6444 DO_ASSERT(get_jenv_res == JNI_OK);
6446 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6450 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6451 if ((*env)->ExceptionCheck(env)) {
6452 (*env)->ExceptionDescribe(env);
6453 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
6455 if (get_jenv_res == JNI_EDETACHED) {
6456 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6459 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6460 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6461 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6463 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6464 jclass c = (*env)->GetObjectClass(env, o);
6466 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6467 atomic_init(&calls->refcnt, 1);
6468 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6469 calls->o = (*env)->NewWeakGlobalRef(env, o);
6470 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6471 CHECK(calls->process_pending_events_meth != NULL);
6473 LDKEventsProvider ret = {
6474 .this_arg = (void*) calls,
6475 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6476 .free = LDKEventsProvider_JCalls_free,
6480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6481 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6482 *res_ptr = LDKEventsProvider_init(env, clz, o);
6483 return (uint64_t)res_ptr;
6485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6486 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6487 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6488 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6489 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6490 LDKEventHandler_JCalls_cloned(&handler_conv);
6492 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6495 typedef struct LDKAccess_JCalls {
6496 atomic_size_t refcnt;
6499 jmethodID get_utxo_meth;
6501 static void LDKAccess_JCalls_free(void* this_arg) {
6502 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6505 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6506 if (get_jenv_res == JNI_EDETACHED) {
6507 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6509 DO_ASSERT(get_jenv_res == JNI_OK);
6511 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6512 if (get_jenv_res == JNI_EDETACHED) {
6513 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6518 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6519 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6521 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6522 if (get_jenv_res == JNI_EDETACHED) {
6523 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6525 DO_ASSERT(get_jenv_res == JNI_OK);
6527 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6528 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6531 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6532 if ((*env)->ExceptionCheck(env)) {
6533 (*env)->ExceptionDescribe(env);
6534 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6536 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6537 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6538 if (get_jenv_res == JNI_EDETACHED) {
6539 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6543 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6544 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6545 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6547 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6548 jclass c = (*env)->GetObjectClass(env, o);
6550 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6551 atomic_init(&calls->refcnt, 1);
6552 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6553 calls->o = (*env)->NewWeakGlobalRef(env, o);
6554 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6555 CHECK(calls->get_utxo_meth != NULL);
6558 .this_arg = (void*) calls,
6559 .get_utxo = get_utxo_LDKAccess_jcall,
6560 .free = LDKAccess_JCalls_free,
6564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6565 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6566 *res_ptr = LDKAccess_init(env, clz, o);
6567 return (uint64_t)res_ptr;
6569 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) {
6570 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6571 unsigned char genesis_hash_arr[32];
6572 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6573 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6574 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6575 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6576 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6577 return (uint64_t)ret_conv;
6580 typedef struct LDKListen_JCalls {
6581 atomic_size_t refcnt;
6584 jmethodID block_connected_meth;
6585 jmethodID block_disconnected_meth;
6587 static void LDKListen_JCalls_free(void* this_arg) {
6588 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6589 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6591 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6592 if (get_jenv_res == JNI_EDETACHED) {
6593 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6595 DO_ASSERT(get_jenv_res == JNI_OK);
6597 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6598 if (get_jenv_res == JNI_EDETACHED) {
6599 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6604 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6605 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6607 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6608 if (get_jenv_res == JNI_EDETACHED) {
6609 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6611 DO_ASSERT(get_jenv_res == JNI_OK);
6613 LDKu8slice block_var = block;
6614 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6615 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6616 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6618 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6619 if ((*env)->ExceptionCheck(env)) {
6620 (*env)->ExceptionDescribe(env);
6621 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
6623 if (get_jenv_res == JNI_EDETACHED) {
6624 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6627 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6628 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6630 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6631 if (get_jenv_res == JNI_EDETACHED) {
6632 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6634 DO_ASSERT(get_jenv_res == JNI_OK);
6636 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6637 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6638 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6640 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6641 if ((*env)->ExceptionCheck(env)) {
6642 (*env)->ExceptionDescribe(env);
6643 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
6645 if (get_jenv_res == JNI_EDETACHED) {
6646 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6649 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6650 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6651 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6653 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6654 jclass c = (*env)->GetObjectClass(env, o);
6656 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6657 atomic_init(&calls->refcnt, 1);
6658 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6659 calls->o = (*env)->NewWeakGlobalRef(env, o);
6660 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6661 CHECK(calls->block_connected_meth != NULL);
6662 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6663 CHECK(calls->block_disconnected_meth != NULL);
6666 .this_arg = (void*) calls,
6667 .block_connected = block_connected_LDKListen_jcall,
6668 .block_disconnected = block_disconnected_LDKListen_jcall,
6669 .free = LDKListen_JCalls_free,
6673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6674 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6675 *res_ptr = LDKListen_init(env, clz, o);
6676 return (uint64_t)res_ptr;
6678 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) {
6679 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6680 LDKu8slice block_ref;
6681 block_ref.datalen = (*env)->GetArrayLength(env, block);
6682 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6683 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6684 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6687 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) {
6688 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6689 unsigned char header_arr[80];
6690 CHECK((*env)->GetArrayLength(env, header) == 80);
6691 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6692 unsigned char (*header_ref)[80] = &header_arr;
6693 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6696 typedef struct LDKConfirm_JCalls {
6697 atomic_size_t refcnt;
6700 jmethodID transactions_confirmed_meth;
6701 jmethodID transaction_unconfirmed_meth;
6702 jmethodID best_block_updated_meth;
6703 jmethodID get_relevant_txids_meth;
6704 } LDKConfirm_JCalls;
6705 static void LDKConfirm_JCalls_free(void* this_arg) {
6706 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6707 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6709 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6710 if (get_jenv_res == JNI_EDETACHED) {
6711 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6713 DO_ASSERT(get_jenv_res == JNI_OK);
6715 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6716 if (get_jenv_res == JNI_EDETACHED) {
6717 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6722 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6723 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6725 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6726 if (get_jenv_res == JNI_EDETACHED) {
6727 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6729 DO_ASSERT(get_jenv_res == JNI_OK);
6731 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6732 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6733 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6734 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6735 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6736 for (size_t y = 0; y < txdata_var.datalen; y++) {
6737 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6738 *txdata_conv_24_ref = txdata_var.data[y];
6739 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6741 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6742 FREE(txdata_var.data);
6743 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6745 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6746 if ((*env)->ExceptionCheck(env)) {
6747 (*env)->ExceptionDescribe(env);
6748 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
6750 if (get_jenv_res == JNI_EDETACHED) {
6751 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6754 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6755 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6757 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6758 if (get_jenv_res == JNI_EDETACHED) {
6759 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6761 DO_ASSERT(get_jenv_res == JNI_OK);
6763 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6764 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6765 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6767 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6768 if ((*env)->ExceptionCheck(env)) {
6769 (*env)->ExceptionDescribe(env);
6770 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
6772 if (get_jenv_res == JNI_EDETACHED) {
6773 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6776 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6777 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6779 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6780 if (get_jenv_res == JNI_EDETACHED) {
6781 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6783 DO_ASSERT(get_jenv_res == JNI_OK);
6785 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6786 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6787 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6789 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6790 if ((*env)->ExceptionCheck(env)) {
6791 (*env)->ExceptionDescribe(env);
6792 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
6794 if (get_jenv_res == JNI_EDETACHED) {
6795 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6798 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6799 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6801 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6802 if (get_jenv_res == JNI_EDETACHED) {
6803 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6805 DO_ASSERT(get_jenv_res == JNI_OK);
6807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6809 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6810 if ((*env)->ExceptionCheck(env)) {
6811 (*env)->ExceptionDescribe(env);
6812 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
6814 LDKCVec_TxidZ ret_constr;
6815 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6816 if (ret_constr.datalen > 0)
6817 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6819 ret_constr.data = NULL;
6820 for (size_t i = 0; i < ret_constr.datalen; i++) {
6821 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6822 LDKThirtyTwoBytes ret_conv_8_ref;
6823 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6824 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6825 ret_constr.data[i] = ret_conv_8_ref;
6827 if (get_jenv_res == JNI_EDETACHED) {
6828 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6832 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6833 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6834 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6836 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6837 jclass c = (*env)->GetObjectClass(env, o);
6839 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6840 atomic_init(&calls->refcnt, 1);
6841 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6842 calls->o = (*env)->NewWeakGlobalRef(env, o);
6843 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6844 CHECK(calls->transactions_confirmed_meth != NULL);
6845 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6846 CHECK(calls->transaction_unconfirmed_meth != NULL);
6847 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6848 CHECK(calls->best_block_updated_meth != NULL);
6849 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6850 CHECK(calls->get_relevant_txids_meth != NULL);
6853 .this_arg = (void*) calls,
6854 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6855 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6856 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6857 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6858 .free = LDKConfirm_JCalls_free,
6862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6863 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6864 *res_ptr = LDKConfirm_init(env, clz, o);
6865 return (uint64_t)res_ptr;
6867 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) {
6868 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6869 unsigned char header_arr[80];
6870 CHECK((*env)->GetArrayLength(env, header) == 80);
6871 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6872 unsigned char (*header_ref)[80] = &header_arr;
6873 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6874 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6875 if (txdata_constr.datalen > 0)
6876 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6878 txdata_constr.data = NULL;
6879 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6880 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6881 int64_t txdata_conv_24 = txdata_vals[y];
6882 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6883 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6884 txdata_constr.data[y] = txdata_conv_24_conv;
6886 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6887 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6891 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6892 unsigned char txid_arr[32];
6893 CHECK((*env)->GetArrayLength(env, txid) == 32);
6894 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6895 unsigned char (*txid_ref)[32] = &txid_arr;
6896 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6899 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) {
6900 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6901 unsigned char header_arr[80];
6902 CHECK((*env)->GetArrayLength(env, header) == 80);
6903 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6904 unsigned char (*header_ref)[80] = &header_arr;
6905 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6908 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6909 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6910 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6911 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6913 for (size_t i = 0; i < ret_var.datalen; i++) {
6914 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6915 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6916 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6922 typedef struct LDKFilter_JCalls {
6923 atomic_size_t refcnt;
6926 jmethodID register_tx_meth;
6927 jmethodID register_output_meth;
6929 static void LDKFilter_JCalls_free(void* this_arg) {
6930 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6931 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6933 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6934 if (get_jenv_res == JNI_EDETACHED) {
6935 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6937 DO_ASSERT(get_jenv_res == JNI_OK);
6939 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6940 if (get_jenv_res == JNI_EDETACHED) {
6941 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6946 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6947 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6950 if (get_jenv_res == JNI_EDETACHED) {
6951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6953 DO_ASSERT(get_jenv_res == JNI_OK);
6955 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6956 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6957 LDKu8slice script_pubkey_var = script_pubkey;
6958 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6959 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6960 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6962 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6963 if ((*env)->ExceptionCheck(env)) {
6964 (*env)->ExceptionDescribe(env);
6965 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
6967 if (get_jenv_res == JNI_EDETACHED) {
6968 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6971 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6972 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6974 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6975 if (get_jenv_res == JNI_EDETACHED) {
6976 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6978 DO_ASSERT(get_jenv_res == JNI_OK);
6980 LDKWatchedOutput output_var = output;
6981 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6982 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6983 uint64_t output_ref = (uint64_t)output_var.inner;
6984 if (output_var.is_owned) {
6987 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6989 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6990 if ((*env)->ExceptionCheck(env)) {
6991 (*env)->ExceptionDescribe(env);
6992 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
6994 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6995 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6996 if (get_jenv_res == JNI_EDETACHED) {
6997 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7001 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7002 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7003 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7005 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7006 jclass c = (*env)->GetObjectClass(env, o);
7008 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7009 atomic_init(&calls->refcnt, 1);
7010 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7011 calls->o = (*env)->NewWeakGlobalRef(env, o);
7012 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7013 CHECK(calls->register_tx_meth != NULL);
7014 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7015 CHECK(calls->register_output_meth != NULL);
7018 .this_arg = (void*) calls,
7019 .register_tx = register_tx_LDKFilter_jcall,
7020 .register_output = register_output_LDKFilter_jcall,
7021 .free = LDKFilter_JCalls_free,
7025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7026 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7027 *res_ptr = LDKFilter_init(env, clz, o);
7028 return (uint64_t)res_ptr;
7030 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) {
7031 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7032 unsigned char txid_arr[32];
7033 CHECK((*env)->GetArrayLength(env, txid) == 32);
7034 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7035 unsigned char (*txid_ref)[32] = &txid_arr;
7036 LDKu8slice script_pubkey_ref;
7037 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7038 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7039 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7040 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7044 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7045 LDKWatchedOutput output_conv;
7046 output_conv.inner = (void*)(output & (~1));
7047 output_conv.is_owned = (output & 1) || (output == 0);
7048 output_conv = WatchedOutput_clone(&output_conv);
7049 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7050 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7051 uint64_t ret_ref = (uint64_t)ret_copy;
7055 typedef struct LDKPersist_JCalls {
7056 atomic_size_t refcnt;
7059 jmethodID persist_new_channel_meth;
7060 jmethodID update_persisted_channel_meth;
7061 } LDKPersist_JCalls;
7062 static void LDKPersist_JCalls_free(void* this_arg) {
7063 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7064 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7066 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7067 if (get_jenv_res == JNI_EDETACHED) {
7068 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7070 DO_ASSERT(get_jenv_res == JNI_OK);
7072 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7073 if (get_jenv_res == JNI_EDETACHED) {
7074 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7079 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7080 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7082 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7083 if (get_jenv_res == JNI_EDETACHED) {
7084 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7086 DO_ASSERT(get_jenv_res == JNI_OK);
7088 LDKOutPoint id_var = id;
7089 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7090 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7091 uint64_t id_ref = (uint64_t)id_var.inner;
7092 if (id_var.is_owned) {
7095 LDKChannelMonitor data_var = *data;
7096 data_var = ChannelMonitor_clone(data);
7097 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7098 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7099 uint64_t data_ref = (uint64_t)data_var.inner;
7100 if (data_var.is_owned) {
7103 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7105 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7106 if ((*env)->ExceptionCheck(env)) {
7107 (*env)->ExceptionDescribe(env);
7108 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7110 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7111 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7112 if (get_jenv_res == JNI_EDETACHED) {
7113 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7117 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7118 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7120 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7121 if (get_jenv_res == JNI_EDETACHED) {
7122 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7124 DO_ASSERT(get_jenv_res == JNI_OK);
7126 LDKOutPoint id_var = id;
7127 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7128 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7129 uint64_t id_ref = (uint64_t)id_var.inner;
7130 if (id_var.is_owned) {
7133 LDKChannelMonitorUpdate update_var = *update;
7134 update_var = ChannelMonitorUpdate_clone(update);
7135 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7136 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7137 uint64_t update_ref = (uint64_t)update_var.inner;
7138 if (update_var.is_owned) {
7141 LDKChannelMonitor data_var = *data;
7142 data_var = ChannelMonitor_clone(data);
7143 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7144 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7145 uint64_t data_ref = (uint64_t)data_var.inner;
7146 if (data_var.is_owned) {
7149 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7151 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7152 if ((*env)->ExceptionCheck(env)) {
7153 (*env)->ExceptionDescribe(env);
7154 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7156 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7157 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7158 if (get_jenv_res == JNI_EDETACHED) {
7159 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7163 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7164 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7165 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7167 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7168 jclass c = (*env)->GetObjectClass(env, o);
7170 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7171 atomic_init(&calls->refcnt, 1);
7172 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7173 calls->o = (*env)->NewWeakGlobalRef(env, o);
7174 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7175 CHECK(calls->persist_new_channel_meth != NULL);
7176 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7177 CHECK(calls->update_persisted_channel_meth != NULL);
7180 .this_arg = (void*) calls,
7181 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7182 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7183 .free = LDKPersist_JCalls_free,
7187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7188 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7189 *res_ptr = LDKPersist_init(env, clz, o);
7190 return (uint64_t)res_ptr;
7192 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) {
7193 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7194 LDKOutPoint id_conv;
7195 id_conv.inner = (void*)(id & (~1));
7196 id_conv.is_owned = (id & 1) || (id == 0);
7197 id_conv = OutPoint_clone(&id_conv);
7198 LDKChannelMonitor data_conv;
7199 data_conv.inner = (void*)(data & (~1));
7200 data_conv.is_owned = false;
7201 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7202 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7203 return (uint64_t)ret_conv;
7206 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) {
7207 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7208 LDKOutPoint id_conv;
7209 id_conv.inner = (void*)(id & (~1));
7210 id_conv.is_owned = (id & 1) || (id == 0);
7211 id_conv = OutPoint_clone(&id_conv);
7212 LDKChannelMonitorUpdate update_conv;
7213 update_conv.inner = (void*)(update & (~1));
7214 update_conv.is_owned = false;
7215 LDKChannelMonitor data_conv;
7216 data_conv.inner = (void*)(data & (~1));
7217 data_conv.is_owned = false;
7218 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7219 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7220 return (uint64_t)ret_conv;
7223 typedef struct LDKChannelMessageHandler_JCalls {
7224 atomic_size_t refcnt;
7227 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7228 jmethodID handle_open_channel_meth;
7229 jmethodID handle_accept_channel_meth;
7230 jmethodID handle_funding_created_meth;
7231 jmethodID handle_funding_signed_meth;
7232 jmethodID handle_funding_locked_meth;
7233 jmethodID handle_shutdown_meth;
7234 jmethodID handle_closing_signed_meth;
7235 jmethodID handle_update_add_htlc_meth;
7236 jmethodID handle_update_fulfill_htlc_meth;
7237 jmethodID handle_update_fail_htlc_meth;
7238 jmethodID handle_update_fail_malformed_htlc_meth;
7239 jmethodID handle_commitment_signed_meth;
7240 jmethodID handle_revoke_and_ack_meth;
7241 jmethodID handle_update_fee_meth;
7242 jmethodID handle_announcement_signatures_meth;
7243 jmethodID peer_disconnected_meth;
7244 jmethodID peer_connected_meth;
7245 jmethodID handle_channel_reestablish_meth;
7246 jmethodID handle_channel_update_meth;
7247 jmethodID handle_error_meth;
7248 } LDKChannelMessageHandler_JCalls;
7249 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7250 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7251 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7253 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7254 if (get_jenv_res == JNI_EDETACHED) {
7255 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7257 DO_ASSERT(get_jenv_res == JNI_OK);
7259 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7260 if (get_jenv_res == JNI_EDETACHED) {
7261 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7266 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7267 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7269 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7270 if (get_jenv_res == JNI_EDETACHED) {
7271 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7273 DO_ASSERT(get_jenv_res == JNI_OK);
7275 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7276 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7277 LDKInitFeatures their_features_var = their_features;
7278 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7279 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7280 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7281 if (their_features_var.is_owned) {
7282 their_features_ref |= 1;
7284 LDKOpenChannel msg_var = *msg;
7285 msg_var = OpenChannel_clone(msg);
7286 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7287 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7288 uint64_t msg_ref = (uint64_t)msg_var.inner;
7289 if (msg_var.is_owned) {
7292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7294 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7295 if ((*env)->ExceptionCheck(env)) {
7296 (*env)->ExceptionDescribe(env);
7297 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
7299 if (get_jenv_res == JNI_EDETACHED) {
7300 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7303 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7304 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7306 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7307 if (get_jenv_res == JNI_EDETACHED) {
7308 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7310 DO_ASSERT(get_jenv_res == JNI_OK);
7312 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7313 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7314 LDKInitFeatures their_features_var = their_features;
7315 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7316 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7317 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7318 if (their_features_var.is_owned) {
7319 their_features_ref |= 1;
7321 LDKAcceptChannel msg_var = *msg;
7322 msg_var = AcceptChannel_clone(msg);
7323 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7324 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7325 uint64_t msg_ref = (uint64_t)msg_var.inner;
7326 if (msg_var.is_owned) {
7329 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7331 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7332 if ((*env)->ExceptionCheck(env)) {
7333 (*env)->ExceptionDescribe(env);
7334 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
7336 if (get_jenv_res == JNI_EDETACHED) {
7337 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7340 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7341 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7343 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7344 if (get_jenv_res == JNI_EDETACHED) {
7345 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7347 DO_ASSERT(get_jenv_res == JNI_OK);
7349 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7350 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7351 LDKFundingCreated msg_var = *msg;
7352 msg_var = FundingCreated_clone(msg);
7353 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7354 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7355 uint64_t msg_ref = (uint64_t)msg_var.inner;
7356 if (msg_var.is_owned) {
7359 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7361 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7362 if ((*env)->ExceptionCheck(env)) {
7363 (*env)->ExceptionDescribe(env);
7364 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
7366 if (get_jenv_res == JNI_EDETACHED) {
7367 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7370 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7371 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7373 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7374 if (get_jenv_res == JNI_EDETACHED) {
7375 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7377 DO_ASSERT(get_jenv_res == JNI_OK);
7379 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7380 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7381 LDKFundingSigned msg_var = *msg;
7382 msg_var = FundingSigned_clone(msg);
7383 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7384 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7385 uint64_t msg_ref = (uint64_t)msg_var.inner;
7386 if (msg_var.is_owned) {
7389 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7391 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7392 if ((*env)->ExceptionCheck(env)) {
7393 (*env)->ExceptionDescribe(env);
7394 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
7396 if (get_jenv_res == JNI_EDETACHED) {
7397 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7400 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7401 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7403 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7404 if (get_jenv_res == JNI_EDETACHED) {
7405 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7407 DO_ASSERT(get_jenv_res == JNI_OK);
7409 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7410 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7411 LDKFundingLocked msg_var = *msg;
7412 msg_var = FundingLocked_clone(msg);
7413 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7414 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7415 uint64_t msg_ref = (uint64_t)msg_var.inner;
7416 if (msg_var.is_owned) {
7419 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7421 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7422 if ((*env)->ExceptionCheck(env)) {
7423 (*env)->ExceptionDescribe(env);
7424 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
7426 if (get_jenv_res == JNI_EDETACHED) {
7427 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7430 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7431 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7433 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7434 if (get_jenv_res == JNI_EDETACHED) {
7435 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7437 DO_ASSERT(get_jenv_res == JNI_OK);
7439 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7440 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7441 LDKInitFeatures their_features_var = *their_features;
7442 their_features_var = InitFeatures_clone(their_features);
7443 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7444 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7445 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7446 if (their_features_var.is_owned) {
7447 their_features_ref |= 1;
7449 LDKShutdown msg_var = *msg;
7450 msg_var = Shutdown_clone(msg);
7451 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7452 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7453 uint64_t msg_ref = (uint64_t)msg_var.inner;
7454 if (msg_var.is_owned) {
7457 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7459 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7460 if ((*env)->ExceptionCheck(env)) {
7461 (*env)->ExceptionDescribe(env);
7462 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
7464 if (get_jenv_res == JNI_EDETACHED) {
7465 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7468 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7469 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7471 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7472 if (get_jenv_res == JNI_EDETACHED) {
7473 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7475 DO_ASSERT(get_jenv_res == JNI_OK);
7477 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7478 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7479 LDKClosingSigned msg_var = *msg;
7480 msg_var = ClosingSigned_clone(msg);
7481 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7482 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7483 uint64_t msg_ref = (uint64_t)msg_var.inner;
7484 if (msg_var.is_owned) {
7487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7489 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7490 if ((*env)->ExceptionCheck(env)) {
7491 (*env)->ExceptionDescribe(env);
7492 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
7494 if (get_jenv_res == JNI_EDETACHED) {
7495 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7498 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7499 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7501 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7502 if (get_jenv_res == JNI_EDETACHED) {
7503 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7505 DO_ASSERT(get_jenv_res == JNI_OK);
7507 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7508 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7509 LDKUpdateAddHTLC msg_var = *msg;
7510 msg_var = UpdateAddHTLC_clone(msg);
7511 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7512 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7513 uint64_t msg_ref = (uint64_t)msg_var.inner;
7514 if (msg_var.is_owned) {
7517 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7519 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7520 if ((*env)->ExceptionCheck(env)) {
7521 (*env)->ExceptionDescribe(env);
7522 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler 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 handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7529 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_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 their_node_id_arr = (*env)->NewByteArray(env, 33);
7538 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7539 LDKUpdateFulfillHTLC msg_var = *msg;
7540 msg_var = UpdateFulfillHTLC_clone(msg);
7541 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7542 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7543 uint64_t msg_ref = (uint64_t)msg_var.inner;
7544 if (msg_var.is_owned) {
7547 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7549 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7550 if ((*env)->ExceptionCheck(env)) {
7551 (*env)->ExceptionDescribe(env);
7552 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
7554 if (get_jenv_res == JNI_EDETACHED) {
7555 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7558 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7559 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7561 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7562 if (get_jenv_res == JNI_EDETACHED) {
7563 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7565 DO_ASSERT(get_jenv_res == JNI_OK);
7567 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7568 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7569 LDKUpdateFailHTLC msg_var = *msg;
7570 msg_var = UpdateFailHTLC_clone(msg);
7571 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7572 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7573 uint64_t msg_ref = (uint64_t)msg_var.inner;
7574 if (msg_var.is_owned) {
7577 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7579 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7580 if ((*env)->ExceptionCheck(env)) {
7581 (*env)->ExceptionDescribe(env);
7582 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
7584 if (get_jenv_res == JNI_EDETACHED) {
7585 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7588 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7589 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7591 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7592 if (get_jenv_res == JNI_EDETACHED) {
7593 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7595 DO_ASSERT(get_jenv_res == JNI_OK);
7597 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7598 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7599 LDKUpdateFailMalformedHTLC msg_var = *msg;
7600 msg_var = UpdateFailMalformedHTLC_clone(msg);
7601 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7602 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7603 uint64_t msg_ref = (uint64_t)msg_var.inner;
7604 if (msg_var.is_owned) {
7607 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7609 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7610 if ((*env)->ExceptionCheck(env)) {
7611 (*env)->ExceptionDescribe(env);
7612 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
7614 if (get_jenv_res == JNI_EDETACHED) {
7615 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7618 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7619 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7621 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7622 if (get_jenv_res == JNI_EDETACHED) {
7623 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7625 DO_ASSERT(get_jenv_res == JNI_OK);
7627 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7628 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7629 LDKCommitmentSigned msg_var = *msg;
7630 msg_var = CommitmentSigned_clone(msg);
7631 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7632 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7633 uint64_t msg_ref = (uint64_t)msg_var.inner;
7634 if (msg_var.is_owned) {
7637 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7639 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7640 if ((*env)->ExceptionCheck(env)) {
7641 (*env)->ExceptionDescribe(env);
7642 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
7644 if (get_jenv_res == JNI_EDETACHED) {
7645 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7648 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7649 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7651 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7652 if (get_jenv_res == JNI_EDETACHED) {
7653 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7655 DO_ASSERT(get_jenv_res == JNI_OK);
7657 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7658 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7659 LDKRevokeAndACK msg_var = *msg;
7660 msg_var = RevokeAndACK_clone(msg);
7661 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7662 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7663 uint64_t msg_ref = (uint64_t)msg_var.inner;
7664 if (msg_var.is_owned) {
7667 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7669 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7670 if ((*env)->ExceptionCheck(env)) {
7671 (*env)->ExceptionDescribe(env);
7672 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
7674 if (get_jenv_res == JNI_EDETACHED) {
7675 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7678 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7679 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7681 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7682 if (get_jenv_res == JNI_EDETACHED) {
7683 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7685 DO_ASSERT(get_jenv_res == JNI_OK);
7687 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7688 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7689 LDKUpdateFee msg_var = *msg;
7690 msg_var = UpdateFee_clone(msg);
7691 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7692 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7693 uint64_t msg_ref = (uint64_t)msg_var.inner;
7694 if (msg_var.is_owned) {
7697 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7699 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7700 if ((*env)->ExceptionCheck(env)) {
7701 (*env)->ExceptionDescribe(env);
7702 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
7704 if (get_jenv_res == JNI_EDETACHED) {
7705 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7708 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7709 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7711 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7712 if (get_jenv_res == JNI_EDETACHED) {
7713 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7715 DO_ASSERT(get_jenv_res == JNI_OK);
7717 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7718 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7719 LDKAnnouncementSignatures msg_var = *msg;
7720 msg_var = AnnouncementSignatures_clone(msg);
7721 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7722 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7723 uint64_t msg_ref = (uint64_t)msg_var.inner;
7724 if (msg_var.is_owned) {
7727 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7729 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7730 if ((*env)->ExceptionCheck(env)) {
7731 (*env)->ExceptionDescribe(env);
7732 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
7734 if (get_jenv_res == JNI_EDETACHED) {
7735 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7738 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7739 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7741 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7742 if (get_jenv_res == JNI_EDETACHED) {
7743 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7745 DO_ASSERT(get_jenv_res == JNI_OK);
7747 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7748 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7749 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7751 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7752 if ((*env)->ExceptionCheck(env)) {
7753 (*env)->ExceptionDescribe(env);
7754 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
7756 if (get_jenv_res == JNI_EDETACHED) {
7757 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7760 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7761 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7763 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7764 if (get_jenv_res == JNI_EDETACHED) {
7765 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7767 DO_ASSERT(get_jenv_res == JNI_OK);
7769 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7770 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7771 LDKInit msg_var = *msg;
7772 msg_var = Init_clone(msg);
7773 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7774 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7775 uint64_t msg_ref = (uint64_t)msg_var.inner;
7776 if (msg_var.is_owned) {
7779 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7781 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7782 if ((*env)->ExceptionCheck(env)) {
7783 (*env)->ExceptionDescribe(env);
7784 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
7786 if (get_jenv_res == JNI_EDETACHED) {
7787 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7790 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7791 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7793 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7794 if (get_jenv_res == JNI_EDETACHED) {
7795 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7797 DO_ASSERT(get_jenv_res == JNI_OK);
7799 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7800 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7801 LDKChannelReestablish msg_var = *msg;
7802 msg_var = ChannelReestablish_clone(msg);
7803 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7804 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7805 uint64_t msg_ref = (uint64_t)msg_var.inner;
7806 if (msg_var.is_owned) {
7809 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7811 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7812 if ((*env)->ExceptionCheck(env)) {
7813 (*env)->ExceptionDescribe(env);
7814 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
7816 if (get_jenv_res == JNI_EDETACHED) {
7817 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7820 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7821 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7823 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7824 if (get_jenv_res == JNI_EDETACHED) {
7825 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7827 DO_ASSERT(get_jenv_res == JNI_OK);
7829 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7830 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7831 LDKChannelUpdate msg_var = *msg;
7832 msg_var = ChannelUpdate_clone(msg);
7833 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7834 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7835 uint64_t msg_ref = (uint64_t)msg_var.inner;
7836 if (msg_var.is_owned) {
7839 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7841 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7842 if ((*env)->ExceptionCheck(env)) {
7843 (*env)->ExceptionDescribe(env);
7844 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
7846 if (get_jenv_res == JNI_EDETACHED) {
7847 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7850 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7851 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7854 if (get_jenv_res == JNI_EDETACHED) {
7855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7857 DO_ASSERT(get_jenv_res == JNI_OK);
7859 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7860 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7861 LDKErrorMessage msg_var = *msg;
7862 msg_var = ErrorMessage_clone(msg);
7863 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7864 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7865 uint64_t msg_ref = (uint64_t)msg_var.inner;
7866 if (msg_var.is_owned) {
7869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7871 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7872 if ((*env)->ExceptionCheck(env)) {
7873 (*env)->ExceptionDescribe(env);
7874 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
7876 if (get_jenv_res == JNI_EDETACHED) {
7877 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7880 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7881 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7882 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7883 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7885 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7886 jclass c = (*env)->GetObjectClass(env, o);
7888 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7889 atomic_init(&calls->refcnt, 1);
7890 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7891 calls->o = (*env)->NewWeakGlobalRef(env, o);
7892 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7893 CHECK(calls->handle_open_channel_meth != NULL);
7894 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7895 CHECK(calls->handle_accept_channel_meth != NULL);
7896 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7897 CHECK(calls->handle_funding_created_meth != NULL);
7898 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7899 CHECK(calls->handle_funding_signed_meth != NULL);
7900 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7901 CHECK(calls->handle_funding_locked_meth != NULL);
7902 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7903 CHECK(calls->handle_shutdown_meth != NULL);
7904 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7905 CHECK(calls->handle_closing_signed_meth != NULL);
7906 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7907 CHECK(calls->handle_update_add_htlc_meth != NULL);
7908 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7909 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7910 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7911 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7912 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7913 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7914 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7915 CHECK(calls->handle_commitment_signed_meth != NULL);
7916 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7917 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7918 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7919 CHECK(calls->handle_update_fee_meth != NULL);
7920 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7921 CHECK(calls->handle_announcement_signatures_meth != NULL);
7922 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7923 CHECK(calls->peer_disconnected_meth != NULL);
7924 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7925 CHECK(calls->peer_connected_meth != NULL);
7926 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7927 CHECK(calls->handle_channel_reestablish_meth != NULL);
7928 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7929 CHECK(calls->handle_channel_update_meth != NULL);
7930 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7931 CHECK(calls->handle_error_meth != NULL);
7933 LDKChannelMessageHandler ret = {
7934 .this_arg = (void*) calls,
7935 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7936 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7937 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7938 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7939 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7940 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7941 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7942 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7943 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7944 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7945 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7946 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7947 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7948 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7949 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7950 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7951 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7952 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7953 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7954 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7955 .free = LDKChannelMessageHandler_JCalls_free,
7956 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7958 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7962 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7963 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7964 return (uint64_t)res_ptr;
7966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
7967 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
7968 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
7969 DO_ASSERT((res_ptr & 1) == 0);
7970 return (int64_t)(res_ptr | 1);
7972 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) {
7973 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7974 LDKPublicKey their_node_id_ref;
7975 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7976 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7977 LDKInitFeatures their_features_conv;
7978 their_features_conv.inner = (void*)(their_features & (~1));
7979 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7980 their_features_conv = InitFeatures_clone(&their_features_conv);
7981 LDKOpenChannel msg_conv;
7982 msg_conv.inner = (void*)(msg & (~1));
7983 msg_conv.is_owned = false;
7984 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7987 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) {
7988 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7989 LDKPublicKey their_node_id_ref;
7990 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7991 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7992 LDKInitFeatures their_features_conv;
7993 their_features_conv.inner = (void*)(their_features & (~1));
7994 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7995 their_features_conv = InitFeatures_clone(&their_features_conv);
7996 LDKAcceptChannel msg_conv;
7997 msg_conv.inner = (void*)(msg & (~1));
7998 msg_conv.is_owned = false;
7999 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8002 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) {
8003 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8004 LDKPublicKey their_node_id_ref;
8005 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8006 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8007 LDKFundingCreated msg_conv;
8008 msg_conv.inner = (void*)(msg & (~1));
8009 msg_conv.is_owned = false;
8010 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8013 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) {
8014 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8015 LDKPublicKey their_node_id_ref;
8016 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8017 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8018 LDKFundingSigned msg_conv;
8019 msg_conv.inner = (void*)(msg & (~1));
8020 msg_conv.is_owned = false;
8021 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8024 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) {
8025 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8026 LDKPublicKey their_node_id_ref;
8027 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8028 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8029 LDKFundingLocked msg_conv;
8030 msg_conv.inner = (void*)(msg & (~1));
8031 msg_conv.is_owned = false;
8032 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8035 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) {
8036 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8037 LDKPublicKey their_node_id_ref;
8038 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8039 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8040 LDKInitFeatures their_features_conv;
8041 their_features_conv.inner = (void*)(their_features & (~1));
8042 their_features_conv.is_owned = false;
8043 LDKShutdown msg_conv;
8044 msg_conv.inner = (void*)(msg & (~1));
8045 msg_conv.is_owned = false;
8046 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8049 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) {
8050 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8051 LDKPublicKey their_node_id_ref;
8052 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8053 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8054 LDKClosingSigned msg_conv;
8055 msg_conv.inner = (void*)(msg & (~1));
8056 msg_conv.is_owned = false;
8057 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8060 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) {
8061 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8062 LDKPublicKey their_node_id_ref;
8063 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8064 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8065 LDKUpdateAddHTLC msg_conv;
8066 msg_conv.inner = (void*)(msg & (~1));
8067 msg_conv.is_owned = false;
8068 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8071 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) {
8072 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8073 LDKPublicKey their_node_id_ref;
8074 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8075 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8076 LDKUpdateFulfillHTLC msg_conv;
8077 msg_conv.inner = (void*)(msg & (~1));
8078 msg_conv.is_owned = false;
8079 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8082 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) {
8083 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8084 LDKPublicKey their_node_id_ref;
8085 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8086 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8087 LDKUpdateFailHTLC msg_conv;
8088 msg_conv.inner = (void*)(msg & (~1));
8089 msg_conv.is_owned = false;
8090 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8093 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) {
8094 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8095 LDKPublicKey their_node_id_ref;
8096 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8097 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8098 LDKUpdateFailMalformedHTLC msg_conv;
8099 msg_conv.inner = (void*)(msg & (~1));
8100 msg_conv.is_owned = false;
8101 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8104 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) {
8105 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8106 LDKPublicKey their_node_id_ref;
8107 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8108 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8109 LDKCommitmentSigned msg_conv;
8110 msg_conv.inner = (void*)(msg & (~1));
8111 msg_conv.is_owned = false;
8112 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8115 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) {
8116 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8117 LDKPublicKey their_node_id_ref;
8118 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8119 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8120 LDKRevokeAndACK msg_conv;
8121 msg_conv.inner = (void*)(msg & (~1));
8122 msg_conv.is_owned = false;
8123 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8126 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) {
8127 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8128 LDKPublicKey their_node_id_ref;
8129 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8130 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8131 LDKUpdateFee msg_conv;
8132 msg_conv.inner = (void*)(msg & (~1));
8133 msg_conv.is_owned = false;
8134 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8137 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) {
8138 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8139 LDKPublicKey their_node_id_ref;
8140 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8141 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8142 LDKAnnouncementSignatures msg_conv;
8143 msg_conv.inner = (void*)(msg & (~1));
8144 msg_conv.is_owned = false;
8145 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8148 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) {
8149 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8150 LDKPublicKey their_node_id_ref;
8151 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8152 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8153 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8156 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) {
8157 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8158 LDKPublicKey their_node_id_ref;
8159 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8160 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8162 msg_conv.inner = (void*)(msg & (~1));
8163 msg_conv.is_owned = false;
8164 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8167 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) {
8168 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8169 LDKPublicKey their_node_id_ref;
8170 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8171 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8172 LDKChannelReestablish msg_conv;
8173 msg_conv.inner = (void*)(msg & (~1));
8174 msg_conv.is_owned = false;
8175 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8178 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) {
8179 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8180 LDKPublicKey their_node_id_ref;
8181 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8182 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8183 LDKChannelUpdate msg_conv;
8184 msg_conv.inner = (void*)(msg & (~1));
8185 msg_conv.is_owned = false;
8186 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8189 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) {
8190 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8191 LDKPublicKey their_node_id_ref;
8192 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8193 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8194 LDKErrorMessage msg_conv;
8195 msg_conv.inner = (void*)(msg & (~1));
8196 msg_conv.is_owned = false;
8197 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8200 typedef struct LDKRoutingMessageHandler_JCalls {
8201 atomic_size_t refcnt;
8204 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8205 jmethodID handle_node_announcement_meth;
8206 jmethodID handle_channel_announcement_meth;
8207 jmethodID handle_channel_update_meth;
8208 jmethodID handle_htlc_fail_channel_update_meth;
8209 jmethodID get_next_channel_announcements_meth;
8210 jmethodID get_next_node_announcements_meth;
8211 jmethodID sync_routing_table_meth;
8212 jmethodID handle_reply_channel_range_meth;
8213 jmethodID handle_reply_short_channel_ids_end_meth;
8214 jmethodID handle_query_channel_range_meth;
8215 jmethodID handle_query_short_channel_ids_meth;
8216 } LDKRoutingMessageHandler_JCalls;
8217 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8218 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8219 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8221 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8222 if (get_jenv_res == JNI_EDETACHED) {
8223 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8225 DO_ASSERT(get_jenv_res == JNI_OK);
8227 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8228 if (get_jenv_res == JNI_EDETACHED) {
8229 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8234 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8235 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8237 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8238 if (get_jenv_res == JNI_EDETACHED) {
8239 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8241 DO_ASSERT(get_jenv_res == JNI_OK);
8243 LDKNodeAnnouncement msg_var = *msg;
8244 msg_var = NodeAnnouncement_clone(msg);
8245 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8246 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8247 uint64_t msg_ref = (uint64_t)msg_var.inner;
8248 if (msg_var.is_owned) {
8251 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8253 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8254 if ((*env)->ExceptionCheck(env)) {
8255 (*env)->ExceptionDescribe(env);
8256 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8258 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8259 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8260 if (get_jenv_res == JNI_EDETACHED) {
8261 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8265 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8266 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8268 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8269 if (get_jenv_res == JNI_EDETACHED) {
8270 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8272 DO_ASSERT(get_jenv_res == JNI_OK);
8274 LDKChannelAnnouncement msg_var = *msg;
8275 msg_var = ChannelAnnouncement_clone(msg);
8276 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8277 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8278 uint64_t msg_ref = (uint64_t)msg_var.inner;
8279 if (msg_var.is_owned) {
8282 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8284 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8285 if ((*env)->ExceptionCheck(env)) {
8286 (*env)->ExceptionDescribe(env);
8287 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8289 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8290 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8291 if (get_jenv_res == JNI_EDETACHED) {
8292 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8296 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8297 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8299 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8300 if (get_jenv_res == JNI_EDETACHED) {
8301 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8303 DO_ASSERT(get_jenv_res == JNI_OK);
8305 LDKChannelUpdate msg_var = *msg;
8306 msg_var = ChannelUpdate_clone(msg);
8307 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8308 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8309 uint64_t msg_ref = (uint64_t)msg_var.inner;
8310 if (msg_var.is_owned) {
8313 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8315 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8316 if ((*env)->ExceptionCheck(env)) {
8317 (*env)->ExceptionDescribe(env);
8318 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8320 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8321 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8322 if (get_jenv_res == JNI_EDETACHED) {
8323 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8327 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
8328 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8330 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8331 if (get_jenv_res == JNI_EDETACHED) {
8332 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8334 DO_ASSERT(get_jenv_res == JNI_OK);
8336 uint64_t ret_update = (uint64_t)update;
8337 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8339 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
8340 if ((*env)->ExceptionCheck(env)) {
8341 (*env)->ExceptionDescribe(env);
8342 (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8344 if (get_jenv_res == JNI_EDETACHED) {
8345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8348 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8349 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8351 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8352 if (get_jenv_res == JNI_EDETACHED) {
8353 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8355 DO_ASSERT(get_jenv_res == JNI_OK);
8357 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8359 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8360 if ((*env)->ExceptionCheck(env)) {
8361 (*env)->ExceptionDescribe(env);
8362 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8364 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8365 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8366 if (ret_constr.datalen > 0)
8367 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8369 ret_constr.data = NULL;
8370 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8371 for (size_t l = 0; l < ret_constr.datalen; l++) {
8372 int64_t ret_conv_63 = ret_vals[l];
8373 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8374 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8375 ret_constr.data[l] = ret_conv_63_conv;
8377 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8378 if (get_jenv_res == JNI_EDETACHED) {
8379 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8383 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8384 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8386 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8387 if (get_jenv_res == JNI_EDETACHED) {
8388 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8390 DO_ASSERT(get_jenv_res == JNI_OK);
8392 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
8393 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
8394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8396 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
8397 if ((*env)->ExceptionCheck(env)) {
8398 (*env)->ExceptionDescribe(env);
8399 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8401 LDKCVec_NodeAnnouncementZ ret_constr;
8402 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8403 if (ret_constr.datalen > 0)
8404 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8406 ret_constr.data = NULL;
8407 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8408 for (size_t s = 0; s < ret_constr.datalen; s++) {
8409 int64_t ret_conv_18 = ret_vals[s];
8410 LDKNodeAnnouncement ret_conv_18_conv;
8411 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8412 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8413 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
8414 ret_constr.data[s] = ret_conv_18_conv;
8416 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8417 if (get_jenv_res == JNI_EDETACHED) {
8418 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8422 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8423 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8425 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8426 if (get_jenv_res == JNI_EDETACHED) {
8427 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8429 DO_ASSERT(get_jenv_res == JNI_OK);
8431 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8432 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8433 LDKInit init_var = *init;
8434 init_var = Init_clone(init);
8435 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8436 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8437 uint64_t init_ref = (uint64_t)init_var.inner;
8438 if (init_var.is_owned) {
8441 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8443 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
8444 if ((*env)->ExceptionCheck(env)) {
8445 (*env)->ExceptionDescribe(env);
8446 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
8448 if (get_jenv_res == JNI_EDETACHED) {
8449 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8452 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8453 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8455 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8456 if (get_jenv_res == JNI_EDETACHED) {
8457 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8459 DO_ASSERT(get_jenv_res == JNI_OK);
8461 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8462 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8463 LDKReplyChannelRange msg_var = msg;
8464 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8465 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8466 uint64_t msg_ref = (uint64_t)msg_var.inner;
8467 if (msg_var.is_owned) {
8470 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8472 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8473 if ((*env)->ExceptionCheck(env)) {
8474 (*env)->ExceptionDescribe(env);
8475 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8477 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8478 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8479 if (get_jenv_res == JNI_EDETACHED) {
8480 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8484 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8485 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8487 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8488 if (get_jenv_res == JNI_EDETACHED) {
8489 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8491 DO_ASSERT(get_jenv_res == JNI_OK);
8493 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8494 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8495 LDKReplyShortChannelIdsEnd msg_var = msg;
8496 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8497 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8498 uint64_t msg_ref = (uint64_t)msg_var.inner;
8499 if (msg_var.is_owned) {
8502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8504 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8505 if ((*env)->ExceptionCheck(env)) {
8506 (*env)->ExceptionDescribe(env);
8507 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
8509 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8510 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8511 if (get_jenv_res == JNI_EDETACHED) {
8512 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8516 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8517 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8519 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8520 if (get_jenv_res == JNI_EDETACHED) {
8521 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8523 DO_ASSERT(get_jenv_res == JNI_OK);
8525 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8526 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8527 LDKQueryChannelRange msg_var = msg;
8528 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8529 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8530 uint64_t msg_ref = (uint64_t)msg_var.inner;
8531 if (msg_var.is_owned) {
8534 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8536 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8537 if ((*env)->ExceptionCheck(env)) {
8538 (*env)->ExceptionDescribe(env);
8539 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8541 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8542 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8543 if (get_jenv_res == JNI_EDETACHED) {
8544 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8548 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8549 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8551 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8552 if (get_jenv_res == JNI_EDETACHED) {
8553 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8555 DO_ASSERT(get_jenv_res == JNI_OK);
8557 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8558 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8559 LDKQueryShortChannelIds msg_var = msg;
8560 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8561 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8562 uint64_t msg_ref = (uint64_t)msg_var.inner;
8563 if (msg_var.is_owned) {
8566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8568 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8569 if ((*env)->ExceptionCheck(env)) {
8570 (*env)->ExceptionDescribe(env);
8571 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
8573 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8574 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8575 if (get_jenv_res == JNI_EDETACHED) {
8576 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8580 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
8581 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
8582 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8583 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8585 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8586 jclass c = (*env)->GetObjectClass(env, o);
8588 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8589 atomic_init(&calls->refcnt, 1);
8590 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8591 calls->o = (*env)->NewWeakGlobalRef(env, o);
8592 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8593 CHECK(calls->handle_node_announcement_meth != NULL);
8594 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8595 CHECK(calls->handle_channel_announcement_meth != NULL);
8596 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8597 CHECK(calls->handle_channel_update_meth != NULL);
8598 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8599 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8600 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8601 CHECK(calls->get_next_channel_announcements_meth != NULL);
8602 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8603 CHECK(calls->get_next_node_announcements_meth != NULL);
8604 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8605 CHECK(calls->sync_routing_table_meth != NULL);
8606 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8607 CHECK(calls->handle_reply_channel_range_meth != NULL);
8608 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8609 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8610 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8611 CHECK(calls->handle_query_channel_range_meth != NULL);
8612 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8613 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8615 LDKRoutingMessageHandler ret = {
8616 .this_arg = (void*) calls,
8617 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8618 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8619 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8620 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8621 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8622 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8623 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8624 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8625 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8626 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8627 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8628 .free = LDKRoutingMessageHandler_JCalls_free,
8629 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8631 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8635 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8636 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8637 return (uint64_t)res_ptr;
8639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8640 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
8641 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8642 DO_ASSERT((res_ptr & 1) == 0);
8643 return (int64_t)(res_ptr | 1);
8645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8646 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8647 LDKNodeAnnouncement msg_conv;
8648 msg_conv.inner = (void*)(msg & (~1));
8649 msg_conv.is_owned = false;
8650 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8651 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8652 return (uint64_t)ret_conv;
8655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8656 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8657 LDKChannelAnnouncement msg_conv;
8658 msg_conv.inner = (void*)(msg & (~1));
8659 msg_conv.is_owned = false;
8660 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8661 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8662 return (uint64_t)ret_conv;
8665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8666 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8667 LDKChannelUpdate msg_conv;
8668 msg_conv.inner = (void*)(msg & (~1));
8669 msg_conv.is_owned = false;
8670 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8671 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8672 return (uint64_t)ret_conv;
8675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
8676 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8677 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8678 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8681 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) {
8682 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8683 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8684 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8685 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8686 for (size_t l = 0; l < ret_var.datalen; l++) {
8687 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8688 *ret_conv_63_ref = ret_var.data[l];
8689 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8691 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8696 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) {
8697 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8698 LDKPublicKey starting_point_ref;
8699 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8700 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8701 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8702 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8703 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8704 for (size_t s = 0; s < ret_var.datalen; s++) {
8705 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8706 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8707 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8708 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8709 if (ret_conv_18_var.is_owned) {
8710 ret_conv_18_ref |= 1;
8712 ret_arr_ptr[s] = ret_conv_18_ref;
8714 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8719 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) {
8720 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8721 LDKPublicKey their_node_id_ref;
8722 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8723 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8725 init_conv.inner = (void*)(init & (~1));
8726 init_conv.is_owned = false;
8727 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8730 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) {
8731 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8732 LDKPublicKey their_node_id_ref;
8733 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8734 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8735 LDKReplyChannelRange msg_conv;
8736 msg_conv.inner = (void*)(msg & (~1));
8737 msg_conv.is_owned = (msg & 1) || (msg == 0);
8738 msg_conv = ReplyChannelRange_clone(&msg_conv);
8739 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8740 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8741 return (uint64_t)ret_conv;
8744 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) {
8745 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8746 LDKPublicKey their_node_id_ref;
8747 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8748 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8749 LDKReplyShortChannelIdsEnd msg_conv;
8750 msg_conv.inner = (void*)(msg & (~1));
8751 msg_conv.is_owned = (msg & 1) || (msg == 0);
8752 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8753 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8754 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8755 return (uint64_t)ret_conv;
8758 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) {
8759 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8760 LDKPublicKey their_node_id_ref;
8761 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8762 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8763 LDKQueryChannelRange msg_conv;
8764 msg_conv.inner = (void*)(msg & (~1));
8765 msg_conv.is_owned = (msg & 1) || (msg == 0);
8766 msg_conv = QueryChannelRange_clone(&msg_conv);
8767 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8768 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8769 return (uint64_t)ret_conv;
8772 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) {
8773 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8774 LDKPublicKey their_node_id_ref;
8775 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8776 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8777 LDKQueryShortChannelIds msg_conv;
8778 msg_conv.inner = (void*)(msg & (~1));
8779 msg_conv.is_owned = (msg & 1) || (msg == 0);
8780 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8781 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8782 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8783 return (uint64_t)ret_conv;
8786 typedef struct LDKSocketDescriptor_JCalls {
8787 atomic_size_t refcnt;
8790 jmethodID send_data_meth;
8791 jmethodID disconnect_socket_meth;
8793 jmethodID hash_meth;
8794 } LDKSocketDescriptor_JCalls;
8795 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8796 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8797 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8799 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8800 if (get_jenv_res == JNI_EDETACHED) {
8801 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8803 DO_ASSERT(get_jenv_res == JNI_OK);
8805 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8806 if (get_jenv_res == JNI_EDETACHED) {
8807 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8812 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8813 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8815 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8816 if (get_jenv_res == JNI_EDETACHED) {
8817 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8819 DO_ASSERT(get_jenv_res == JNI_OK);
8821 LDKu8slice data_var = data;
8822 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8823 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8824 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8826 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8827 if ((*env)->ExceptionCheck(env)) {
8828 (*env)->ExceptionDescribe(env);
8829 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
8831 if (get_jenv_res == JNI_EDETACHED) {
8832 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8836 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8837 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8839 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8840 if (get_jenv_res == JNI_EDETACHED) {
8841 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8843 DO_ASSERT(get_jenv_res == JNI_OK);
8845 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8847 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8848 if ((*env)->ExceptionCheck(env)) {
8849 (*env)->ExceptionDescribe(env);
8850 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
8852 if (get_jenv_res == JNI_EDETACHED) {
8853 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8856 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8857 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8859 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8860 if (get_jenv_res == JNI_EDETACHED) {
8861 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8863 DO_ASSERT(get_jenv_res == JNI_OK);
8865 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8866 *other_arg_clone = SocketDescriptor_clone(other_arg);
8867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8869 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8870 if ((*env)->ExceptionCheck(env)) {
8871 (*env)->ExceptionDescribe(env);
8872 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
8874 if (get_jenv_res == JNI_EDETACHED) {
8875 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8879 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8880 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8882 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8883 if (get_jenv_res == JNI_EDETACHED) {
8884 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8886 DO_ASSERT(get_jenv_res == JNI_OK);
8888 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8890 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8891 if ((*env)->ExceptionCheck(env)) {
8892 (*env)->ExceptionDescribe(env);
8893 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
8895 if (get_jenv_res == JNI_EDETACHED) {
8896 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8900 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8901 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8902 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8904 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8905 jclass c = (*env)->GetObjectClass(env, o);
8907 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8908 atomic_init(&calls->refcnt, 1);
8909 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8910 calls->o = (*env)->NewWeakGlobalRef(env, o);
8911 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8912 CHECK(calls->send_data_meth != NULL);
8913 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8914 CHECK(calls->disconnect_socket_meth != NULL);
8915 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8916 CHECK(calls->eq_meth != NULL);
8917 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8918 CHECK(calls->hash_meth != NULL);
8920 LDKSocketDescriptor ret = {
8921 .this_arg = (void*) calls,
8922 .send_data = send_data_LDKSocketDescriptor_jcall,
8923 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8924 .eq = eq_LDKSocketDescriptor_jcall,
8925 .hash = hash_LDKSocketDescriptor_jcall,
8926 .cloned = LDKSocketDescriptor_JCalls_cloned,
8927 .free = LDKSocketDescriptor_JCalls_free,
8931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8932 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8933 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8934 return (uint64_t)res_ptr;
8936 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) {
8937 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8938 LDKu8slice data_ref;
8939 data_ref.datalen = (*env)->GetArrayLength(env, data);
8940 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8941 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8942 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8947 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8948 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8952 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8953 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8957 typedef struct LDKChannelManagerPersister_JCalls {
8958 atomic_size_t refcnt;
8961 jmethodID persist_manager_meth;
8962 } LDKChannelManagerPersister_JCalls;
8963 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8964 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8965 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8967 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8968 if (get_jenv_res == JNI_EDETACHED) {
8969 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8971 DO_ASSERT(get_jenv_res == JNI_OK);
8973 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8974 if (get_jenv_res == JNI_EDETACHED) {
8975 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8980 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8981 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8983 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8984 if (get_jenv_res == JNI_EDETACHED) {
8985 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8987 DO_ASSERT(get_jenv_res == JNI_OK);
8989 LDKChannelManager channel_manager_var = *channel_manager;
8990 // Warning: we may need a move here but no clone is available for LDKChannelManager
8991 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8992 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8993 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8994 if (channel_manager_var.is_owned) {
8995 channel_manager_ref |= 1;
8997 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8999 uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
9000 if ((*env)->ExceptionCheck(env)) {
9001 (*env)->ExceptionDescribe(env);
9002 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
9004 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
9005 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
9006 if (get_jenv_res == JNI_EDETACHED) {
9007 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9011 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
9012 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
9013 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9015 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
9016 jclass c = (*env)->GetObjectClass(env, o);
9018 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
9019 atomic_init(&calls->refcnt, 1);
9020 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9021 calls->o = (*env)->NewWeakGlobalRef(env, o);
9022 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
9023 CHECK(calls->persist_manager_meth != NULL);
9025 LDKChannelManagerPersister ret = {
9026 .this_arg = (void*) calls,
9027 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
9028 .free = LDKChannelManagerPersister_JCalls_free,
9032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
9033 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
9034 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
9035 return (uint64_t)res_ptr;
9037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
9038 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
9039 LDKChannelManager channel_manager_conv;
9040 channel_manager_conv.inner = (void*)(channel_manager & (~1));
9041 channel_manager_conv.is_owned = false;
9042 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9043 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9044 return (uint64_t)ret_conv;
9047 static jclass LDKFallback_SegWitProgram_class = NULL;
9048 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
9049 static jclass LDKFallback_PubKeyHash_class = NULL;
9050 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
9051 static jclass LDKFallback_ScriptHash_class = NULL;
9052 static jmethodID LDKFallback_ScriptHash_meth = NULL;
9053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
9054 LDKFallback_SegWitProgram_class =
9055 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
9056 CHECK(LDKFallback_SegWitProgram_class != NULL);
9057 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
9058 CHECK(LDKFallback_SegWitProgram_meth != NULL);
9059 LDKFallback_PubKeyHash_class =
9060 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
9061 CHECK(LDKFallback_PubKeyHash_class != NULL);
9062 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
9063 CHECK(LDKFallback_PubKeyHash_meth != NULL);
9064 LDKFallback_ScriptHash_class =
9065 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
9066 CHECK(LDKFallback_ScriptHash_class != NULL);
9067 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
9068 CHECK(LDKFallback_ScriptHash_meth != NULL);
9070 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9071 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9073 case LDKFallback_SegWitProgram: {
9074 uint8_t version_val = obj->seg_wit_program.version._0;
9075 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9076 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
9077 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
9078 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
9080 case LDKFallback_PubKeyHash: {
9081 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
9082 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
9083 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
9085 case LDKFallback_ScriptHash: {
9086 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
9087 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
9088 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
9093 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9094 LDKStr ret_str = _ldk_get_compiled_version();
9095 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9100 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9101 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
9102 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9108 LDKTransaction _res_ref;
9109 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9110 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
9111 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9112 _res_ref.data_is_owned = true;
9113 Transaction_free(_res_ref);
9116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
9117 LDKCVec_u8Z script_pubkey_ref;
9118 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
9119 script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
9120 (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
9121 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9122 *ret_ref = TxOut_new(script_pubkey_ref, value);
9123 return (uint64_t)ret_ref;
9126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
9127 if ((_res & 1) != 0) return;
9128 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
9130 TxOut_free(_res_conv);
9133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9134 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
9135 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9136 *ret_ref = TxOut_clone(orig_conv);
9137 return (uint64_t)ret_ref;
9140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
9141 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
9145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9147 CHECK((*env)->GetArrayLength(env, o) == 32);
9148 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
9149 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9150 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
9151 return (uint64_t)ret_conv;
9154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9155 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9156 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9157 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
9158 return (uint64_t)ret_conv;
9161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9162 if ((_res & 1) != 0) return;
9163 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
9165 CResult_SecretKeyErrorZ_free(_res_conv);
9168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9170 CHECK((*env)->GetArrayLength(env, o) == 33);
9171 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
9172 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9173 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
9174 return (uint64_t)ret_conv;
9177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9178 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9179 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9180 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
9181 return (uint64_t)ret_conv;
9184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9185 if ((_res & 1) != 0) return;
9186 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
9188 CResult_PublicKeyErrorZ_free(_res_conv);
9191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9192 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
9193 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9194 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
9195 return (uint64_t)ret_conv;
9198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9199 LDKTxCreationKeys o_conv;
9200 o_conv.inner = (void*)(o & (~1));
9201 o_conv.is_owned = (o & 1) || (o == 0);
9202 o_conv = TxCreationKeys_clone(&o_conv);
9203 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9204 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
9205 return (uint64_t)ret_conv;
9208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9209 LDKDecodeError e_conv;
9210 e_conv.inner = (void*)(e & (~1));
9211 e_conv.is_owned = (e & 1) || (e == 0);
9212 e_conv = DecodeError_clone(&e_conv);
9213 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9214 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9215 return (uint64_t)ret_conv;
9218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9219 if ((_res & 1) != 0) return;
9220 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9222 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9226 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9227 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9228 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9229 return (uint64_t)ret_conv;
9232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9233 LDKChannelPublicKeys o_conv;
9234 o_conv.inner = (void*)(o & (~1));
9235 o_conv.is_owned = (o & 1) || (o == 0);
9236 o_conv = ChannelPublicKeys_clone(&o_conv);
9237 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9238 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9239 return (uint64_t)ret_conv;
9242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9243 LDKDecodeError e_conv;
9244 e_conv.inner = (void*)(e & (~1));
9245 e_conv.is_owned = (e & 1) || (e == 0);
9246 e_conv = DecodeError_clone(&e_conv);
9247 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9248 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9249 return (uint64_t)ret_conv;
9252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9253 if ((_res & 1) != 0) return;
9254 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9256 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9260 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9261 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9262 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9263 return (uint64_t)ret_conv;
9266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9267 LDKTxCreationKeys o_conv;
9268 o_conv.inner = (void*)(o & (~1));
9269 o_conv.is_owned = (o & 1) || (o == 0);
9270 o_conv = TxCreationKeys_clone(&o_conv);
9271 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9272 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9273 return (uint64_t)ret_conv;
9276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9277 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9278 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9279 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9280 return (uint64_t)ret_conv;
9283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9284 if ((_res & 1) != 0) return;
9285 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
9287 CResult_TxCreationKeysErrorZ_free(_res_conv);
9290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9291 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9292 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9293 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9294 return (uint64_t)ret_conv;
9297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
9298 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9299 *ret_copy = COption_u32Z_some(o);
9300 uint64_t ret_ref = (uint64_t)ret_copy;
9304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
9305 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9306 *ret_copy = COption_u32Z_none();
9307 uint64_t ret_ref = (uint64_t)ret_copy;
9311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9312 if ((_res & 1) != 0) return;
9313 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
9315 COption_u32Z_free(_res_conv);
9318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9319 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9320 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9321 *ret_copy = COption_u32Z_clone(orig_conv);
9322 uint64_t ret_ref = (uint64_t)ret_copy;
9326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9327 LDKHTLCOutputInCommitment o_conv;
9328 o_conv.inner = (void*)(o & (~1));
9329 o_conv.is_owned = (o & 1) || (o == 0);
9330 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9331 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9332 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9333 return (uint64_t)ret_conv;
9336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9337 LDKDecodeError e_conv;
9338 e_conv.inner = (void*)(e & (~1));
9339 e_conv.is_owned = (e & 1) || (e == 0);
9340 e_conv = DecodeError_clone(&e_conv);
9341 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9342 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9343 return (uint64_t)ret_conv;
9346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9347 if ((_res & 1) != 0) return;
9348 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
9350 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9354 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9355 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9356 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9357 return (uint64_t)ret_conv;
9360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9361 LDKCounterpartyChannelTransactionParameters o_conv;
9362 o_conv.inner = (void*)(o & (~1));
9363 o_conv.is_owned = (o & 1) || (o == 0);
9364 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9365 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9366 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9367 return (uint64_t)ret_conv;
9370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9371 LDKDecodeError e_conv;
9372 e_conv.inner = (void*)(e & (~1));
9373 e_conv.is_owned = (e & 1) || (e == 0);
9374 e_conv = DecodeError_clone(&e_conv);
9375 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9376 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9377 return (uint64_t)ret_conv;
9380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9381 if ((_res & 1) != 0) return;
9382 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9384 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9388 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9389 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9390 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9391 return (uint64_t)ret_conv;
9394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9395 LDKChannelTransactionParameters o_conv;
9396 o_conv.inner = (void*)(o & (~1));
9397 o_conv.is_owned = (o & 1) || (o == 0);
9398 o_conv = ChannelTransactionParameters_clone(&o_conv);
9399 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9400 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9401 return (uint64_t)ret_conv;
9404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9405 LDKDecodeError e_conv;
9406 e_conv.inner = (void*)(e & (~1));
9407 e_conv.is_owned = (e & 1) || (e == 0);
9408 e_conv = DecodeError_clone(&e_conv);
9409 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9410 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9411 return (uint64_t)ret_conv;
9414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9415 if ((_res & 1) != 0) return;
9416 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9418 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9422 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9423 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9424 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9425 return (uint64_t)ret_conv;
9428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9429 LDKCVec_SignatureZ _res_constr;
9430 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9431 if (_res_constr.datalen > 0)
9432 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9434 _res_constr.data = NULL;
9435 for (size_t i = 0; i < _res_constr.datalen; i++) {
9436 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9437 LDKSignature _res_conv_8_ref;
9438 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
9439 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
9440 _res_constr.data[i] = _res_conv_8_ref;
9442 CVec_SignatureZ_free(_res_constr);
9445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9446 LDKHolderCommitmentTransaction o_conv;
9447 o_conv.inner = (void*)(o & (~1));
9448 o_conv.is_owned = (o & 1) || (o == 0);
9449 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9450 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9451 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9452 return (uint64_t)ret_conv;
9455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9456 LDKDecodeError e_conv;
9457 e_conv.inner = (void*)(e & (~1));
9458 e_conv.is_owned = (e & 1) || (e == 0);
9459 e_conv = DecodeError_clone(&e_conv);
9460 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9461 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9462 return (uint64_t)ret_conv;
9465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9466 if ((_res & 1) != 0) return;
9467 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9469 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9473 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9474 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9475 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9476 return (uint64_t)ret_conv;
9479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9480 LDKBuiltCommitmentTransaction o_conv;
9481 o_conv.inner = (void*)(o & (~1));
9482 o_conv.is_owned = (o & 1) || (o == 0);
9483 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9484 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9485 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9486 return (uint64_t)ret_conv;
9489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9490 LDKDecodeError e_conv;
9491 e_conv.inner = (void*)(e & (~1));
9492 e_conv.is_owned = (e & 1) || (e == 0);
9493 e_conv = DecodeError_clone(&e_conv);
9494 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9495 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9496 return (uint64_t)ret_conv;
9499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9500 if ((_res & 1) != 0) return;
9501 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9503 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9507 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9508 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9509 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9510 return (uint64_t)ret_conv;
9513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9514 LDKCommitmentTransaction o_conv;
9515 o_conv.inner = (void*)(o & (~1));
9516 o_conv.is_owned = (o & 1) || (o == 0);
9517 o_conv = CommitmentTransaction_clone(&o_conv);
9518 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9519 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9520 return (uint64_t)ret_conv;
9523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9524 LDKDecodeError e_conv;
9525 e_conv.inner = (void*)(e & (~1));
9526 e_conv.is_owned = (e & 1) || (e == 0);
9527 e_conv = DecodeError_clone(&e_conv);
9528 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9529 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9530 return (uint64_t)ret_conv;
9533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9534 if ((_res & 1) != 0) return;
9535 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9537 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9541 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9542 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9543 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9544 return (uint64_t)ret_conv;
9547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9548 LDKTrustedCommitmentTransaction o_conv;
9549 o_conv.inner = (void*)(o & (~1));
9550 o_conv.is_owned = (o & 1) || (o == 0);
9551 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9552 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9553 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9554 return (uint64_t)ret_conv;
9557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9558 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9559 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9560 return (uint64_t)ret_conv;
9563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9564 if ((_res & 1) != 0) return;
9565 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9567 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9571 LDKCVec_SignatureZ o_constr;
9572 o_constr.datalen = (*env)->GetArrayLength(env, o);
9573 if (o_constr.datalen > 0)
9574 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9576 o_constr.data = NULL;
9577 for (size_t i = 0; i < o_constr.datalen; i++) {
9578 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9579 LDKSignature o_conv_8_ref;
9580 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9581 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9582 o_constr.data[i] = o_conv_8_ref;
9584 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9585 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9586 return (uint64_t)ret_conv;
9589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9590 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9591 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9592 return (uint64_t)ret_conv;
9595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9596 if ((_res & 1) != 0) return;
9597 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9599 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9603 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9604 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9605 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9606 return (uint64_t)ret_conv;
9609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9610 LDKShutdownScript o_conv;
9611 o_conv.inner = (void*)(o & (~1));
9612 o_conv.is_owned = (o & 1) || (o == 0);
9613 o_conv = ShutdownScript_clone(&o_conv);
9614 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9615 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
9616 return (uint64_t)ret_conv;
9619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9620 LDKDecodeError e_conv;
9621 e_conv.inner = (void*)(e & (~1));
9622 e_conv.is_owned = (e & 1) || (e == 0);
9623 e_conv = DecodeError_clone(&e_conv);
9624 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9625 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
9626 return (uint64_t)ret_conv;
9629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9630 if ((_res & 1) != 0) return;
9631 LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
9633 CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
9636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9637 LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
9638 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
9639 *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
9640 return (uint64_t)ret_conv;
9643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9644 LDKShutdownScript o_conv;
9645 o_conv.inner = (void*)(o & (~1));
9646 o_conv.is_owned = (o & 1) || (o == 0);
9647 o_conv = ShutdownScript_clone(&o_conv);
9648 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9649 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
9650 return (uint64_t)ret_conv;
9653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9654 LDKInvalidShutdownScript e_conv;
9655 e_conv.inner = (void*)(e & (~1));
9656 e_conv.is_owned = (e & 1) || (e == 0);
9657 // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
9658 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
9659 *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
9660 return (uint64_t)ret_conv;
9663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9664 if ((_res & 1) != 0) return;
9665 LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
9667 CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
9670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9671 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9672 *ret_conv = CResult_NoneErrorZ_ok();
9673 return (uint64_t)ret_conv;
9676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9677 LDKIOError e_conv = LDKIOError_from_java(env, e);
9678 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9679 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9680 return (uint64_t)ret_conv;
9683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9684 if ((_res & 1) != 0) return;
9685 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9687 CResult_NoneErrorZ_free(_res_conv);
9690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9691 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9692 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9693 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9694 return (uint64_t)ret_conv;
9697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9699 o_conv.inner = (void*)(o & (~1));
9700 o_conv.is_owned = (o & 1) || (o == 0);
9701 o_conv = RouteHop_clone(&o_conv);
9702 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9703 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9704 return (uint64_t)ret_conv;
9707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9708 LDKDecodeError e_conv;
9709 e_conv.inner = (void*)(e & (~1));
9710 e_conv.is_owned = (e & 1) || (e == 0);
9711 e_conv = DecodeError_clone(&e_conv);
9712 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9713 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9714 return (uint64_t)ret_conv;
9717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9718 if ((_res & 1) != 0) return;
9719 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9721 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9725 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9726 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9727 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9728 return (uint64_t)ret_conv;
9731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9732 LDKCVec_RouteHopZ _res_constr;
9733 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9734 if (_res_constr.datalen > 0)
9735 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9737 _res_constr.data = NULL;
9738 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9739 for (size_t k = 0; k < _res_constr.datalen; k++) {
9740 int64_t _res_conv_10 = _res_vals[k];
9741 LDKRouteHop _res_conv_10_conv;
9742 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9743 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9744 _res_constr.data[k] = _res_conv_10_conv;
9746 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9747 CVec_RouteHopZ_free(_res_constr);
9750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9751 LDKCVec_CVec_RouteHopZZ _res_constr;
9752 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9753 if (_res_constr.datalen > 0)
9754 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9756 _res_constr.data = NULL;
9757 for (size_t m = 0; m < _res_constr.datalen; m++) {
9758 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9759 LDKCVec_RouteHopZ _res_conv_12_constr;
9760 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9761 if (_res_conv_12_constr.datalen > 0)
9762 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9764 _res_conv_12_constr.data = NULL;
9765 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9766 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9767 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9768 LDKRouteHop _res_conv_12_conv_10_conv;
9769 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9770 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9771 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9773 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9774 _res_constr.data[m] = _res_conv_12_constr;
9776 CVec_CVec_RouteHopZZ_free(_res_constr);
9779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9781 o_conv.inner = (void*)(o & (~1));
9782 o_conv.is_owned = (o & 1) || (o == 0);
9783 o_conv = Route_clone(&o_conv);
9784 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9785 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9786 return (uint64_t)ret_conv;
9789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9790 LDKDecodeError e_conv;
9791 e_conv.inner = (void*)(e & (~1));
9792 e_conv.is_owned = (e & 1) || (e == 0);
9793 e_conv = DecodeError_clone(&e_conv);
9794 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9795 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9796 return (uint64_t)ret_conv;
9799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9800 if ((_res & 1) != 0) return;
9801 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9803 CResult_RouteDecodeErrorZ_free(_res_conv);
9806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9807 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9808 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9809 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9810 return (uint64_t)ret_conv;
9813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9814 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9815 *ret_copy = COption_u64Z_some(o);
9816 uint64_t ret_ref = (uint64_t)ret_copy;
9820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9821 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9822 *ret_copy = COption_u64Z_none();
9823 uint64_t ret_ref = (uint64_t)ret_copy;
9827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9828 if ((_res & 1) != 0) return;
9829 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9831 COption_u64Z_free(_res_conv);
9834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9835 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9836 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9837 *ret_copy = COption_u64Z_clone(orig_conv);
9838 uint64_t ret_ref = (uint64_t)ret_copy;
9842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9843 LDKCVec_ChannelDetailsZ _res_constr;
9844 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9845 if (_res_constr.datalen > 0)
9846 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9848 _res_constr.data = NULL;
9849 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9850 for (size_t q = 0; q < _res_constr.datalen; q++) {
9851 int64_t _res_conv_16 = _res_vals[q];
9852 LDKChannelDetails _res_conv_16_conv;
9853 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9854 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9855 _res_constr.data[q] = _res_conv_16_conv;
9857 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9858 CVec_ChannelDetailsZ_free(_res_constr);
9861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9862 LDKCVec_RouteHintZ _res_constr;
9863 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9864 if (_res_constr.datalen > 0)
9865 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9867 _res_constr.data = NULL;
9868 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9869 for (size_t l = 0; l < _res_constr.datalen; l++) {
9870 int64_t _res_conv_11 = _res_vals[l];
9871 LDKRouteHint _res_conv_11_conv;
9872 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9873 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9874 _res_constr.data[l] = _res_conv_11_conv;
9876 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9877 CVec_RouteHintZ_free(_res_constr);
9880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9882 o_conv.inner = (void*)(o & (~1));
9883 o_conv.is_owned = (o & 1) || (o == 0);
9884 o_conv = Route_clone(&o_conv);
9885 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9886 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9887 return (uint64_t)ret_conv;
9890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9891 LDKLightningError e_conv;
9892 e_conv.inner = (void*)(e & (~1));
9893 e_conv.is_owned = (e & 1) || (e == 0);
9894 e_conv = LightningError_clone(&e_conv);
9895 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9896 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9897 return (uint64_t)ret_conv;
9900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9901 if ((_res & 1) != 0) return;
9902 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9904 CResult_RouteLightningErrorZ_free(_res_conv);
9907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9908 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9909 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9910 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9911 return (uint64_t)ret_conv;
9914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9915 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9916 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9917 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9918 return (uint64_t)ret_conv;
9921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9922 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9923 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9924 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9925 return (uint64_t)ret_conv;
9928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9929 if ((_res & 1) != 0) return;
9930 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9932 CResult_TxOutAccessErrorZ_free(_res_conv);
9935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9936 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9937 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9938 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9939 return (uint64_t)ret_conv;
9942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9943 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9944 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9945 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9946 return (uint64_t)ret_ref;
9949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9950 LDKTransaction b_ref;
9951 b_ref.datalen = (*env)->GetArrayLength(env, b);
9952 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9953 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9954 b_ref.data_is_owned = true;
9955 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9956 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9957 return (uint64_t)ret_ref;
9960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9961 if ((_res & 1) != 0) return;
9962 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9964 C2Tuple_usizeTransactionZ_free(_res_conv);
9967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9968 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9969 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9970 if (_res_constr.datalen > 0)
9971 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9973 _res_constr.data = NULL;
9974 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9975 for (size_t y = 0; y < _res_constr.datalen; y++) {
9976 int64_t _res_conv_24 = _res_vals[y];
9977 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9978 FREE((void*)_res_conv_24);
9979 _res_constr.data[y] = _res_conv_24_conv;
9981 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9982 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9986 LDKCVec_TxidZ _res_constr;
9987 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9988 if (_res_constr.datalen > 0)
9989 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9991 _res_constr.data = NULL;
9992 for (size_t i = 0; i < _res_constr.datalen; i++) {
9993 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9994 LDKThirtyTwoBytes _res_conv_8_ref;
9995 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9996 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9997 _res_constr.data[i] = _res_conv_8_ref;
9999 CVec_TxidZ_free(_res_constr);
10002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
10003 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10004 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
10005 return (uint64_t)ret_conv;
10008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
10009 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
10010 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10011 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
10012 return (uint64_t)ret_conv;
10015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10016 if ((_res & 1) != 0) return;
10017 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
10019 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
10022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10023 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
10024 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
10025 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
10026 return (uint64_t)ret_conv;
10029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10030 LDKCVec_MonitorEventZ _res_constr;
10031 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10032 if (_res_constr.datalen > 0)
10033 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
10035 _res_constr.data = NULL;
10036 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10037 for (size_t o = 0; o < _res_constr.datalen; o++) {
10038 int64_t _res_conv_14 = _res_vals[o];
10039 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
10040 FREE((void*)_res_conv_14);
10041 _res_constr.data[o] = _res_conv_14_conv;
10043 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10044 CVec_MonitorEventZ_free(_res_constr);
10047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
10048 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
10049 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10050 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
10051 uint64_t ret_ref = (uint64_t)ret_copy;
10055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
10056 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10057 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
10058 uint64_t ret_ref = (uint64_t)ret_copy;
10062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10063 if ((_res & 1) != 0) return;
10064 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
10066 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
10069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10070 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
10071 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10072 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
10073 uint64_t ret_ref = (uint64_t)ret_copy;
10077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10078 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10079 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10080 if (_res_constr.datalen > 0)
10081 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10083 _res_constr.data = NULL;
10084 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10085 for (size_t b = 0; b < _res_constr.datalen; b++) {
10086 int64_t _res_conv_27 = _res_vals[b];
10087 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
10088 FREE((void*)_res_conv_27);
10089 _res_constr.data[b] = _res_conv_27_conv;
10091 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10092 CVec_SpendableOutputDescriptorZ_free(_res_constr);
10095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10096 LDKCVec_MessageSendEventZ _res_constr;
10097 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10098 if (_res_constr.datalen > 0)
10099 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10101 _res_constr.data = NULL;
10102 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10103 for (size_t s = 0; s < _res_constr.datalen; s++) {
10104 int64_t _res_conv_18 = _res_vals[s];
10105 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
10106 FREE((void*)_res_conv_18);
10107 _res_constr.data[s] = _res_conv_18_conv;
10109 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10110 CVec_MessageSendEventZ_free(_res_constr);
10113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10114 LDKInitFeatures o_conv;
10115 o_conv.inner = (void*)(o & (~1));
10116 o_conv.is_owned = (o & 1) || (o == 0);
10117 o_conv = InitFeatures_clone(&o_conv);
10118 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10119 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
10120 return (uint64_t)ret_conv;
10123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10124 LDKDecodeError e_conv;
10125 e_conv.inner = (void*)(e & (~1));
10126 e_conv.is_owned = (e & 1) || (e == 0);
10127 e_conv = DecodeError_clone(&e_conv);
10128 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10129 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
10130 return (uint64_t)ret_conv;
10133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10134 if ((_res & 1) != 0) return;
10135 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10137 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
10140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10141 LDKNodeFeatures o_conv;
10142 o_conv.inner = (void*)(o & (~1));
10143 o_conv.is_owned = (o & 1) || (o == 0);
10144 o_conv = NodeFeatures_clone(&o_conv);
10145 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10146 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
10147 return (uint64_t)ret_conv;
10150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10151 LDKDecodeError e_conv;
10152 e_conv.inner = (void*)(e & (~1));
10153 e_conv.is_owned = (e & 1) || (e == 0);
10154 e_conv = DecodeError_clone(&e_conv);
10155 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10156 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
10157 return (uint64_t)ret_conv;
10160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10161 if ((_res & 1) != 0) return;
10162 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10164 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
10167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10168 LDKChannelFeatures o_conv;
10169 o_conv.inner = (void*)(o & (~1));
10170 o_conv.is_owned = (o & 1) || (o == 0);
10171 o_conv = ChannelFeatures_clone(&o_conv);
10172 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10173 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
10174 return (uint64_t)ret_conv;
10177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10178 LDKDecodeError e_conv;
10179 e_conv.inner = (void*)(e & (~1));
10180 e_conv.is_owned = (e & 1) || (e == 0);
10181 e_conv = DecodeError_clone(&e_conv);
10182 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10183 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
10184 return (uint64_t)ret_conv;
10187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10188 if ((_res & 1) != 0) return;
10189 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10191 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10195 LDKInvoiceFeatures o_conv;
10196 o_conv.inner = (void*)(o & (~1));
10197 o_conv.is_owned = (o & 1) || (o == 0);
10198 o_conv = InvoiceFeatures_clone(&o_conv);
10199 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10200 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10201 return (uint64_t)ret_conv;
10204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10205 LDKDecodeError e_conv;
10206 e_conv.inner = (void*)(e & (~1));
10207 e_conv.is_owned = (e & 1) || (e == 0);
10208 e_conv = DecodeError_clone(&e_conv);
10209 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10210 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10211 return (uint64_t)ret_conv;
10214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10215 if ((_res & 1) != 0) return;
10216 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10218 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10222 LDKDelayedPaymentOutputDescriptor o_conv;
10223 o_conv.inner = (void*)(o & (~1));
10224 o_conv.is_owned = (o & 1) || (o == 0);
10225 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10226 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10227 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10228 return (uint64_t)ret_conv;
10231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10232 LDKDecodeError e_conv;
10233 e_conv.inner = (void*)(e & (~1));
10234 e_conv.is_owned = (e & 1) || (e == 0);
10235 e_conv = DecodeError_clone(&e_conv);
10236 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10237 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10238 return (uint64_t)ret_conv;
10241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10242 if ((_res & 1) != 0) return;
10243 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10245 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10249 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10250 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10251 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10252 return (uint64_t)ret_conv;
10255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10256 LDKStaticPaymentOutputDescriptor o_conv;
10257 o_conv.inner = (void*)(o & (~1));
10258 o_conv.is_owned = (o & 1) || (o == 0);
10259 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10260 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10261 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10262 return (uint64_t)ret_conv;
10265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10266 LDKDecodeError e_conv;
10267 e_conv.inner = (void*)(e & (~1));
10268 e_conv.is_owned = (e & 1) || (e == 0);
10269 e_conv = DecodeError_clone(&e_conv);
10270 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10271 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10272 return (uint64_t)ret_conv;
10275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10276 if ((_res & 1) != 0) return;
10277 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10279 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10283 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10284 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10285 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10286 return (uint64_t)ret_conv;
10289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10290 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
10291 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10292 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10293 return (uint64_t)ret_conv;
10296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10297 LDKDecodeError e_conv;
10298 e_conv.inner = (void*)(e & (~1));
10299 e_conv.is_owned = (e & 1) || (e == 0);
10300 e_conv = DecodeError_clone(&e_conv);
10301 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10302 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10303 return (uint64_t)ret_conv;
10306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10307 if ((_res & 1) != 0) return;
10308 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10310 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10314 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10315 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10316 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10317 return (uint64_t)ret_conv;
10320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10321 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10322 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10323 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10324 return (uint64_t)ret_ref;
10327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
10328 LDKSignature a_ref;
10329 CHECK((*env)->GetArrayLength(env, a) == 64);
10330 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
10331 LDKCVec_SignatureZ b_constr;
10332 b_constr.datalen = (*env)->GetArrayLength(env, b);
10333 if (b_constr.datalen > 0)
10334 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10336 b_constr.data = NULL;
10337 for (size_t i = 0; i < b_constr.datalen; i++) {
10338 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
10339 LDKSignature b_conv_8_ref;
10340 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
10341 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
10342 b_constr.data[i] = b_conv_8_ref;
10344 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10345 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10346 return (uint64_t)ret_ref;
10349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10350 if ((_res & 1) != 0) return;
10351 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
10353 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10357 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
10358 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10359 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10360 return (uint64_t)ret_conv;
10363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
10364 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10365 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10366 return (uint64_t)ret_conv;
10369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10370 if ((_res & 1) != 0) return;
10371 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
10373 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10377 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10378 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10379 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10380 return (uint64_t)ret_conv;
10383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10384 LDKSignature o_ref;
10385 CHECK((*env)->GetArrayLength(env, o) == 64);
10386 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
10387 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10388 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10389 return (uint64_t)ret_conv;
10392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10393 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10394 *ret_conv = CResult_SignatureNoneZ_err();
10395 return (uint64_t)ret_conv;
10398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10399 if ((_res & 1) != 0) return;
10400 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
10402 CResult_SignatureNoneZ_free(_res_conv);
10405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10406 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10407 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10408 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10409 return (uint64_t)ret_conv;
10412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10413 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
10414 if (o_conv.free == LDKSign_JCalls_free) {
10415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10416 LDKSign_JCalls_cloned(&o_conv);
10418 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10419 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10420 return (uint64_t)ret_conv;
10423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10424 LDKDecodeError e_conv;
10425 e_conv.inner = (void*)(e & (~1));
10426 e_conv.is_owned = (e & 1) || (e == 0);
10427 e_conv = DecodeError_clone(&e_conv);
10428 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10429 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10430 return (uint64_t)ret_conv;
10433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10434 if ((_res & 1) != 0) return;
10435 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
10437 CResult_SignDecodeErrorZ_free(_res_conv);
10440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10441 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10442 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10443 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10444 return (uint64_t)ret_conv;
10447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10448 LDKCVec_u8Z _res_ref;
10449 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10450 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10451 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10452 CVec_u8Z_free(_res_ref);
10455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
10456 LDKRecoverableSignature arg_ref;
10457 CHECK((*env)->GetArrayLength(env, arg) == 68);
10458 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
10459 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10460 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10461 return (uint64_t)ret_conv;
10464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10465 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10466 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10467 return (uint64_t)ret_conv;
10470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10471 if ((_res & 1) != 0) return;
10472 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
10474 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10478 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10479 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10480 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10481 return (uint64_t)ret_conv;
10484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10485 LDKCVec_CVec_u8ZZ _res_constr;
10486 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10487 if (_res_constr.datalen > 0)
10488 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10490 _res_constr.data = NULL;
10491 for (size_t i = 0; i < _res_constr.datalen; i++) {
10492 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10493 LDKCVec_u8Z _res_conv_8_ref;
10494 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
10495 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10496 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
10497 _res_constr.data[i] = _res_conv_8_ref;
10499 CVec_CVec_u8ZZ_free(_res_constr);
10502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10503 LDKCVec_CVec_u8ZZ o_constr;
10504 o_constr.datalen = (*env)->GetArrayLength(env, o);
10505 if (o_constr.datalen > 0)
10506 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10508 o_constr.data = NULL;
10509 for (size_t i = 0; i < o_constr.datalen; i++) {
10510 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10511 LDKCVec_u8Z o_conv_8_ref;
10512 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
10513 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10514 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
10515 o_constr.data[i] = o_conv_8_ref;
10517 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10518 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10519 return (uint64_t)ret_conv;
10522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
10523 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10524 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10525 return (uint64_t)ret_conv;
10528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10529 if ((_res & 1) != 0) return;
10530 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
10532 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10536 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10537 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10538 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10539 return (uint64_t)ret_conv;
10542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10543 LDKInMemorySigner o_conv;
10544 o_conv.inner = (void*)(o & (~1));
10545 o_conv.is_owned = (o & 1) || (o == 0);
10546 o_conv = InMemorySigner_clone(&o_conv);
10547 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10548 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10549 return (uint64_t)ret_conv;
10552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10553 LDKDecodeError e_conv;
10554 e_conv.inner = (void*)(e & (~1));
10555 e_conv.is_owned = (e & 1) || (e == 0);
10556 e_conv = DecodeError_clone(&e_conv);
10557 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10558 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10559 return (uint64_t)ret_conv;
10562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10563 if ((_res & 1) != 0) return;
10564 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
10566 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10570 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10571 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10572 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10573 return (uint64_t)ret_conv;
10576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10577 LDKCVec_TxOutZ _res_constr;
10578 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10579 if (_res_constr.datalen > 0)
10580 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10582 _res_constr.data = NULL;
10583 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10584 for (size_t h = 0; h < _res_constr.datalen; h++) {
10585 int64_t _res_conv_7 = _res_vals[h];
10586 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10587 FREE((void*)_res_conv_7);
10588 _res_constr.data[h] = _res_conv_7_conv;
10590 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10591 CVec_TxOutZ_free(_res_constr);
10594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10595 LDKTransaction o_ref;
10596 o_ref.datalen = (*env)->GetArrayLength(env, o);
10597 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10598 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10599 o_ref.data_is_owned = true;
10600 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10601 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10602 return (uint64_t)ret_conv;
10605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10606 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10607 *ret_conv = CResult_TransactionNoneZ_err();
10608 return (uint64_t)ret_conv;
10611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10612 if ((_res & 1) != 0) return;
10613 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10615 CResult_TransactionNoneZ_free(_res_conv);
10618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10619 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10620 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10621 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10622 return (uint64_t)ret_conv;
10625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10626 LDKThirtyTwoBytes a_ref;
10627 CHECK((*env)->GetArrayLength(env, a) == 32);
10628 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10629 LDKChannelMonitor b_conv;
10630 b_conv.inner = (void*)(b & (~1));
10631 b_conv.is_owned = (b & 1) || (b == 0);
10632 b_conv = ChannelMonitor_clone(&b_conv);
10633 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10634 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10635 return (uint64_t)ret_ref;
10638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10639 if ((_res & 1) != 0) return;
10640 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10642 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10646 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10647 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10648 if (_res_constr.datalen > 0)
10649 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10651 _res_constr.data = NULL;
10652 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10653 for (size_t i = 0; i < _res_constr.datalen; i++) {
10654 int64_t _res_conv_34 = _res_vals[i];
10655 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10656 FREE((void*)_res_conv_34);
10657 _res_constr.data[i] = _res_conv_34_conv;
10659 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10660 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10664 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10665 o_constr.datalen = (*env)->GetArrayLength(env, o);
10666 if (o_constr.datalen > 0)
10667 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10669 o_constr.data = NULL;
10670 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10671 for (size_t i = 0; i < o_constr.datalen; i++) {
10672 int64_t o_conv_34 = o_vals[i];
10673 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10674 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10675 o_constr.data[i] = o_conv_34_conv;
10677 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10678 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10679 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10680 return (uint64_t)ret_conv;
10683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10684 LDKIOError e_conv = LDKIOError_from_java(env, e);
10685 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10686 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10687 return (uint64_t)ret_conv;
10690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10691 if ((_res & 1) != 0) return;
10692 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10694 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
10698 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10699 *ret_copy = COption_u16Z_some(o);
10700 uint64_t ret_ref = (uint64_t)ret_copy;
10704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
10705 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10706 *ret_copy = COption_u16Z_none();
10707 uint64_t ret_ref = (uint64_t)ret_copy;
10711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10712 if ((_res & 1) != 0) return;
10713 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
10715 COption_u16Z_free(_res_conv);
10718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10719 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10720 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10721 *ret_copy = COption_u16Z_clone(orig_conv);
10722 uint64_t ret_ref = (uint64_t)ret_copy;
10726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10727 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10728 *ret_conv = CResult_NoneAPIErrorZ_ok();
10729 return (uint64_t)ret_conv;
10732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10733 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10734 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10735 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10736 return (uint64_t)ret_conv;
10739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10740 if ((_res & 1) != 0) return;
10741 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10743 CResult_NoneAPIErrorZ_free(_res_conv);
10746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10747 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10748 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10749 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10750 return (uint64_t)ret_conv;
10753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10754 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10755 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10756 if (_res_constr.datalen > 0)
10757 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10759 _res_constr.data = NULL;
10760 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10761 for (size_t w = 0; w < _res_constr.datalen; w++) {
10762 int64_t _res_conv_22 = _res_vals[w];
10763 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10764 FREE((void*)_res_conv_22);
10765 _res_constr.data[w] = _res_conv_22_conv;
10767 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10768 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10772 LDKCVec_APIErrorZ _res_constr;
10773 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10774 if (_res_constr.datalen > 0)
10775 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10777 _res_constr.data = NULL;
10778 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10779 for (size_t k = 0; k < _res_constr.datalen; k++) {
10780 int64_t _res_conv_10 = _res_vals[k];
10781 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10782 FREE((void*)_res_conv_10);
10783 _res_constr.data[k] = _res_conv_10_conv;
10785 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10786 CVec_APIErrorZ_free(_res_constr);
10789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10790 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10791 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10792 return (uint64_t)ret_conv;
10795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10796 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10797 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10798 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10799 return (uint64_t)ret_conv;
10802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10803 if ((_res & 1) != 0) return;
10804 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10806 CResult_NonePaymentSendFailureZ_free(_res_conv);
10809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10810 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10811 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10812 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10813 return (uint64_t)ret_conv;
10816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10817 LDKThirtyTwoBytes o_ref;
10818 CHECK((*env)->GetArrayLength(env, o) == 32);
10819 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10820 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10821 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
10822 return (uint64_t)ret_conv;
10825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10826 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10827 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10828 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
10829 return (uint64_t)ret_conv;
10832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10833 if ((_res & 1) != 0) return;
10834 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10836 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
10839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10840 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
10841 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10842 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
10843 return (uint64_t)ret_conv;
10846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10847 LDKCVec_NetAddressZ _res_constr;
10848 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10849 if (_res_constr.datalen > 0)
10850 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10852 _res_constr.data = NULL;
10853 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10854 for (size_t m = 0; m < _res_constr.datalen; m++) {
10855 int64_t _res_conv_12 = _res_vals[m];
10856 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10857 FREE((void*)_res_conv_12);
10858 _res_constr.data[m] = _res_conv_12_conv;
10860 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10861 CVec_NetAddressZ_free(_res_constr);
10864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10865 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10866 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10867 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10868 return (uint64_t)ret_ref;
10871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10872 LDKThirtyTwoBytes a_ref;
10873 CHECK((*env)->GetArrayLength(env, a) == 32);
10874 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10875 LDKThirtyTwoBytes b_ref;
10876 CHECK((*env)->GetArrayLength(env, b) == 32);
10877 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10878 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10879 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10880 return (uint64_t)ret_ref;
10883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10884 if ((_res & 1) != 0) return;
10885 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10887 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10891 LDKThirtyTwoBytes o_ref;
10892 CHECK((*env)->GetArrayLength(env, o) == 32);
10893 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10894 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10895 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10896 return (uint64_t)ret_conv;
10899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10900 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10901 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10902 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10903 return (uint64_t)ret_conv;
10906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10907 if ((_res & 1) != 0) return;
10908 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10910 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10914 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10915 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10916 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10917 return (uint64_t)ret_conv;
10920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10921 LDKCVec_ChannelMonitorZ _res_constr;
10922 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10923 if (_res_constr.datalen > 0)
10924 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10926 _res_constr.data = NULL;
10927 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10928 for (size_t q = 0; q < _res_constr.datalen; q++) {
10929 int64_t _res_conv_16 = _res_vals[q];
10930 LDKChannelMonitor _res_conv_16_conv;
10931 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10932 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10933 _res_constr.data[q] = _res_conv_16_conv;
10935 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10936 CVec_ChannelMonitorZ_free(_res_constr);
10939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10940 LDKThirtyTwoBytes a_ref;
10941 CHECK((*env)->GetArrayLength(env, a) == 32);
10942 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10943 LDKChannelManager b_conv;
10944 b_conv.inner = (void*)(b & (~1));
10945 b_conv.is_owned = (b & 1) || (b == 0);
10946 // Warning: we need a move here but no clone is available for LDKChannelManager
10947 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10948 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10949 return (uint64_t)ret_ref;
10952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10953 if ((_res & 1) != 0) return;
10954 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10956 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10960 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10961 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10962 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10963 return (uint64_t)ret_conv;
10966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10967 LDKDecodeError e_conv;
10968 e_conv.inner = (void*)(e & (~1));
10969 e_conv.is_owned = (e & 1) || (e == 0);
10970 e_conv = DecodeError_clone(&e_conv);
10971 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10972 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10973 return (uint64_t)ret_conv;
10976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10977 if ((_res & 1) != 0) return;
10978 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10980 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10984 LDKChannelConfig o_conv;
10985 o_conv.inner = (void*)(o & (~1));
10986 o_conv.is_owned = (o & 1) || (o == 0);
10987 o_conv = ChannelConfig_clone(&o_conv);
10988 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10989 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10990 return (uint64_t)ret_conv;
10993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10994 LDKDecodeError e_conv;
10995 e_conv.inner = (void*)(e & (~1));
10996 e_conv.is_owned = (e & 1) || (e == 0);
10997 e_conv = DecodeError_clone(&e_conv);
10998 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10999 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
11000 return (uint64_t)ret_conv;
11003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11004 if ((_res & 1) != 0) return;
11005 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
11007 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
11010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11011 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
11012 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
11013 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
11014 return (uint64_t)ret_conv;
11017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11018 LDKOutPoint o_conv;
11019 o_conv.inner = (void*)(o & (~1));
11020 o_conv.is_owned = (o & 1) || (o == 0);
11021 o_conv = OutPoint_clone(&o_conv);
11022 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11023 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
11024 return (uint64_t)ret_conv;
11027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11028 LDKDecodeError e_conv;
11029 e_conv.inner = (void*)(e & (~1));
11030 e_conv.is_owned = (e & 1) || (e == 0);
11031 e_conv = DecodeError_clone(&e_conv);
11032 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11033 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
11034 return (uint64_t)ret_conv;
11037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11038 if ((_res & 1) != 0) return;
11039 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
11041 CResult_OutPointDecodeErrorZ_free(_res_conv);
11044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11045 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
11046 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
11047 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
11048 return (uint64_t)ret_conv;
11051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
11052 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
11053 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11054 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
11055 return (uint64_t)ret_conv;
11058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
11059 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11060 *ret_conv = CResult_SiPrefixNoneZ_err();
11061 return (uint64_t)ret_conv;
11064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11065 if ((_res & 1) != 0) return;
11066 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
11068 CResult_SiPrefixNoneZ_free(_res_conv);
11071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11072 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11073 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11074 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11075 return (uint64_t)ret_conv;
11078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11080 o_conv.inner = (void*)(o & (~1));
11081 o_conv.is_owned = (o & 1) || (o == 0);
11082 o_conv = Invoice_clone(&o_conv);
11083 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11084 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11085 return (uint64_t)ret_conv;
11088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11089 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11090 *ret_conv = CResult_InvoiceNoneZ_err();
11091 return (uint64_t)ret_conv;
11094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11095 if ((_res & 1) != 0) return;
11096 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
11098 CResult_InvoiceNoneZ_free(_res_conv);
11101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11102 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11103 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11104 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11105 return (uint64_t)ret_conv;
11108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11109 LDKSignedRawInvoice o_conv;
11110 o_conv.inner = (void*)(o & (~1));
11111 o_conv.is_owned = (o & 1) || (o == 0);
11112 o_conv = SignedRawInvoice_clone(&o_conv);
11113 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11114 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11115 return (uint64_t)ret_conv;
11118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11119 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11120 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11121 return (uint64_t)ret_conv;
11124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11125 if ((_res & 1) != 0) return;
11126 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
11128 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11132 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11133 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11134 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11135 return (uint64_t)ret_conv;
11138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11139 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11140 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11141 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11142 return (uint64_t)ret_ref;
11145 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) {
11146 LDKRawInvoice a_conv;
11147 a_conv.inner = (void*)(a & (~1));
11148 a_conv.is_owned = (a & 1) || (a == 0);
11149 a_conv = RawInvoice_clone(&a_conv);
11150 LDKThirtyTwoBytes b_ref;
11151 CHECK((*env)->GetArrayLength(env, b) == 32);
11152 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11153 LDKInvoiceSignature c_conv;
11154 c_conv.inner = (void*)(c & (~1));
11155 c_conv.is_owned = (c & 1) || (c == 0);
11156 c_conv = InvoiceSignature_clone(&c_conv);
11157 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11158 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11159 return (uint64_t)ret_ref;
11162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11163 if ((_res & 1) != 0) return;
11164 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
11166 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11170 LDKPayeePubKey o_conv;
11171 o_conv.inner = (void*)(o & (~1));
11172 o_conv.is_owned = (o & 1) || (o == 0);
11173 o_conv = PayeePubKey_clone(&o_conv);
11174 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11175 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11176 return (uint64_t)ret_conv;
11179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11180 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11181 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11182 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11183 return (uint64_t)ret_conv;
11186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11187 if ((_res & 1) != 0) return;
11188 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
11190 CResult_PayeePubKeyErrorZ_free(_res_conv);
11193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11194 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11195 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11196 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11197 return (uint64_t)ret_conv;
11200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11201 LDKCVec_PrivateRouteZ _res_constr;
11202 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11203 if (_res_constr.datalen > 0)
11204 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11206 _res_constr.data = NULL;
11207 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11208 for (size_t o = 0; o < _res_constr.datalen; o++) {
11209 int64_t _res_conv_14 = _res_vals[o];
11210 LDKPrivateRoute _res_conv_14_conv;
11211 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11212 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11213 _res_constr.data[o] = _res_conv_14_conv;
11215 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11216 CVec_PrivateRouteZ_free(_res_constr);
11219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11220 LDKPositiveTimestamp o_conv;
11221 o_conv.inner = (void*)(o & (~1));
11222 o_conv.is_owned = (o & 1) || (o == 0);
11223 o_conv = PositiveTimestamp_clone(&o_conv);
11224 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11225 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
11226 return (uint64_t)ret_conv;
11229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11230 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11231 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11232 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
11233 return (uint64_t)ret_conv;
11236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11237 if ((_res & 1) != 0) return;
11238 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
11240 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
11243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11244 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
11245 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11246 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
11247 return (uint64_t)ret_conv;
11250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
11251 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11252 *ret_conv = CResult_NoneSemanticErrorZ_ok();
11253 return (uint64_t)ret_conv;
11256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11257 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11258 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11259 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
11260 return (uint64_t)ret_conv;
11263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11264 if ((_res & 1) != 0) return;
11265 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
11267 CResult_NoneSemanticErrorZ_free(_res_conv);
11270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11271 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
11272 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11273 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
11274 return (uint64_t)ret_conv;
11277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11279 o_conv.inner = (void*)(o & (~1));
11280 o_conv.is_owned = (o & 1) || (o == 0);
11281 o_conv = Invoice_clone(&o_conv);
11282 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11283 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
11284 return (uint64_t)ret_conv;
11287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11288 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11289 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11290 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
11291 return (uint64_t)ret_conv;
11294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11295 if ((_res & 1) != 0) return;
11296 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
11298 CResult_InvoiceSemanticErrorZ_free(_res_conv);
11301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11302 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
11303 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11304 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
11305 return (uint64_t)ret_conv;
11308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11309 LDKDescription o_conv;
11310 o_conv.inner = (void*)(o & (~1));
11311 o_conv.is_owned = (o & 1) || (o == 0);
11312 o_conv = Description_clone(&o_conv);
11313 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11314 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
11315 return (uint64_t)ret_conv;
11318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11319 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11320 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11321 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
11322 return (uint64_t)ret_conv;
11325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11326 if ((_res & 1) != 0) return;
11327 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
11329 CResult_DescriptionCreationErrorZ_free(_res_conv);
11332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11333 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11334 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11335 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11336 return (uint64_t)ret_conv;
11339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11340 LDKExpiryTime o_conv;
11341 o_conv.inner = (void*)(o & (~1));
11342 o_conv.is_owned = (o & 1) || (o == 0);
11343 o_conv = ExpiryTime_clone(&o_conv);
11344 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11345 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11346 return (uint64_t)ret_conv;
11349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11350 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11351 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11352 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11353 return (uint64_t)ret_conv;
11356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11357 if ((_res & 1) != 0) return;
11358 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
11360 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11364 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11365 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11366 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11367 return (uint64_t)ret_conv;
11370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11371 LDKPrivateRoute o_conv;
11372 o_conv.inner = (void*)(o & (~1));
11373 o_conv.is_owned = (o & 1) || (o == 0);
11374 o_conv = PrivateRoute_clone(&o_conv);
11375 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11376 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11377 return (uint64_t)ret_conv;
11380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11381 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11382 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11383 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11384 return (uint64_t)ret_conv;
11387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11388 if ((_res & 1) != 0) return;
11389 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
11391 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11395 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11396 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11397 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11398 return (uint64_t)ret_conv;
11401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
11402 LDKStr o_conv = java_to_owned_str(env, o);
11403 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11404 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11405 return (uint64_t)ret_conv;
11408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11409 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11410 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11411 *ret_conv = CResult_StringErrorZ_err(e_conv);
11412 return (uint64_t)ret_conv;
11415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11416 if ((_res & 1) != 0) return;
11417 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
11419 CResult_StringErrorZ_free(_res_conv);
11422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11423 LDKChannelMonitorUpdate o_conv;
11424 o_conv.inner = (void*)(o & (~1));
11425 o_conv.is_owned = (o & 1) || (o == 0);
11426 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11427 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11428 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11429 return (uint64_t)ret_conv;
11432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11433 LDKDecodeError e_conv;
11434 e_conv.inner = (void*)(e & (~1));
11435 e_conv.is_owned = (e & 1) || (e == 0);
11436 e_conv = DecodeError_clone(&e_conv);
11437 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11438 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11439 return (uint64_t)ret_conv;
11442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11443 if ((_res & 1) != 0) return;
11444 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11446 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11450 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11451 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11452 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11453 return (uint64_t)ret_conv;
11456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11457 LDKHTLCUpdate o_conv;
11458 o_conv.inner = (void*)(o & (~1));
11459 o_conv.is_owned = (o & 1) || (o == 0);
11460 o_conv = HTLCUpdate_clone(&o_conv);
11461 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11462 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11463 return (uint64_t)ret_conv;
11466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11467 LDKDecodeError e_conv;
11468 e_conv.inner = (void*)(e & (~1));
11469 e_conv.is_owned = (e & 1) || (e == 0);
11470 e_conv = DecodeError_clone(&e_conv);
11471 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11472 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11473 return (uint64_t)ret_conv;
11476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11477 if ((_res & 1) != 0) return;
11478 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11480 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11484 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11485 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11486 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11487 return (uint64_t)ret_conv;
11490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
11491 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11492 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11493 return (uint64_t)ret_conv;
11496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11497 LDKMonitorUpdateError e_conv;
11498 e_conv.inner = (void*)(e & (~1));
11499 e_conv.is_owned = (e & 1) || (e == 0);
11500 e_conv = MonitorUpdateError_clone(&e_conv);
11501 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11502 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11503 return (uint64_t)ret_conv;
11506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11507 if ((_res & 1) != 0) return;
11508 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
11510 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11514 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11515 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11516 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11517 return (uint64_t)ret_conv;
11520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11521 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11522 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11523 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
11524 return (uint64_t)ret_ref;
11527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11528 LDKOutPoint a_conv;
11529 a_conv.inner = (void*)(a & (~1));
11530 a_conv.is_owned = (a & 1) || (a == 0);
11531 a_conv = OutPoint_clone(&a_conv);
11533 b_ref.datalen = (*env)->GetArrayLength(env, b);
11534 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11535 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11536 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11537 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11538 return (uint64_t)ret_ref;
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11542 if ((_res & 1) != 0) return;
11543 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
11545 C2Tuple_OutPointScriptZ_free(_res_conv);
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11549 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11550 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11551 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
11552 return (uint64_t)ret_ref;
11555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
11557 b_ref.datalen = (*env)->GetArrayLength(env, b);
11558 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11559 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11560 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11561 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
11562 return (uint64_t)ret_ref;
11565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11566 if ((_res & 1) != 0) return;
11567 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
11569 C2Tuple_u32ScriptZ_free(_res_conv);
11572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11573 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11574 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11575 if (_res_constr.datalen > 0)
11576 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11578 _res_constr.data = NULL;
11579 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11580 for (size_t b = 0; b < _res_constr.datalen; b++) {
11581 int64_t _res_conv_27 = _res_vals[b];
11582 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
11583 FREE((void*)_res_conv_27);
11584 _res_constr.data[b] = _res_conv_27_conv;
11586 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11587 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11591 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11592 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11593 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11594 return (uint64_t)ret_ref;
11597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11598 LDKThirtyTwoBytes a_ref;
11599 CHECK((*env)->GetArrayLength(env, a) == 32);
11600 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11601 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11602 b_constr.datalen = (*env)->GetArrayLength(env, b);
11603 if (b_constr.datalen > 0)
11604 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11606 b_constr.data = NULL;
11607 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11608 for (size_t b = 0; b < b_constr.datalen; b++) {
11609 int64_t b_conv_27 = b_vals[b];
11610 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
11611 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
11612 b_constr.data[b] = b_conv_27_conv;
11614 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11615 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11616 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11617 return (uint64_t)ret_ref;
11620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11621 if ((_res & 1) != 0) return;
11622 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
11624 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11628 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11629 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11630 if (_res_constr.datalen > 0)
11631 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11633 _res_constr.data = NULL;
11634 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11635 for (size_t v = 0; v < _res_constr.datalen; v++) {
11636 int64_t _res_conv_47 = _res_vals[v];
11637 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11638 FREE((void*)_res_conv_47);
11639 _res_constr.data[v] = _res_conv_47_conv;
11641 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11642 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11646 LDKCVec_EventZ _res_constr;
11647 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11648 if (_res_constr.datalen > 0)
11649 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11651 _res_constr.data = NULL;
11652 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11653 for (size_t h = 0; h < _res_constr.datalen; h++) {
11654 int64_t _res_conv_7 = _res_vals[h];
11655 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11656 FREE((void*)_res_conv_7);
11657 _res_constr.data[h] = _res_conv_7_conv;
11659 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11660 CVec_EventZ_free(_res_constr);
11663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11664 LDKCVec_TransactionZ _res_constr;
11665 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11666 if (_res_constr.datalen > 0)
11667 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11669 _res_constr.data = NULL;
11670 for (size_t i = 0; i < _res_constr.datalen; i++) {
11671 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11672 LDKTransaction _res_conv_8_ref;
11673 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11674 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11675 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11676 _res_conv_8_ref.data_is_owned = true;
11677 _res_constr.data[i] = _res_conv_8_ref;
11679 CVec_TransactionZ_free(_res_constr);
11682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11683 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11684 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11685 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11686 return (uint64_t)ret_ref;
11689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11690 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11691 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11692 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11693 return (uint64_t)ret_ref;
11696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11697 if ((_res & 1) != 0) return;
11698 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11700 C2Tuple_u32TxOutZ_free(_res_conv);
11703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11704 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11705 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11706 if (_res_constr.datalen > 0)
11707 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11709 _res_constr.data = NULL;
11710 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11711 for (size_t a = 0; a < _res_constr.datalen; a++) {
11712 int64_t _res_conv_26 = _res_vals[a];
11713 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11714 FREE((void*)_res_conv_26);
11715 _res_constr.data[a] = _res_conv_26_conv;
11717 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11718 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11722 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11723 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11724 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11725 return (uint64_t)ret_ref;
11728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11729 LDKThirtyTwoBytes a_ref;
11730 CHECK((*env)->GetArrayLength(env, a) == 32);
11731 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11732 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11733 b_constr.datalen = (*env)->GetArrayLength(env, b);
11734 if (b_constr.datalen > 0)
11735 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11737 b_constr.data = NULL;
11738 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11739 for (size_t a = 0; a < b_constr.datalen; a++) {
11740 int64_t b_conv_26 = b_vals[a];
11741 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11742 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11743 b_constr.data[a] = b_conv_26_conv;
11745 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11746 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11747 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11748 return (uint64_t)ret_ref;
11751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11752 if ((_res & 1) != 0) return;
11753 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11755 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11759 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11760 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11761 if (_res_constr.datalen > 0)
11762 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11764 _res_constr.data = NULL;
11765 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11766 for (size_t u = 0; u < _res_constr.datalen; u++) {
11767 int64_t _res_conv_46 = _res_vals[u];
11768 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11769 FREE((void*)_res_conv_46);
11770 _res_constr.data[u] = _res_conv_46_conv;
11772 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11773 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11777 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11778 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11779 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11780 return (uint64_t)ret_conv;
11783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11784 LDKDecodeError e_conv;
11785 e_conv.inner = (void*)(e & (~1));
11786 e_conv.is_owned = (e & 1) || (e == 0);
11787 e_conv = DecodeError_clone(&e_conv);
11788 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11789 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11790 return (uint64_t)ret_conv;
11793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11794 if ((_res & 1) != 0) return;
11795 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11797 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11801 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11802 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11803 return (uint64_t)ret_conv;
11806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11807 LDKLightningError e_conv;
11808 e_conv.inner = (void*)(e & (~1));
11809 e_conv.is_owned = (e & 1) || (e == 0);
11810 e_conv = LightningError_clone(&e_conv);
11811 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11812 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11813 return (uint64_t)ret_conv;
11816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11817 if ((_res & 1) != 0) return;
11818 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11820 CResult_boolLightningErrorZ_free(_res_conv);
11823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11824 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11825 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11826 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11827 return (uint64_t)ret_conv;
11830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11831 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11832 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11833 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11834 return (uint64_t)ret_ref;
11837 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) {
11838 LDKChannelAnnouncement a_conv;
11839 a_conv.inner = (void*)(a & (~1));
11840 a_conv.is_owned = (a & 1) || (a == 0);
11841 a_conv = ChannelAnnouncement_clone(&a_conv);
11842 LDKChannelUpdate b_conv;
11843 b_conv.inner = (void*)(b & (~1));
11844 b_conv.is_owned = (b & 1) || (b == 0);
11845 b_conv = ChannelUpdate_clone(&b_conv);
11846 LDKChannelUpdate c_conv;
11847 c_conv.inner = (void*)(c & (~1));
11848 c_conv.is_owned = (c & 1) || (c == 0);
11849 c_conv = ChannelUpdate_clone(&c_conv);
11850 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11851 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11852 return (uint64_t)ret_ref;
11855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11856 if ((_res & 1) != 0) return;
11857 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11859 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11863 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11864 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11865 if (_res_constr.datalen > 0)
11866 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11868 _res_constr.data = NULL;
11869 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11870 for (size_t l = 0; l < _res_constr.datalen; l++) {
11871 int64_t _res_conv_63 = _res_vals[l];
11872 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11873 FREE((void*)_res_conv_63);
11874 _res_constr.data[l] = _res_conv_63_conv;
11876 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11877 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11881 LDKCVec_NodeAnnouncementZ _res_constr;
11882 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11883 if (_res_constr.datalen > 0)
11884 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11886 _res_constr.data = NULL;
11887 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11888 for (size_t s = 0; s < _res_constr.datalen; s++) {
11889 int64_t _res_conv_18 = _res_vals[s];
11890 LDKNodeAnnouncement _res_conv_18_conv;
11891 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11892 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11893 _res_constr.data[s] = _res_conv_18_conv;
11895 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11896 CVec_NodeAnnouncementZ_free(_res_constr);
11899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11900 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11901 *ret_conv = CResult_NoneLightningErrorZ_ok();
11902 return (uint64_t)ret_conv;
11905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11906 LDKLightningError e_conv;
11907 e_conv.inner = (void*)(e & (~1));
11908 e_conv.is_owned = (e & 1) || (e == 0);
11909 e_conv = LightningError_clone(&e_conv);
11910 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11911 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11912 return (uint64_t)ret_conv;
11915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11916 if ((_res & 1) != 0) return;
11917 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11919 CResult_NoneLightningErrorZ_free(_res_conv);
11922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11923 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11924 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11925 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11926 return (uint64_t)ret_conv;
11929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11930 LDKCVec_PublicKeyZ _res_constr;
11931 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11932 if (_res_constr.datalen > 0)
11933 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11935 _res_constr.data = NULL;
11936 for (size_t i = 0; i < _res_constr.datalen; i++) {
11937 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11938 LDKPublicKey _res_conv_8_ref;
11939 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11940 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11941 _res_constr.data[i] = _res_conv_8_ref;
11943 CVec_PublicKeyZ_free(_res_constr);
11946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11948 o_ref.datalen = (*env)->GetArrayLength(env, o);
11949 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11950 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11951 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11952 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11953 return (uint64_t)ret_conv;
11956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11957 LDKPeerHandleError e_conv;
11958 e_conv.inner = (void*)(e & (~1));
11959 e_conv.is_owned = (e & 1) || (e == 0);
11960 e_conv = PeerHandleError_clone(&e_conv);
11961 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11962 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11963 return (uint64_t)ret_conv;
11966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11967 if ((_res & 1) != 0) return;
11968 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11970 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11974 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11975 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11976 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11977 return (uint64_t)ret_conv;
11980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11981 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11982 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11983 return (uint64_t)ret_conv;
11986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11987 LDKPeerHandleError e_conv;
11988 e_conv.inner = (void*)(e & (~1));
11989 e_conv.is_owned = (e & 1) || (e == 0);
11990 e_conv = PeerHandleError_clone(&e_conv);
11991 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11992 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11993 return (uint64_t)ret_conv;
11996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11997 if ((_res & 1) != 0) return;
11998 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
12000 CResult_NonePeerHandleErrorZ_free(_res_conv);
12003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12004 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
12005 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12006 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
12007 return (uint64_t)ret_conv;
12010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
12011 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12012 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
12013 return (uint64_t)ret_conv;
12016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12017 LDKPeerHandleError e_conv;
12018 e_conv.inner = (void*)(e & (~1));
12019 e_conv.is_owned = (e & 1) || (e == 0);
12020 e_conv = PeerHandleError_clone(&e_conv);
12021 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12022 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
12023 return (uint64_t)ret_conv;
12026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12027 if ((_res & 1) != 0) return;
12028 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
12030 CResult_boolPeerHandleErrorZ_free(_res_conv);
12033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12034 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
12035 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12036 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
12037 return (uint64_t)ret_conv;
12040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12041 LDKDirectionalChannelInfo o_conv;
12042 o_conv.inner = (void*)(o & (~1));
12043 o_conv.is_owned = (o & 1) || (o == 0);
12044 o_conv = DirectionalChannelInfo_clone(&o_conv);
12045 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12046 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
12047 return (uint64_t)ret_conv;
12050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12051 LDKDecodeError e_conv;
12052 e_conv.inner = (void*)(e & (~1));
12053 e_conv.is_owned = (e & 1) || (e == 0);
12054 e_conv = DecodeError_clone(&e_conv);
12055 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12056 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12057 return (uint64_t)ret_conv;
12060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12061 if ((_res & 1) != 0) return;
12062 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12064 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12068 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12069 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12070 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12071 return (uint64_t)ret_conv;
12074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12075 LDKChannelInfo o_conv;
12076 o_conv.inner = (void*)(o & (~1));
12077 o_conv.is_owned = (o & 1) || (o == 0);
12078 o_conv = ChannelInfo_clone(&o_conv);
12079 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12080 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12081 return (uint64_t)ret_conv;
12084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12085 LDKDecodeError e_conv;
12086 e_conv.inner = (void*)(e & (~1));
12087 e_conv.is_owned = (e & 1) || (e == 0);
12088 e_conv = DecodeError_clone(&e_conv);
12089 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12090 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12091 return (uint64_t)ret_conv;
12094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12095 if ((_res & 1) != 0) return;
12096 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12098 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12102 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12103 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12104 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12105 return (uint64_t)ret_conv;
12108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12109 LDKRoutingFees o_conv;
12110 o_conv.inner = (void*)(o & (~1));
12111 o_conv.is_owned = (o & 1) || (o == 0);
12112 o_conv = RoutingFees_clone(&o_conv);
12113 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12114 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12115 return (uint64_t)ret_conv;
12118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12119 LDKDecodeError e_conv;
12120 e_conv.inner = (void*)(e & (~1));
12121 e_conv.is_owned = (e & 1) || (e == 0);
12122 e_conv = DecodeError_clone(&e_conv);
12123 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12124 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12125 return (uint64_t)ret_conv;
12128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12129 if ((_res & 1) != 0) return;
12130 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12132 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12136 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12137 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12138 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12139 return (uint64_t)ret_conv;
12142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12143 LDKNodeAnnouncementInfo o_conv;
12144 o_conv.inner = (void*)(o & (~1));
12145 o_conv.is_owned = (o & 1) || (o == 0);
12146 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12147 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12148 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12149 return (uint64_t)ret_conv;
12152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12153 LDKDecodeError e_conv;
12154 e_conv.inner = (void*)(e & (~1));
12155 e_conv.is_owned = (e & 1) || (e == 0);
12156 e_conv = DecodeError_clone(&e_conv);
12157 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12158 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12159 return (uint64_t)ret_conv;
12162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12163 if ((_res & 1) != 0) return;
12164 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12166 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12170 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12171 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12172 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12173 return (uint64_t)ret_conv;
12176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12177 LDKCVec_u64Z _res_constr;
12178 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12179 if (_res_constr.datalen > 0)
12180 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12182 _res_constr.data = NULL;
12183 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12184 for (size_t g = 0; g < _res_constr.datalen; g++) {
12185 int64_t _res_conv_6 = _res_vals[g];
12186 _res_constr.data[g] = _res_conv_6;
12188 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12189 CVec_u64Z_free(_res_constr);
12192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12193 LDKNodeInfo o_conv;
12194 o_conv.inner = (void*)(o & (~1));
12195 o_conv.is_owned = (o & 1) || (o == 0);
12196 o_conv = NodeInfo_clone(&o_conv);
12197 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12198 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12199 return (uint64_t)ret_conv;
12202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12203 LDKDecodeError e_conv;
12204 e_conv.inner = (void*)(e & (~1));
12205 e_conv.is_owned = (e & 1) || (e == 0);
12206 e_conv = DecodeError_clone(&e_conv);
12207 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12208 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12209 return (uint64_t)ret_conv;
12212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12213 if ((_res & 1) != 0) return;
12214 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12216 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12220 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12221 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12222 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12223 return (uint64_t)ret_conv;
12226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12227 LDKNetworkGraph o_conv;
12228 o_conv.inner = (void*)(o & (~1));
12229 o_conv.is_owned = (o & 1) || (o == 0);
12230 o_conv = NetworkGraph_clone(&o_conv);
12231 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12232 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12233 return (uint64_t)ret_conv;
12236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12237 LDKDecodeError e_conv;
12238 e_conv.inner = (void*)(e & (~1));
12239 e_conv.is_owned = (e & 1) || (e == 0);
12240 e_conv = DecodeError_clone(&e_conv);
12241 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12242 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12243 return (uint64_t)ret_conv;
12246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12247 if ((_res & 1) != 0) return;
12248 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
12250 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12254 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12255 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12256 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12257 return (uint64_t)ret_conv;
12260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
12261 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12262 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12263 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
12264 return (uint64_t)ret_conv;
12267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
12268 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12269 *ret_conv = CResult_NetAddressu8Z_err(e);
12270 return (uint64_t)ret_conv;
12273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12274 if ((_res & 1) != 0) return;
12275 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
12277 CResult_NetAddressu8Z_free(_res_conv);
12280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12281 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
12282 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12283 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
12284 return (uint64_t)ret_conv;
12287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12288 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
12289 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12290 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
12291 return (uint64_t)ret_conv;
12294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12295 LDKDecodeError e_conv;
12296 e_conv.inner = (void*)(e & (~1));
12297 e_conv.is_owned = (e & 1) || (e == 0);
12298 e_conv = DecodeError_clone(&e_conv);
12299 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12300 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
12301 return (uint64_t)ret_conv;
12304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12305 if ((_res & 1) != 0) return;
12306 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12308 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
12311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12312 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
12313 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12314 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
12315 return (uint64_t)ret_conv;
12318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12319 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12320 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12321 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12322 return (uint64_t)ret_conv;
12325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12326 LDKDecodeError e_conv;
12327 e_conv.inner = (void*)(e & (~1));
12328 e_conv.is_owned = (e & 1) || (e == 0);
12329 e_conv = DecodeError_clone(&e_conv);
12330 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12331 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12332 return (uint64_t)ret_conv;
12335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12336 if ((_res & 1) != 0) return;
12337 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
12339 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12343 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12344 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12345 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12346 return (uint64_t)ret_conv;
12349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12350 LDKCVec_UpdateAddHTLCZ _res_constr;
12351 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12352 if (_res_constr.datalen > 0)
12353 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12355 _res_constr.data = NULL;
12356 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12357 for (size_t p = 0; p < _res_constr.datalen; p++) {
12358 int64_t _res_conv_15 = _res_vals[p];
12359 LDKUpdateAddHTLC _res_conv_15_conv;
12360 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12361 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12362 _res_constr.data[p] = _res_conv_15_conv;
12364 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12365 CVec_UpdateAddHTLCZ_free(_res_constr);
12368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12369 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12370 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12371 if (_res_constr.datalen > 0)
12372 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12374 _res_constr.data = NULL;
12375 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12376 for (size_t t = 0; t < _res_constr.datalen; t++) {
12377 int64_t _res_conv_19 = _res_vals[t];
12378 LDKUpdateFulfillHTLC _res_conv_19_conv;
12379 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12380 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12381 _res_constr.data[t] = _res_conv_19_conv;
12383 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12384 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12388 LDKCVec_UpdateFailHTLCZ _res_constr;
12389 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12390 if (_res_constr.datalen > 0)
12391 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12393 _res_constr.data = NULL;
12394 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12395 for (size_t q = 0; q < _res_constr.datalen; q++) {
12396 int64_t _res_conv_16 = _res_vals[q];
12397 LDKUpdateFailHTLC _res_conv_16_conv;
12398 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12399 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12400 _res_constr.data[q] = _res_conv_16_conv;
12402 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12403 CVec_UpdateFailHTLCZ_free(_res_constr);
12406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12407 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12408 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12409 if (_res_constr.datalen > 0)
12410 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12412 _res_constr.data = NULL;
12413 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12414 for (size_t z = 0; z < _res_constr.datalen; z++) {
12415 int64_t _res_conv_25 = _res_vals[z];
12416 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12417 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12418 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12419 _res_constr.data[z] = _res_conv_25_conv;
12421 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12422 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12426 LDKAcceptChannel o_conv;
12427 o_conv.inner = (void*)(o & (~1));
12428 o_conv.is_owned = (o & 1) || (o == 0);
12429 o_conv = AcceptChannel_clone(&o_conv);
12430 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12431 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12432 return (uint64_t)ret_conv;
12435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12436 LDKDecodeError e_conv;
12437 e_conv.inner = (void*)(e & (~1));
12438 e_conv.is_owned = (e & 1) || (e == 0);
12439 e_conv = DecodeError_clone(&e_conv);
12440 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12441 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12442 return (uint64_t)ret_conv;
12445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12446 if ((_res & 1) != 0) return;
12447 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12449 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12453 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12454 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12455 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12456 return (uint64_t)ret_conv;
12459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12460 LDKAnnouncementSignatures o_conv;
12461 o_conv.inner = (void*)(o & (~1));
12462 o_conv.is_owned = (o & 1) || (o == 0);
12463 o_conv = AnnouncementSignatures_clone(&o_conv);
12464 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12465 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12466 return (uint64_t)ret_conv;
12469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12470 LDKDecodeError e_conv;
12471 e_conv.inner = (void*)(e & (~1));
12472 e_conv.is_owned = (e & 1) || (e == 0);
12473 e_conv = DecodeError_clone(&e_conv);
12474 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12475 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12476 return (uint64_t)ret_conv;
12479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12480 if ((_res & 1) != 0) return;
12481 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12483 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12487 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12488 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12489 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12490 return (uint64_t)ret_conv;
12493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12494 LDKChannelReestablish o_conv;
12495 o_conv.inner = (void*)(o & (~1));
12496 o_conv.is_owned = (o & 1) || (o == 0);
12497 o_conv = ChannelReestablish_clone(&o_conv);
12498 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12499 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12500 return (uint64_t)ret_conv;
12503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12504 LDKDecodeError e_conv;
12505 e_conv.inner = (void*)(e & (~1));
12506 e_conv.is_owned = (e & 1) || (e == 0);
12507 e_conv = DecodeError_clone(&e_conv);
12508 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12509 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12510 return (uint64_t)ret_conv;
12513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12514 if ((_res & 1) != 0) return;
12515 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
12517 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12521 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12522 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12523 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12524 return (uint64_t)ret_conv;
12527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12528 LDKClosingSigned o_conv;
12529 o_conv.inner = (void*)(o & (~1));
12530 o_conv.is_owned = (o & 1) || (o == 0);
12531 o_conv = ClosingSigned_clone(&o_conv);
12532 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12533 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12534 return (uint64_t)ret_conv;
12537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12538 LDKDecodeError e_conv;
12539 e_conv.inner = (void*)(e & (~1));
12540 e_conv.is_owned = (e & 1) || (e == 0);
12541 e_conv = DecodeError_clone(&e_conv);
12542 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12543 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12544 return (uint64_t)ret_conv;
12547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12548 if ((_res & 1) != 0) return;
12549 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12551 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12555 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12556 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12557 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12558 return (uint64_t)ret_conv;
12561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12562 LDKClosingSignedFeeRange o_conv;
12563 o_conv.inner = (void*)(o & (~1));
12564 o_conv.is_owned = (o & 1) || (o == 0);
12565 o_conv = ClosingSignedFeeRange_clone(&o_conv);
12566 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12567 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
12568 return (uint64_t)ret_conv;
12571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12572 LDKDecodeError e_conv;
12573 e_conv.inner = (void*)(e & (~1));
12574 e_conv.is_owned = (e & 1) || (e == 0);
12575 e_conv = DecodeError_clone(&e_conv);
12576 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12577 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
12578 return (uint64_t)ret_conv;
12581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12582 if ((_res & 1) != 0) return;
12583 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12585 CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
12588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12589 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
12590 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
12591 *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
12592 return (uint64_t)ret_conv;
12595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12596 LDKCommitmentSigned o_conv;
12597 o_conv.inner = (void*)(o & (~1));
12598 o_conv.is_owned = (o & 1) || (o == 0);
12599 o_conv = CommitmentSigned_clone(&o_conv);
12600 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12601 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12602 return (uint64_t)ret_conv;
12605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12606 LDKDecodeError e_conv;
12607 e_conv.inner = (void*)(e & (~1));
12608 e_conv.is_owned = (e & 1) || (e == 0);
12609 e_conv = DecodeError_clone(&e_conv);
12610 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12611 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12612 return (uint64_t)ret_conv;
12615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12616 if ((_res & 1) != 0) return;
12617 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12619 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12623 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12624 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12625 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12626 return (uint64_t)ret_conv;
12629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12630 LDKFundingCreated o_conv;
12631 o_conv.inner = (void*)(o & (~1));
12632 o_conv.is_owned = (o & 1) || (o == 0);
12633 o_conv = FundingCreated_clone(&o_conv);
12634 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12635 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12636 return (uint64_t)ret_conv;
12639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12640 LDKDecodeError e_conv;
12641 e_conv.inner = (void*)(e & (~1));
12642 e_conv.is_owned = (e & 1) || (e == 0);
12643 e_conv = DecodeError_clone(&e_conv);
12644 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12645 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12646 return (uint64_t)ret_conv;
12649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12650 if ((_res & 1) != 0) return;
12651 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12653 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12657 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12658 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12659 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12660 return (uint64_t)ret_conv;
12663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12664 LDKFundingSigned o_conv;
12665 o_conv.inner = (void*)(o & (~1));
12666 o_conv.is_owned = (o & 1) || (o == 0);
12667 o_conv = FundingSigned_clone(&o_conv);
12668 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12669 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12670 return (uint64_t)ret_conv;
12673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12674 LDKDecodeError e_conv;
12675 e_conv.inner = (void*)(e & (~1));
12676 e_conv.is_owned = (e & 1) || (e == 0);
12677 e_conv = DecodeError_clone(&e_conv);
12678 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12679 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12680 return (uint64_t)ret_conv;
12683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12684 if ((_res & 1) != 0) return;
12685 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12687 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12691 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12692 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12693 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12694 return (uint64_t)ret_conv;
12697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12698 LDKFundingLocked o_conv;
12699 o_conv.inner = (void*)(o & (~1));
12700 o_conv.is_owned = (o & 1) || (o == 0);
12701 o_conv = FundingLocked_clone(&o_conv);
12702 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12703 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12704 return (uint64_t)ret_conv;
12707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12708 LDKDecodeError e_conv;
12709 e_conv.inner = (void*)(e & (~1));
12710 e_conv.is_owned = (e & 1) || (e == 0);
12711 e_conv = DecodeError_clone(&e_conv);
12712 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12713 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12714 return (uint64_t)ret_conv;
12717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12718 if ((_res & 1) != 0) return;
12719 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12721 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12725 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12726 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12727 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12728 return (uint64_t)ret_conv;
12731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12733 o_conv.inner = (void*)(o & (~1));
12734 o_conv.is_owned = (o & 1) || (o == 0);
12735 o_conv = Init_clone(&o_conv);
12736 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12737 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12738 return (uint64_t)ret_conv;
12741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12742 LDKDecodeError e_conv;
12743 e_conv.inner = (void*)(e & (~1));
12744 e_conv.is_owned = (e & 1) || (e == 0);
12745 e_conv = DecodeError_clone(&e_conv);
12746 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12747 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12748 return (uint64_t)ret_conv;
12751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12752 if ((_res & 1) != 0) return;
12753 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12755 CResult_InitDecodeErrorZ_free(_res_conv);
12758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12759 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12760 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12761 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12762 return (uint64_t)ret_conv;
12765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12766 LDKOpenChannel o_conv;
12767 o_conv.inner = (void*)(o & (~1));
12768 o_conv.is_owned = (o & 1) || (o == 0);
12769 o_conv = OpenChannel_clone(&o_conv);
12770 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12771 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12772 return (uint64_t)ret_conv;
12775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12776 LDKDecodeError e_conv;
12777 e_conv.inner = (void*)(e & (~1));
12778 e_conv.is_owned = (e & 1) || (e == 0);
12779 e_conv = DecodeError_clone(&e_conv);
12780 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12781 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12782 return (uint64_t)ret_conv;
12785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12786 if ((_res & 1) != 0) return;
12787 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12789 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12793 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12794 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12795 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12796 return (uint64_t)ret_conv;
12799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12800 LDKRevokeAndACK o_conv;
12801 o_conv.inner = (void*)(o & (~1));
12802 o_conv.is_owned = (o & 1) || (o == 0);
12803 o_conv = RevokeAndACK_clone(&o_conv);
12804 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12805 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12806 return (uint64_t)ret_conv;
12809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_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_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12815 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12816 return (uint64_t)ret_conv;
12819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12820 if ((_res & 1) != 0) return;
12821 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12823 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12827 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12828 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12829 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12830 return (uint64_t)ret_conv;
12833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12834 LDKShutdown o_conv;
12835 o_conv.inner = (void*)(o & (~1));
12836 o_conv.is_owned = (o & 1) || (o == 0);
12837 o_conv = Shutdown_clone(&o_conv);
12838 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12839 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12840 return (uint64_t)ret_conv;
12843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12844 LDKDecodeError e_conv;
12845 e_conv.inner = (void*)(e & (~1));
12846 e_conv.is_owned = (e & 1) || (e == 0);
12847 e_conv = DecodeError_clone(&e_conv);
12848 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12849 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12850 return (uint64_t)ret_conv;
12853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12854 if ((_res & 1) != 0) return;
12855 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12857 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12861 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12862 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12863 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12864 return (uint64_t)ret_conv;
12867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12868 LDKUpdateFailHTLC o_conv;
12869 o_conv.inner = (void*)(o & (~1));
12870 o_conv.is_owned = (o & 1) || (o == 0);
12871 o_conv = UpdateFailHTLC_clone(&o_conv);
12872 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12873 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12874 return (uint64_t)ret_conv;
12877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12878 LDKDecodeError e_conv;
12879 e_conv.inner = (void*)(e & (~1));
12880 e_conv.is_owned = (e & 1) || (e == 0);
12881 e_conv = DecodeError_clone(&e_conv);
12882 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12883 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12884 return (uint64_t)ret_conv;
12887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12888 if ((_res & 1) != 0) return;
12889 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12891 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12895 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12896 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12897 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12898 return (uint64_t)ret_conv;
12901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12902 LDKUpdateFailMalformedHTLC o_conv;
12903 o_conv.inner = (void*)(o & (~1));
12904 o_conv.is_owned = (o & 1) || (o == 0);
12905 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12906 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12907 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12908 return (uint64_t)ret_conv;
12911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12912 LDKDecodeError e_conv;
12913 e_conv.inner = (void*)(e & (~1));
12914 e_conv.is_owned = (e & 1) || (e == 0);
12915 e_conv = DecodeError_clone(&e_conv);
12916 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12917 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12918 return (uint64_t)ret_conv;
12921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12922 if ((_res & 1) != 0) return;
12923 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12925 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12929 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12930 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12931 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12932 return (uint64_t)ret_conv;
12935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12936 LDKUpdateFee o_conv;
12937 o_conv.inner = (void*)(o & (~1));
12938 o_conv.is_owned = (o & 1) || (o == 0);
12939 o_conv = UpdateFee_clone(&o_conv);
12940 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12941 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12942 return (uint64_t)ret_conv;
12945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12946 LDKDecodeError e_conv;
12947 e_conv.inner = (void*)(e & (~1));
12948 e_conv.is_owned = (e & 1) || (e == 0);
12949 e_conv = DecodeError_clone(&e_conv);
12950 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12951 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12952 return (uint64_t)ret_conv;
12955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12956 if ((_res & 1) != 0) return;
12957 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12959 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12963 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12964 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12965 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12966 return (uint64_t)ret_conv;
12969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12970 LDKUpdateFulfillHTLC o_conv;
12971 o_conv.inner = (void*)(o & (~1));
12972 o_conv.is_owned = (o & 1) || (o == 0);
12973 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12974 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12975 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12976 return (uint64_t)ret_conv;
12979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12980 LDKDecodeError e_conv;
12981 e_conv.inner = (void*)(e & (~1));
12982 e_conv.is_owned = (e & 1) || (e == 0);
12983 e_conv = DecodeError_clone(&e_conv);
12984 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12985 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12986 return (uint64_t)ret_conv;
12989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12990 if ((_res & 1) != 0) return;
12991 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12993 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12997 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12998 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12999 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
13000 return (uint64_t)ret_conv;
13003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13004 LDKUpdateAddHTLC o_conv;
13005 o_conv.inner = (void*)(o & (~1));
13006 o_conv.is_owned = (o & 1) || (o == 0);
13007 o_conv = UpdateAddHTLC_clone(&o_conv);
13008 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13009 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
13010 return (uint64_t)ret_conv;
13013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13014 LDKDecodeError e_conv;
13015 e_conv.inner = (void*)(e & (~1));
13016 e_conv.is_owned = (e & 1) || (e == 0);
13017 e_conv = DecodeError_clone(&e_conv);
13018 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13019 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
13020 return (uint64_t)ret_conv;
13023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13024 if ((_res & 1) != 0) return;
13025 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
13027 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
13030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13031 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
13032 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
13033 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
13034 return (uint64_t)ret_conv;
13037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13039 o_conv.inner = (void*)(o & (~1));
13040 o_conv.is_owned = (o & 1) || (o == 0);
13041 o_conv = Ping_clone(&o_conv);
13042 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13043 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
13044 return (uint64_t)ret_conv;
13047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13048 LDKDecodeError e_conv;
13049 e_conv.inner = (void*)(e & (~1));
13050 e_conv.is_owned = (e & 1) || (e == 0);
13051 e_conv = DecodeError_clone(&e_conv);
13052 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13053 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
13054 return (uint64_t)ret_conv;
13057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13058 if ((_res & 1) != 0) return;
13059 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
13061 CResult_PingDecodeErrorZ_free(_res_conv);
13064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13065 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
13066 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13067 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
13068 return (uint64_t)ret_conv;
13071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13073 o_conv.inner = (void*)(o & (~1));
13074 o_conv.is_owned = (o & 1) || (o == 0);
13075 o_conv = Pong_clone(&o_conv);
13076 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13077 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
13078 return (uint64_t)ret_conv;
13081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13082 LDKDecodeError e_conv;
13083 e_conv.inner = (void*)(e & (~1));
13084 e_conv.is_owned = (e & 1) || (e == 0);
13085 e_conv = DecodeError_clone(&e_conv);
13086 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13087 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
13088 return (uint64_t)ret_conv;
13091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13092 if ((_res & 1) != 0) return;
13093 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
13095 CResult_PongDecodeErrorZ_free(_res_conv);
13098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13099 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13100 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13101 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13102 return (uint64_t)ret_conv;
13105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13106 LDKUnsignedChannelAnnouncement o_conv;
13107 o_conv.inner = (void*)(o & (~1));
13108 o_conv.is_owned = (o & 1) || (o == 0);
13109 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13110 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13111 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13112 return (uint64_t)ret_conv;
13115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13116 LDKDecodeError e_conv;
13117 e_conv.inner = (void*)(e & (~1));
13118 e_conv.is_owned = (e & 1) || (e == 0);
13119 e_conv = DecodeError_clone(&e_conv);
13120 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13121 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13122 return (uint64_t)ret_conv;
13125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13126 if ((_res & 1) != 0) return;
13127 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13129 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13133 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13134 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13135 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13136 return (uint64_t)ret_conv;
13139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13140 LDKChannelAnnouncement o_conv;
13141 o_conv.inner = (void*)(o & (~1));
13142 o_conv.is_owned = (o & 1) || (o == 0);
13143 o_conv = ChannelAnnouncement_clone(&o_conv);
13144 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13145 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13146 return (uint64_t)ret_conv;
13149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13150 LDKDecodeError e_conv;
13151 e_conv.inner = (void*)(e & (~1));
13152 e_conv.is_owned = (e & 1) || (e == 0);
13153 e_conv = DecodeError_clone(&e_conv);
13154 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13155 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
13156 return (uint64_t)ret_conv;
13159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13160 if ((_res & 1) != 0) return;
13161 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13163 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
13166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13167 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13168 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13169 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13170 return (uint64_t)ret_conv;
13173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13174 LDKUnsignedChannelUpdate o_conv;
13175 o_conv.inner = (void*)(o & (~1));
13176 o_conv.is_owned = (o & 1) || (o == 0);
13177 o_conv = UnsignedChannelUpdate_clone(&o_conv);
13178 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13179 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
13180 return (uint64_t)ret_conv;
13183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13184 LDKDecodeError e_conv;
13185 e_conv.inner = (void*)(e & (~1));
13186 e_conv.is_owned = (e & 1) || (e == 0);
13187 e_conv = DecodeError_clone(&e_conv);
13188 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13189 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
13190 return (uint64_t)ret_conv;
13193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13194 if ((_res & 1) != 0) return;
13195 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13197 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
13200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13201 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
13202 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13203 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
13204 return (uint64_t)ret_conv;
13207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13208 LDKChannelUpdate o_conv;
13209 o_conv.inner = (void*)(o & (~1));
13210 o_conv.is_owned = (o & 1) || (o == 0);
13211 o_conv = ChannelUpdate_clone(&o_conv);
13212 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13213 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
13214 return (uint64_t)ret_conv;
13217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13218 LDKDecodeError e_conv;
13219 e_conv.inner = (void*)(e & (~1));
13220 e_conv.is_owned = (e & 1) || (e == 0);
13221 e_conv = DecodeError_clone(&e_conv);
13222 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13223 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
13224 return (uint64_t)ret_conv;
13227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13228 if ((_res & 1) != 0) return;
13229 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13231 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
13234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13235 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
13236 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13237 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
13238 return (uint64_t)ret_conv;
13241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13242 LDKErrorMessage o_conv;
13243 o_conv.inner = (void*)(o & (~1));
13244 o_conv.is_owned = (o & 1) || (o == 0);
13245 o_conv = ErrorMessage_clone(&o_conv);
13246 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13247 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
13248 return (uint64_t)ret_conv;
13251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13252 LDKDecodeError e_conv;
13253 e_conv.inner = (void*)(e & (~1));
13254 e_conv.is_owned = (e & 1) || (e == 0);
13255 e_conv = DecodeError_clone(&e_conv);
13256 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13257 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
13258 return (uint64_t)ret_conv;
13261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13262 if ((_res & 1) != 0) return;
13263 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
13265 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
13268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13269 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
13270 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13271 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
13272 return (uint64_t)ret_conv;
13275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13276 LDKUnsignedNodeAnnouncement o_conv;
13277 o_conv.inner = (void*)(o & (~1));
13278 o_conv.is_owned = (o & 1) || (o == 0);
13279 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
13280 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13281 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
13282 return (uint64_t)ret_conv;
13285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13286 LDKDecodeError e_conv;
13287 e_conv.inner = (void*)(e & (~1));
13288 e_conv.is_owned = (e & 1) || (e == 0);
13289 e_conv = DecodeError_clone(&e_conv);
13290 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13291 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
13292 return (uint64_t)ret_conv;
13295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13296 if ((_res & 1) != 0) return;
13297 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13299 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
13302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13303 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
13304 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13305 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
13306 return (uint64_t)ret_conv;
13309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13310 LDKNodeAnnouncement o_conv;
13311 o_conv.inner = (void*)(o & (~1));
13312 o_conv.is_owned = (o & 1) || (o == 0);
13313 o_conv = NodeAnnouncement_clone(&o_conv);
13314 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13315 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
13316 return (uint64_t)ret_conv;
13319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13320 LDKDecodeError e_conv;
13321 e_conv.inner = (void*)(e & (~1));
13322 e_conv.is_owned = (e & 1) || (e == 0);
13323 e_conv = DecodeError_clone(&e_conv);
13324 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13325 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
13326 return (uint64_t)ret_conv;
13329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13330 if ((_res & 1) != 0) return;
13331 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13333 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
13336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13337 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
13338 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13339 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
13340 return (uint64_t)ret_conv;
13343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13344 LDKQueryShortChannelIds o_conv;
13345 o_conv.inner = (void*)(o & (~1));
13346 o_conv.is_owned = (o & 1) || (o == 0);
13347 o_conv = QueryShortChannelIds_clone(&o_conv);
13348 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13349 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
13350 return (uint64_t)ret_conv;
13353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13354 LDKDecodeError e_conv;
13355 e_conv.inner = (void*)(e & (~1));
13356 e_conv.is_owned = (e & 1) || (e == 0);
13357 e_conv = DecodeError_clone(&e_conv);
13358 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13359 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
13360 return (uint64_t)ret_conv;
13363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13364 if ((_res & 1) != 0) return;
13365 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
13367 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13371 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13372 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13373 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13374 return (uint64_t)ret_conv;
13377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13378 LDKReplyShortChannelIdsEnd o_conv;
13379 o_conv.inner = (void*)(o & (~1));
13380 o_conv.is_owned = (o & 1) || (o == 0);
13381 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13382 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13383 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13384 return (uint64_t)ret_conv;
13387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_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_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13393 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13394 return (uint64_t)ret_conv;
13397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13398 if ((_res & 1) != 0) return;
13399 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
13401 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13405 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13406 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13407 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13408 return (uint64_t)ret_conv;
13411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13412 LDKQueryChannelRange o_conv;
13413 o_conv.inner = (void*)(o & (~1));
13414 o_conv.is_owned = (o & 1) || (o == 0);
13415 o_conv = QueryChannelRange_clone(&o_conv);
13416 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13417 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13418 return (uint64_t)ret_conv;
13421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13422 LDKDecodeError e_conv;
13423 e_conv.inner = (void*)(e & (~1));
13424 e_conv.is_owned = (e & 1) || (e == 0);
13425 e_conv = DecodeError_clone(&e_conv);
13426 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13427 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13428 return (uint64_t)ret_conv;
13431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13432 if ((_res & 1) != 0) return;
13433 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13435 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13439 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13440 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13441 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13442 return (uint64_t)ret_conv;
13445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13446 LDKReplyChannelRange o_conv;
13447 o_conv.inner = (void*)(o & (~1));
13448 o_conv.is_owned = (o & 1) || (o == 0);
13449 o_conv = ReplyChannelRange_clone(&o_conv);
13450 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13451 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13452 return (uint64_t)ret_conv;
13455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13456 LDKDecodeError e_conv;
13457 e_conv.inner = (void*)(e & (~1));
13458 e_conv.is_owned = (e & 1) || (e == 0);
13459 e_conv = DecodeError_clone(&e_conv);
13460 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13461 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13462 return (uint64_t)ret_conv;
13465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13466 if ((_res & 1) != 0) return;
13467 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13469 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13473 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13474 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13475 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13476 return (uint64_t)ret_conv;
13479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13480 LDKGossipTimestampFilter o_conv;
13481 o_conv.inner = (void*)(o & (~1));
13482 o_conv.is_owned = (o & 1) || (o == 0);
13483 o_conv = GossipTimestampFilter_clone(&o_conv);
13484 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13485 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13486 return (uint64_t)ret_conv;
13489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13490 LDKDecodeError e_conv;
13491 e_conv.inner = (void*)(e & (~1));
13492 e_conv.is_owned = (e & 1) || (e == 0);
13493 e_conv = DecodeError_clone(&e_conv);
13494 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13495 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13496 return (uint64_t)ret_conv;
13499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13500 if ((_res & 1) != 0) return;
13501 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
13503 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13507 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13508 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13509 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13510 return (uint64_t)ret_conv;
13513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13515 o_conv.inner = (void*)(o & (~1));
13516 o_conv.is_owned = (o & 1) || (o == 0);
13517 o_conv = Invoice_clone(&o_conv);
13518 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13519 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13520 return (uint64_t)ret_conv;
13523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13524 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
13525 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13526 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13527 return (uint64_t)ret_conv;
13530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13531 if ((_res & 1) != 0) return;
13532 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
13534 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13538 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13539 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13540 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13541 return (uint64_t)ret_conv;
13544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13545 if ((this_ptr & 1) != 0) return;
13546 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
13547 FREE((void*)this_ptr);
13548 PaymentPurpose_free(this_ptr_conv);
13551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13552 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
13553 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13554 *ret_copy = PaymentPurpose_clone(orig_conv);
13555 uint64_t ret_ref = (uint64_t)ret_copy;
13559 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) {
13560 LDKThirtyTwoBytes payment_preimage_ref;
13561 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13562 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13563 LDKThirtyTwoBytes payment_secret_ref;
13564 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
13565 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
13566 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13567 *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
13568 uint64_t ret_ref = (uint64_t)ret_copy;
13572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
13573 LDKThirtyTwoBytes a_ref;
13574 CHECK((*env)->GetArrayLength(env, a) == 32);
13575 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
13576 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13577 *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
13578 uint64_t ret_ref = (uint64_t)ret_copy;
13582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13583 if ((this_ptr & 1) != 0) return;
13584 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
13585 FREE((void*)this_ptr);
13586 Event_free(this_ptr_conv);
13589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13590 LDKEvent* orig_conv = (LDKEvent*)orig;
13591 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13592 *ret_copy = Event_clone(orig_conv);
13593 uint64_t ret_ref = (uint64_t)ret_copy;
13597 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) {
13598 LDKThirtyTwoBytes temporary_channel_id_ref;
13599 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
13600 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data);
13601 LDKCVec_u8Z output_script_ref;
13602 output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
13603 output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
13604 (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
13605 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13606 *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
13607 uint64_t ret_ref = (uint64_t)ret_copy;
13611 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) {
13612 LDKThirtyTwoBytes payment_hash_ref;
13613 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13614 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13615 LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
13616 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13617 *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
13618 uint64_t ret_ref = (uint64_t)ret_copy;
13622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) {
13623 LDKThirtyTwoBytes payment_preimage_ref;
13624 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
13625 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
13626 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13627 *ret_copy = Event_payment_sent(payment_preimage_ref);
13628 uint64_t ret_ref = (uint64_t)ret_copy;
13632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest) {
13633 LDKThirtyTwoBytes payment_hash_ref;
13634 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
13635 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
13636 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13637 *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
13638 uint64_t ret_ref = (uint64_t)ret_copy;
13642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
13643 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13644 *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
13645 uint64_t ret_ref = (uint64_t)ret_copy;
13649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs) {
13650 LDKCVec_SpendableOutputDescriptorZ outputs_constr;
13651 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
13652 if (outputs_constr.datalen > 0)
13653 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13655 outputs_constr.data = NULL;
13656 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
13657 for (size_t b = 0; b < outputs_constr.datalen; b++) {
13658 int64_t outputs_conv_27 = outputs_vals[b];
13659 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1);
13660 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)outputs_conv_27) & ~1));
13661 outputs_constr.data[b] = outputs_conv_27_conv;
13663 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
13664 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13665 *ret_copy = Event_spendable_outputs(outputs_constr);
13666 uint64_t ret_ref = (uint64_t)ret_copy;
13670 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) {
13671 LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
13672 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13673 *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
13674 uint64_t ret_ref = (uint64_t)ret_copy;
13678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
13679 LDKEvent* obj_conv = (LDKEvent*)obj;
13680 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13681 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13682 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13683 CVec_u8Z_free(ret_var);
13687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13688 if ((this_ptr & 1) != 0) return;
13689 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
13690 FREE((void*)this_ptr);
13691 MessageSendEvent_free(this_ptr_conv);
13694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13695 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13696 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13697 *ret_copy = MessageSendEvent_clone(orig_conv);
13698 uint64_t ret_ref = (uint64_t)ret_copy;
13702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13703 LDKPublicKey node_id_ref;
13704 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13705 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13706 LDKAcceptChannel msg_conv;
13707 msg_conv.inner = (void*)(msg & (~1));
13708 msg_conv.is_owned = (msg & 1) || (msg == 0);
13709 msg_conv = AcceptChannel_clone(&msg_conv);
13710 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13711 *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
13712 uint64_t ret_ref = (uint64_t)ret_copy;
13716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13717 LDKPublicKey node_id_ref;
13718 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13719 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13720 LDKOpenChannel msg_conv;
13721 msg_conv.inner = (void*)(msg & (~1));
13722 msg_conv.is_owned = (msg & 1) || (msg == 0);
13723 msg_conv = OpenChannel_clone(&msg_conv);
13724 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13725 *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
13726 uint64_t ret_ref = (uint64_t)ret_copy;
13730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13731 LDKPublicKey node_id_ref;
13732 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13733 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13734 LDKFundingCreated msg_conv;
13735 msg_conv.inner = (void*)(msg & (~1));
13736 msg_conv.is_owned = (msg & 1) || (msg == 0);
13737 msg_conv = FundingCreated_clone(&msg_conv);
13738 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13739 *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
13740 uint64_t ret_ref = (uint64_t)ret_copy;
13744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13745 LDKPublicKey node_id_ref;
13746 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13747 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13748 LDKFundingSigned msg_conv;
13749 msg_conv.inner = (void*)(msg & (~1));
13750 msg_conv.is_owned = (msg & 1) || (msg == 0);
13751 msg_conv = FundingSigned_clone(&msg_conv);
13752 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13753 *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
13754 uint64_t ret_ref = (uint64_t)ret_copy;
13758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13759 LDKPublicKey node_id_ref;
13760 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13761 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13762 LDKFundingLocked msg_conv;
13763 msg_conv.inner = (void*)(msg & (~1));
13764 msg_conv.is_owned = (msg & 1) || (msg == 0);
13765 msg_conv = FundingLocked_clone(&msg_conv);
13766 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13767 *ret_copy = MessageSendEvent_send_funding_locked(node_id_ref, msg_conv);
13768 uint64_t ret_ref = (uint64_t)ret_copy;
13772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13773 LDKPublicKey node_id_ref;
13774 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13775 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13776 LDKAnnouncementSignatures msg_conv;
13777 msg_conv.inner = (void*)(msg & (~1));
13778 msg_conv.is_owned = (msg & 1) || (msg == 0);
13779 msg_conv = AnnouncementSignatures_clone(&msg_conv);
13780 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13781 *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
13782 uint64_t ret_ref = (uint64_t)ret_copy;
13786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
13787 LDKPublicKey node_id_ref;
13788 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13789 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13790 LDKCommitmentUpdate updates_conv;
13791 updates_conv.inner = (void*)(updates & (~1));
13792 updates_conv.is_owned = (updates & 1) || (updates == 0);
13793 updates_conv = CommitmentUpdate_clone(&updates_conv);
13794 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13795 *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
13796 uint64_t ret_ref = (uint64_t)ret_copy;
13800 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) {
13801 LDKPublicKey node_id_ref;
13802 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13803 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13804 LDKRevokeAndACK msg_conv;
13805 msg_conv.inner = (void*)(msg & (~1));
13806 msg_conv.is_owned = (msg & 1) || (msg == 0);
13807 msg_conv = RevokeAndACK_clone(&msg_conv);
13808 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13809 *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
13810 uint64_t ret_ref = (uint64_t)ret_copy;
13814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13815 LDKPublicKey node_id_ref;
13816 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13817 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13818 LDKClosingSigned msg_conv;
13819 msg_conv.inner = (void*)(msg & (~1));
13820 msg_conv.is_owned = (msg & 1) || (msg == 0);
13821 msg_conv = ClosingSigned_clone(&msg_conv);
13822 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13823 *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
13824 uint64_t ret_ref = (uint64_t)ret_copy;
13828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13829 LDKPublicKey node_id_ref;
13830 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13831 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13832 LDKShutdown msg_conv;
13833 msg_conv.inner = (void*)(msg & (~1));
13834 msg_conv.is_owned = (msg & 1) || (msg == 0);
13835 msg_conv = Shutdown_clone(&msg_conv);
13836 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13837 *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
13838 uint64_t ret_ref = (uint64_t)ret_copy;
13842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13843 LDKPublicKey node_id_ref;
13844 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13845 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13846 LDKChannelReestablish msg_conv;
13847 msg_conv.inner = (void*)(msg & (~1));
13848 msg_conv.is_owned = (msg & 1) || (msg == 0);
13849 msg_conv = ChannelReestablish_clone(&msg_conv);
13850 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13851 *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
13852 uint64_t ret_ref = (uint64_t)ret_copy;
13856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
13857 LDKChannelAnnouncement msg_conv;
13858 msg_conv.inner = (void*)(msg & (~1));
13859 msg_conv.is_owned = (msg & 1) || (msg == 0);
13860 msg_conv = ChannelAnnouncement_clone(&msg_conv);
13861 LDKChannelUpdate update_msg_conv;
13862 update_msg_conv.inner = (void*)(update_msg & (~1));
13863 update_msg_conv.is_owned = (update_msg & 1) || (update_msg == 0);
13864 update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
13865 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13866 *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
13867 uint64_t ret_ref = (uint64_t)ret_copy;
13871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
13872 LDKNodeAnnouncement msg_conv;
13873 msg_conv.inner = (void*)(msg & (~1));
13874 msg_conv.is_owned = (msg & 1) || (msg == 0);
13875 msg_conv = NodeAnnouncement_clone(&msg_conv);
13876 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13877 *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
13878 uint64_t ret_ref = (uint64_t)ret_copy;
13882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
13883 LDKChannelUpdate msg_conv;
13884 msg_conv.inner = (void*)(msg & (~1));
13885 msg_conv.is_owned = (msg & 1) || (msg == 0);
13886 msg_conv = ChannelUpdate_clone(&msg_conv);
13887 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13888 *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
13889 uint64_t ret_ref = (uint64_t)ret_copy;
13893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
13894 LDKPublicKey node_id_ref;
13895 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13896 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13897 LDKChannelUpdate msg_conv;
13898 msg_conv.inner = (void*)(msg & (~1));
13899 msg_conv.is_owned = (msg & 1) || (msg == 0);
13900 msg_conv = ChannelUpdate_clone(&msg_conv);
13901 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13902 *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
13903 uint64_t ret_ref = (uint64_t)ret_copy;
13907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
13908 LDKPublicKey node_id_ref;
13909 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13910 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13911 LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
13912 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13913 *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
13914 uint64_t ret_ref = (uint64_t)ret_copy;
13918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update(JNIEnv *env, jclass clz, int64_t update) {
13919 LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
13920 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13921 *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
13922 uint64_t ret_ref = (uint64_t)ret_copy;
13926 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) {
13927 LDKPublicKey node_id_ref;
13928 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13929 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13930 LDKQueryChannelRange msg_conv;
13931 msg_conv.inner = (void*)(msg & (~1));
13932 msg_conv.is_owned = (msg & 1) || (msg == 0);
13933 msg_conv = QueryChannelRange_clone(&msg_conv);
13934 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13935 *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
13936 uint64_t ret_ref = (uint64_t)ret_copy;
13940 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) {
13941 LDKPublicKey node_id_ref;
13942 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13943 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13944 LDKQueryShortChannelIds msg_conv;
13945 msg_conv.inner = (void*)(msg & (~1));
13946 msg_conv.is_owned = (msg & 1) || (msg == 0);
13947 msg_conv = QueryShortChannelIds_clone(&msg_conv);
13948 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13949 *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
13950 uint64_t ret_ref = (uint64_t)ret_copy;
13954 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) {
13955 LDKPublicKey node_id_ref;
13956 CHECK((*env)->GetArrayLength(env, node_id) == 33);
13957 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
13958 LDKReplyChannelRange msg_conv;
13959 msg_conv.inner = (void*)(msg & (~1));
13960 msg_conv.is_owned = (msg & 1) || (msg == 0);
13961 msg_conv = ReplyChannelRange_clone(&msg_conv);
13962 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13963 *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
13964 uint64_t ret_ref = (uint64_t)ret_copy;
13968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13969 if ((this_ptr & 1) != 0) return;
13970 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
13971 FREE((void*)this_ptr);
13972 MessageSendEventsProvider_free(this_ptr_conv);
13975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13976 if ((this_ptr & 1) != 0) return;
13977 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
13978 FREE((void*)this_ptr);
13979 EventsProvider_free(this_ptr_conv);
13982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13983 if ((this_ptr & 1) != 0) return;
13984 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
13985 FREE((void*)this_ptr);
13986 EventHandler_free(this_ptr_conv);
13989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13990 if ((this_ptr & 1) != 0) return;
13991 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
13992 FREE((void*)this_ptr);
13993 APIError_free(this_ptr_conv);
13996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13997 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13998 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13999 *ret_copy = APIError_clone(orig_conv);
14000 uint64_t ret_ref = (uint64_t)ret_copy;
14004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
14005 LDKStr err_conv = java_to_owned_str(env, err);
14006 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14007 *ret_copy = APIError_apimisuse_error(err_conv);
14008 uint64_t ret_ref = (uint64_t)ret_copy;
14012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
14013 LDKStr err_conv = java_to_owned_str(env, err);
14014 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14015 *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
14016 uint64_t ret_ref = (uint64_t)ret_copy;
14020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1route_1error(JNIEnv *env, jclass clz, jstring err) {
14021 LDKStr err_conv = java_to_owned_str(env, err);
14022 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14023 *ret_copy = APIError_route_error(err_conv);
14024 uint64_t ret_ref = (uint64_t)ret_copy;
14028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
14029 LDKStr err_conv = java_to_owned_str(env, err);
14030 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14031 *ret_copy = APIError_channel_unavailable(err_conv);
14032 uint64_t ret_ref = (uint64_t)ret_copy;
14036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed(JNIEnv *env, jclass clz) {
14037 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14038 *ret_copy = APIError_monitor_update_failed();
14039 uint64_t ret_ref = (uint64_t)ret_copy;
14043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
14044 LDKShutdownScript script_conv;
14045 script_conv.inner = (void*)(script & (~1));
14046 script_conv.is_owned = (script & 1) || (script == 0);
14047 script_conv = ShutdownScript_clone(&script_conv);
14048 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
14049 *ret_copy = APIError_incompatible_shutdown_script(script_conv);
14050 uint64_t ret_ref = (uint64_t)ret_copy;
14054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
14055 LDKu8slice msg_ref;
14056 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14057 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14058 unsigned char sk_arr[32];
14059 CHECK((*env)->GetArrayLength(env, sk) == 32);
14060 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
14061 unsigned char (*sk_ref)[32] = &sk_arr;
14062 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
14063 *ret_conv = sign(msg_ref, sk_ref);
14064 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14065 return (uint64_t)ret_conv;
14068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
14069 LDKu8slice msg_ref;
14070 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14071 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14072 LDKStr sig_conv = java_to_owned_str(env, sig);
14073 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
14074 *ret_conv = recover_pk(msg_ref, sig_conv);
14075 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14076 return (uint64_t)ret_conv;
14079 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
14080 LDKu8slice msg_ref;
14081 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
14082 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
14083 LDKStr sig_conv = java_to_owned_str(env, sig);
14084 LDKPublicKey pk_ref;
14085 CHECK((*env)->GetArrayLength(env, pk) == 33);
14086 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
14087 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
14088 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
14092 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14093 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
14094 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
14098 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
14099 jclass ret_conv = LDKLevel_to_java(env, Level_trace());
14103 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
14104 jclass ret_conv = LDKLevel_to_java(env, Level_debug());
14108 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
14109 jclass ret_conv = LDKLevel_to_java(env, Level_info());
14113 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
14114 jclass ret_conv = LDKLevel_to_java(env, Level_warn());
14118 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
14119 jclass ret_conv = LDKLevel_to_java(env, Level_error());
14123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14124 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
14125 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
14126 jboolean ret_val = Level_eq(a_conv, b_conv);
14130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
14131 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
14132 int64_t ret_val = Level_hash(o_conv);
14136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
14137 jclass ret_conv = LDKLevel_to_java(env, Level_max());
14141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14142 if ((this_ptr & 1) != 0) return;
14143 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
14144 FREE((void*)this_ptr);
14145 Logger_free(this_ptr_conv);
14148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14149 LDKChannelHandshakeConfig this_obj_conv;
14150 this_obj_conv.inner = (void*)(this_obj & (~1));
14151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14152 ChannelHandshakeConfig_free(this_obj_conv);
14155 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
14156 LDKChannelHandshakeConfig this_ptr_conv;
14157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14158 this_ptr_conv.is_owned = false;
14159 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
14163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14164 LDKChannelHandshakeConfig this_ptr_conv;
14165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14166 this_ptr_conv.is_owned = false;
14167 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
14170 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14171 LDKChannelHandshakeConfig this_ptr_conv;
14172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14173 this_ptr_conv.is_owned = false;
14174 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
14178 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) {
14179 LDKChannelHandshakeConfig this_ptr_conv;
14180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14181 this_ptr_conv.is_owned = false;
14182 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
14185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14186 LDKChannelHandshakeConfig this_ptr_conv;
14187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14188 this_ptr_conv.is_owned = false;
14189 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
14193 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) {
14194 LDKChannelHandshakeConfig this_ptr_conv;
14195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14196 this_ptr_conv.is_owned = false;
14197 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
14200 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) {
14201 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
14202 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14203 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14204 uint64_t ret_ref = (uint64_t)ret_var.inner;
14205 if (ret_var.is_owned) {
14211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14212 LDKChannelHandshakeConfig orig_conv;
14213 orig_conv.inner = (void*)(orig & (~1));
14214 orig_conv.is_owned = false;
14215 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
14216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14218 uint64_t ret_ref = (uint64_t)ret_var.inner;
14219 if (ret_var.is_owned) {
14225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
14226 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
14227 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14228 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14229 uint64_t ret_ref = (uint64_t)ret_var.inner;
14230 if (ret_var.is_owned) {
14236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14237 LDKChannelHandshakeLimits this_obj_conv;
14238 this_obj_conv.inner = (void*)(this_obj & (~1));
14239 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14240 ChannelHandshakeLimits_free(this_obj_conv);
14243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14244 LDKChannelHandshakeLimits this_ptr_conv;
14245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14246 this_ptr_conv.is_owned = false;
14247 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
14251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14252 LDKChannelHandshakeLimits this_ptr_conv;
14253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14254 this_ptr_conv.is_owned = false;
14255 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
14258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14259 LDKChannelHandshakeLimits this_ptr_conv;
14260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14261 this_ptr_conv.is_owned = false;
14262 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
14266 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) {
14267 LDKChannelHandshakeLimits this_ptr_conv;
14268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14269 this_ptr_conv.is_owned = false;
14270 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
14273 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) {
14274 LDKChannelHandshakeLimits this_ptr_conv;
14275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14276 this_ptr_conv.is_owned = false;
14277 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
14281 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) {
14282 LDKChannelHandshakeLimits this_ptr_conv;
14283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14284 this_ptr_conv.is_owned = false;
14285 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
14288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14289 LDKChannelHandshakeLimits this_ptr_conv;
14290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14291 this_ptr_conv.is_owned = false;
14292 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
14296 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) {
14297 LDKChannelHandshakeLimits this_ptr_conv;
14298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14299 this_ptr_conv.is_owned = false;
14300 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
14303 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
14304 LDKChannelHandshakeLimits this_ptr_conv;
14305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14306 this_ptr_conv.is_owned = false;
14307 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
14311 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) {
14312 LDKChannelHandshakeLimits this_ptr_conv;
14313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14314 this_ptr_conv.is_owned = false;
14315 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
14318 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
14319 LDKChannelHandshakeLimits this_ptr_conv;
14320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14321 this_ptr_conv.is_owned = false;
14322 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
14326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14327 LDKChannelHandshakeLimits this_ptr_conv;
14328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14329 this_ptr_conv.is_owned = false;
14330 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
14333 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
14334 LDKChannelHandshakeLimits this_ptr_conv;
14335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14336 this_ptr_conv.is_owned = false;
14337 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
14341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14342 LDKChannelHandshakeLimits this_ptr_conv;
14343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14344 this_ptr_conv.is_owned = false;
14345 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
14348 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14349 LDKChannelHandshakeLimits this_ptr_conv;
14350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14351 this_ptr_conv.is_owned = false;
14352 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
14356 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) {
14357 LDKChannelHandshakeLimits this_ptr_conv;
14358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14359 this_ptr_conv.is_owned = false;
14360 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
14363 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) {
14364 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);
14365 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14366 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14367 uint64_t ret_ref = (uint64_t)ret_var.inner;
14368 if (ret_var.is_owned) {
14374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14375 LDKChannelHandshakeLimits orig_conv;
14376 orig_conv.inner = (void*)(orig & (~1));
14377 orig_conv.is_owned = false;
14378 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
14379 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14380 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14381 uint64_t ret_ref = (uint64_t)ret_var.inner;
14382 if (ret_var.is_owned) {
14388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
14389 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
14390 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14391 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14392 uint64_t ret_ref = (uint64_t)ret_var.inner;
14393 if (ret_var.is_owned) {
14399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14400 LDKChannelConfig this_obj_conv;
14401 this_obj_conv.inner = (void*)(this_obj & (~1));
14402 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14403 ChannelConfig_free(this_obj_conv);
14406 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
14407 LDKChannelConfig this_ptr_conv;
14408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14409 this_ptr_conv.is_owned = false;
14410 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
14414 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) {
14415 LDKChannelConfig this_ptr_conv;
14416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14417 this_ptr_conv.is_owned = false;
14418 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
14421 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14422 LDKChannelConfig this_ptr_conv;
14423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14424 this_ptr_conv.is_owned = false;
14425 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
14429 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) {
14430 LDKChannelConfig this_ptr_conv;
14431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14432 this_ptr_conv.is_owned = false;
14433 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
14436 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
14437 LDKChannelConfig this_ptr_conv;
14438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14439 this_ptr_conv.is_owned = false;
14440 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
14444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14445 LDKChannelConfig this_ptr_conv;
14446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14447 this_ptr_conv.is_owned = false;
14448 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
14451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
14452 LDKChannelConfig this_ptr_conv;
14453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14454 this_ptr_conv.is_owned = false;
14455 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
14459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14460 LDKChannelConfig this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
14466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14467 LDKChannelConfig this_ptr_conv;
14468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14469 this_ptr_conv.is_owned = false;
14470 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
14474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14475 LDKChannelConfig this_ptr_conv;
14476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14477 this_ptr_conv.is_owned = false;
14478 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
14481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14482 LDKChannelConfig this_ptr_conv;
14483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14484 this_ptr_conv.is_owned = false;
14485 int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
14489 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) {
14490 LDKChannelConfig this_ptr_conv;
14491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14492 this_ptr_conv.is_owned = false;
14493 ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
14496 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) {
14497 LDKChannelConfig this_ptr_conv;
14498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14499 this_ptr_conv.is_owned = false;
14500 int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
14504 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) {
14505 LDKChannelConfig this_ptr_conv;
14506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14507 this_ptr_conv.is_owned = false;
14508 ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
14511 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) {
14512 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);
14513 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14514 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14515 uint64_t ret_ref = (uint64_t)ret_var.inner;
14516 if (ret_var.is_owned) {
14522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14523 LDKChannelConfig orig_conv;
14524 orig_conv.inner = (void*)(orig & (~1));
14525 orig_conv.is_owned = false;
14526 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
14527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14529 uint64_t ret_ref = (uint64_t)ret_var.inner;
14530 if (ret_var.is_owned) {
14536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
14537 LDKChannelConfig ret_var = ChannelConfig_default();
14538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14540 uint64_t ret_ref = (uint64_t)ret_var.inner;
14541 if (ret_var.is_owned) {
14547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
14548 LDKChannelConfig obj_conv;
14549 obj_conv.inner = (void*)(obj & (~1));
14550 obj_conv.is_owned = false;
14551 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
14552 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14553 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14554 CVec_u8Z_free(ret_var);
14558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14559 LDKu8slice ser_ref;
14560 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14561 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14562 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
14563 *ret_conv = ChannelConfig_read(ser_ref);
14564 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14565 return (uint64_t)ret_conv;
14568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14569 LDKUserConfig this_obj_conv;
14570 this_obj_conv.inner = (void*)(this_obj & (~1));
14571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14572 UserConfig_free(this_obj_conv);
14575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
14576 LDKUserConfig this_ptr_conv;
14577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14578 this_ptr_conv.is_owned = false;
14579 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
14580 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14581 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14582 uint64_t ret_ref = (uint64_t)ret_var.inner;
14583 if (ret_var.is_owned) {
14589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14590 LDKUserConfig this_ptr_conv;
14591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14592 this_ptr_conv.is_owned = false;
14593 LDKChannelHandshakeConfig val_conv;
14594 val_conv.inner = (void*)(val & (~1));
14595 val_conv.is_owned = (val & 1) || (val == 0);
14596 val_conv = ChannelHandshakeConfig_clone(&val_conv);
14597 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
14600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
14601 LDKUserConfig this_ptr_conv;
14602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14603 this_ptr_conv.is_owned = false;
14604 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
14605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14607 uint64_t ret_ref = (uint64_t)ret_var.inner;
14608 if (ret_var.is_owned) {
14614 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) {
14615 LDKUserConfig this_ptr_conv;
14616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14617 this_ptr_conv.is_owned = false;
14618 LDKChannelHandshakeLimits val_conv;
14619 val_conv.inner = (void*)(val & (~1));
14620 val_conv.is_owned = (val & 1) || (val == 0);
14621 val_conv = ChannelHandshakeLimits_clone(&val_conv);
14622 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
14625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
14626 LDKUserConfig this_ptr_conv;
14627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14628 this_ptr_conv.is_owned = false;
14629 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
14630 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14631 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14632 uint64_t ret_ref = (uint64_t)ret_var.inner;
14633 if (ret_var.is_owned) {
14639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14640 LDKUserConfig this_ptr_conv;
14641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14642 this_ptr_conv.is_owned = false;
14643 LDKChannelConfig val_conv;
14644 val_conv.inner = (void*)(val & (~1));
14645 val_conv.is_owned = (val & 1) || (val == 0);
14646 val_conv = ChannelConfig_clone(&val_conv);
14647 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
14650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
14651 LDKUserConfig this_ptr_conv;
14652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14653 this_ptr_conv.is_owned = false;
14654 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
14658 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) {
14659 LDKUserConfig this_ptr_conv;
14660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14661 this_ptr_conv.is_owned = false;
14662 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
14665 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) {
14666 LDKChannelHandshakeConfig own_channel_config_arg_conv;
14667 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
14668 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
14669 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
14670 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
14671 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
14672 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
14673 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
14674 LDKChannelConfig channel_options_arg_conv;
14675 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
14676 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
14677 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
14678 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);
14679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14681 uint64_t ret_ref = (uint64_t)ret_var.inner;
14682 if (ret_var.is_owned) {
14688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14689 LDKUserConfig orig_conv;
14690 orig_conv.inner = (void*)(orig & (~1));
14691 orig_conv.is_owned = false;
14692 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
14693 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14694 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14695 uint64_t ret_ref = (uint64_t)ret_var.inner;
14696 if (ret_var.is_owned) {
14702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
14703 LDKUserConfig ret_var = UserConfig_default();
14704 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14705 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14706 uint64_t ret_ref = (uint64_t)ret_var.inner;
14707 if (ret_var.is_owned) {
14713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14714 LDKBestBlock this_obj_conv;
14715 this_obj_conv.inner = (void*)(this_obj & (~1));
14716 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14717 BestBlock_free(this_obj_conv);
14720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14721 LDKBestBlock orig_conv;
14722 orig_conv.inner = (void*)(orig & (~1));
14723 orig_conv.is_owned = false;
14724 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
14725 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14726 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14727 uint64_t ret_ref = (uint64_t)ret_var.inner;
14728 if (ret_var.is_owned) {
14734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
14735 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
14736 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
14737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14739 uint64_t ret_ref = (uint64_t)ret_var.inner;
14740 if (ret_var.is_owned) {
14746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
14747 LDKThirtyTwoBytes block_hash_ref;
14748 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
14749 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
14750 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
14751 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14752 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14753 uint64_t ret_ref = (uint64_t)ret_var.inner;
14754 if (ret_var.is_owned) {
14760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14761 LDKBestBlock this_arg_conv;
14762 this_arg_conv.inner = (void*)(this_arg & (~1));
14763 this_arg_conv.is_owned = false;
14764 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14765 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
14769 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
14770 LDKBestBlock this_arg_conv;
14771 this_arg_conv.inner = (void*)(this_arg & (~1));
14772 this_arg_conv.is_owned = false;
14773 int32_t ret_val = BestBlock_height(&this_arg_conv);
14777 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14778 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
14779 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
14783 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1chain(JNIEnv *env, jclass clz) {
14784 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_chain());
14788 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1unknown_1tx(JNIEnv *env, jclass clz) {
14789 jclass ret_conv = LDKAccessError_to_java(env, AccessError_unknown_tx());
14793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14794 if ((this_ptr & 1) != 0) return;
14795 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
14796 FREE((void*)this_ptr);
14797 Access_free(this_ptr_conv);
14800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14801 if ((this_ptr & 1) != 0) return;
14802 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
14803 FREE((void*)this_ptr);
14804 Listen_free(this_ptr_conv);
14807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14808 if ((this_ptr & 1) != 0) return;
14809 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
14810 FREE((void*)this_ptr);
14811 Confirm_free(this_ptr_conv);
14814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14815 if ((this_ptr & 1) != 0) return;
14816 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
14817 FREE((void*)this_ptr);
14818 Watch_free(this_ptr_conv);
14821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14822 if ((this_ptr & 1) != 0) return;
14823 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
14824 FREE((void*)this_ptr);
14825 Filter_free(this_ptr_conv);
14828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14829 LDKWatchedOutput this_obj_conv;
14830 this_obj_conv.inner = (void*)(this_obj & (~1));
14831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14832 WatchedOutput_free(this_obj_conv);
14835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14836 LDKWatchedOutput this_ptr_conv;
14837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14838 this_ptr_conv.is_owned = false;
14839 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14840 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
14844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14845 LDKWatchedOutput this_ptr_conv;
14846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14847 this_ptr_conv.is_owned = false;
14848 LDKThirtyTwoBytes val_ref;
14849 CHECK((*env)->GetArrayLength(env, val) == 32);
14850 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14851 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
14854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14855 LDKWatchedOutput this_ptr_conv;
14856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14857 this_ptr_conv.is_owned = false;
14858 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
14859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14861 uint64_t ret_ref = (uint64_t)ret_var.inner;
14862 if (ret_var.is_owned) {
14868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14869 LDKWatchedOutput this_ptr_conv;
14870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14871 this_ptr_conv.is_owned = false;
14872 LDKOutPoint val_conv;
14873 val_conv.inner = (void*)(val & (~1));
14874 val_conv.is_owned = (val & 1) || (val == 0);
14875 val_conv = OutPoint_clone(&val_conv);
14876 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
14879 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14880 LDKWatchedOutput this_ptr_conv;
14881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14882 this_ptr_conv.is_owned = false;
14883 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
14884 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14885 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14890 LDKWatchedOutput this_ptr_conv;
14891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14892 this_ptr_conv.is_owned = false;
14893 LDKCVec_u8Z val_ref;
14894 val_ref.datalen = (*env)->GetArrayLength(env, val);
14895 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14896 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
14897 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
14900 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) {
14901 LDKThirtyTwoBytes block_hash_arg_ref;
14902 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
14903 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
14904 LDKOutPoint outpoint_arg_conv;
14905 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14906 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14907 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14908 LDKCVec_u8Z script_pubkey_arg_ref;
14909 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
14910 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14911 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
14912 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
14913 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14914 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14915 uint64_t ret_ref = (uint64_t)ret_var.inner;
14916 if (ret_var.is_owned) {
14922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14923 LDKWatchedOutput orig_conv;
14924 orig_conv.inner = (void*)(orig & (~1));
14925 orig_conv.is_owned = false;
14926 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
14927 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14928 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14929 uint64_t ret_ref = (uint64_t)ret_var.inner;
14930 if (ret_var.is_owned) {
14936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
14937 LDKWatchedOutput o_conv;
14938 o_conv.inner = (void*)(o & (~1));
14939 o_conv.is_owned = false;
14940 int64_t ret_val = WatchedOutput_hash(&o_conv);
14944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14945 if ((this_ptr & 1) != 0) return;
14946 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
14947 FREE((void*)this_ptr);
14948 BroadcasterInterface_free(this_ptr_conv);
14951 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14952 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
14953 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
14957 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) {
14958 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background());
14962 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) {
14963 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal());
14967 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) {
14968 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority());
14972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14973 LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
14974 LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
14975 jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
14979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14980 if ((this_ptr & 1) != 0) return;
14981 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
14982 FREE((void*)this_ptr);
14983 FeeEstimator_free(this_ptr_conv);
14986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14987 LDKChainMonitor this_obj_conv;
14988 this_obj_conv.inner = (void*)(this_obj & (~1));
14989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14990 ChainMonitor_free(this_obj_conv);
14993 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) {
14994 LDKFilter *chain_source_conv_ptr = NULL;
14995 if (chain_source != 0) {
14996 LDKFilter chain_source_conv;
14997 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
14998 if (chain_source_conv.free == LDKFilter_JCalls_free) {
14999 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15000 LDKFilter_JCalls_cloned(&chain_source_conv);
15002 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
15003 *chain_source_conv_ptr = chain_source_conv;
15005 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15006 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15007 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15008 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15010 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15011 if (logger_conv.free == LDKLogger_JCalls_free) {
15012 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15013 LDKLogger_JCalls_cloned(&logger_conv);
15015 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
15016 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
15017 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15018 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
15020 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
15021 if (persister_conv.free == LDKPersist_JCalls_free) {
15022 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15023 LDKPersist_JCalls_cloned(&persister_conv);
15025 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
15026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15028 uint64_t ret_ref = (uint64_t)ret_var.inner;
15029 if (ret_var.is_owned) {
15035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15036 LDKChainMonitor this_arg_conv;
15037 this_arg_conv.inner = (void*)(this_arg & (~1));
15038 this_arg_conv.is_owned = false;
15039 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15040 *ret = ChainMonitor_as_Listen(&this_arg_conv);
15041 return (uint64_t)ret;
15044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15045 LDKChainMonitor this_arg_conv;
15046 this_arg_conv.inner = (void*)(this_arg & (~1));
15047 this_arg_conv.is_owned = false;
15048 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15049 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
15050 return (uint64_t)ret;
15053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
15054 LDKChainMonitor this_arg_conv;
15055 this_arg_conv.inner = (void*)(this_arg & (~1));
15056 this_arg_conv.is_owned = false;
15057 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
15058 *ret = ChainMonitor_as_Watch(&this_arg_conv);
15059 return (uint64_t)ret;
15062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15063 LDKChainMonitor this_arg_conv;
15064 this_arg_conv.inner = (void*)(this_arg & (~1));
15065 this_arg_conv.is_owned = false;
15066 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15067 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
15068 return (uint64_t)ret;
15071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15072 LDKChannelMonitorUpdate this_obj_conv;
15073 this_obj_conv.inner = (void*)(this_obj & (~1));
15074 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15075 ChannelMonitorUpdate_free(this_obj_conv);
15078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15079 LDKChannelMonitorUpdate this_ptr_conv;
15080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15081 this_ptr_conv.is_owned = false;
15082 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
15086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15087 LDKChannelMonitorUpdate this_ptr_conv;
15088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15089 this_ptr_conv.is_owned = false;
15090 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
15093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15094 LDKChannelMonitorUpdate orig_conv;
15095 orig_conv.inner = (void*)(orig & (~1));
15096 orig_conv.is_owned = false;
15097 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
15098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15100 uint64_t ret_ref = (uint64_t)ret_var.inner;
15101 if (ret_var.is_owned) {
15107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15108 LDKChannelMonitorUpdate obj_conv;
15109 obj_conv.inner = (void*)(obj & (~1));
15110 obj_conv.is_owned = false;
15111 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
15112 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15113 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15114 CVec_u8Z_free(ret_var);
15118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15119 LDKu8slice ser_ref;
15120 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15121 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15122 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
15123 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
15124 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15125 return (uint64_t)ret_conv;
15128 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15129 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
15130 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
15134 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) {
15135 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure());
15139 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) {
15140 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure());
15144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15145 LDKMonitorUpdateError this_obj_conv;
15146 this_obj_conv.inner = (void*)(this_obj & (~1));
15147 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15148 MonitorUpdateError_free(this_obj_conv);
15151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15152 LDKMonitorUpdateError orig_conv;
15153 orig_conv.inner = (void*)(orig & (~1));
15154 orig_conv.is_owned = false;
15155 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
15156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15158 uint64_t ret_ref = (uint64_t)ret_var.inner;
15159 if (ret_var.is_owned) {
15165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15166 if ((this_ptr & 1) != 0) return;
15167 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
15168 FREE((void*)this_ptr);
15169 MonitorEvent_free(this_ptr_conv);
15172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15173 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
15174 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15175 *ret_copy = MonitorEvent_clone(orig_conv);
15176 uint64_t ret_ref = (uint64_t)ret_copy;
15180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
15181 LDKHTLCUpdate a_conv;
15182 a_conv.inner = (void*)(a & (~1));
15183 a_conv.is_owned = (a & 1) || (a == 0);
15184 a_conv = HTLCUpdate_clone(&a_conv);
15185 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15186 *ret_copy = MonitorEvent_htlcevent(a_conv);
15187 uint64_t ret_ref = (uint64_t)ret_copy;
15191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted(JNIEnv *env, jclass clz, int64_t a) {
15192 LDKOutPoint a_conv;
15193 a_conv.inner = (void*)(a & (~1));
15194 a_conv.is_owned = (a & 1) || (a == 0);
15195 a_conv = OutPoint_clone(&a_conv);
15196 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15197 *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
15198 uint64_t ret_ref = (uint64_t)ret_copy;
15202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15203 LDKHTLCUpdate this_obj_conv;
15204 this_obj_conv.inner = (void*)(this_obj & (~1));
15205 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15206 HTLCUpdate_free(this_obj_conv);
15209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15210 LDKHTLCUpdate orig_conv;
15211 orig_conv.inner = (void*)(orig & (~1));
15212 orig_conv.is_owned = false;
15213 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
15214 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15215 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15216 uint64_t ret_ref = (uint64_t)ret_var.inner;
15217 if (ret_var.is_owned) {
15223 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
15224 LDKHTLCUpdate obj_conv;
15225 obj_conv.inner = (void*)(obj & (~1));
15226 obj_conv.is_owned = false;
15227 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
15228 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15229 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15230 CVec_u8Z_free(ret_var);
15234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15235 LDKu8slice ser_ref;
15236 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15237 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15238 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
15239 *ret_conv = HTLCUpdate_read(ser_ref);
15240 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15241 return (uint64_t)ret_conv;
15244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15245 LDKChannelMonitor this_obj_conv;
15246 this_obj_conv.inner = (void*)(this_obj & (~1));
15247 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15248 ChannelMonitor_free(this_obj_conv);
15251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15252 LDKChannelMonitor orig_conv;
15253 orig_conv.inner = (void*)(orig & (~1));
15254 orig_conv.is_owned = false;
15255 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
15256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15258 uint64_t ret_ref = (uint64_t)ret_var.inner;
15259 if (ret_var.is_owned) {
15265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15266 LDKChannelMonitor obj_conv;
15267 obj_conv.inner = (void*)(obj & (~1));
15268 obj_conv.is_owned = false;
15269 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
15270 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15271 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15272 CVec_u8Z_free(ret_var);
15276 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) {
15277 LDKChannelMonitor this_arg_conv;
15278 this_arg_conv.inner = (void*)(this_arg & (~1));
15279 this_arg_conv.is_owned = false;
15280 LDKChannelMonitorUpdate updates_conv;
15281 updates_conv.inner = (void*)(updates & (~1));
15282 updates_conv.is_owned = false;
15283 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15284 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15285 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
15286 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
15287 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
15288 return (uint64_t)ret_conv;
15291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15292 LDKChannelMonitor this_arg_conv;
15293 this_arg_conv.inner = (void*)(this_arg & (~1));
15294 this_arg_conv.is_owned = false;
15295 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
15299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
15300 LDKChannelMonitor this_arg_conv;
15301 this_arg_conv.inner = (void*)(this_arg & (~1));
15302 this_arg_conv.is_owned = false;
15303 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
15304 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
15305 return (uint64_t)ret_ref;
15308 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
15309 LDKChannelMonitor this_arg_conv;
15310 this_arg_conv.inner = (void*)(this_arg & (~1));
15311 this_arg_conv.is_owned = false;
15312 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
15313 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15314 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15315 for (size_t v = 0; v < ret_var.datalen; v++) {
15316 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
15317 *ret_conv_47_ref = ret_var.data[v];
15318 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
15320 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15321 FREE(ret_var.data);
15325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
15326 LDKChannelMonitor this_arg_conv;
15327 this_arg_conv.inner = (void*)(this_arg & (~1));
15328 this_arg_conv.is_owned = false;
15329 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
15330 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
15333 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15334 LDKChannelMonitor this_arg_conv;
15335 this_arg_conv.inner = (void*)(this_arg & (~1));
15336 this_arg_conv.is_owned = false;
15337 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
15338 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15339 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15340 for (size_t o = 0; o < ret_var.datalen; o++) {
15341 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
15342 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
15343 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
15344 ret_arr_ptr[o] = ret_conv_14_ref;
15346 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15347 FREE(ret_var.data);
15351 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
15352 LDKChannelMonitor this_arg_conv;
15353 this_arg_conv.inner = (void*)(this_arg & (~1));
15354 this_arg_conv.is_owned = false;
15355 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
15356 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15357 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15358 for (size_t h = 0; h < ret_var.datalen; h++) {
15359 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
15360 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
15361 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
15362 ret_arr_ptr[h] = ret_conv_7_ref;
15364 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15365 FREE(ret_var.data);
15369 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) {
15370 LDKChannelMonitor this_arg_conv;
15371 this_arg_conv.inner = (void*)(this_arg & (~1));
15372 this_arg_conv.is_owned = false;
15373 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
15374 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
15375 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
15377 for (size_t i = 0; i < ret_var.datalen; i++) {
15378 LDKTransaction ret_conv_8_var = ret_var.data[i];
15379 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
15380 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
15381 Transaction_free(ret_conv_8_var);
15382 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
15384 FREE(ret_var.data);
15388 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) {
15389 LDKChannelMonitor this_arg_conv;
15390 this_arg_conv.inner = (void*)(this_arg & (~1));
15391 this_arg_conv.is_owned = false;
15392 unsigned char header_arr[80];
15393 CHECK((*env)->GetArrayLength(env, header) == 80);
15394 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15395 unsigned char (*header_ref)[80] = &header_arr;
15396 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15397 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15398 if (txdata_constr.datalen > 0)
15399 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15401 txdata_constr.data = NULL;
15402 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15403 for (size_t y = 0; y < txdata_constr.datalen; y++) {
15404 int64_t txdata_conv_24 = txdata_vals[y];
15405 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
15406 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
15407 txdata_constr.data[y] = txdata_conv_24_conv;
15409 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15410 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15411 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15413 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15415 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15416 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15417 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15418 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15420 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15421 if (logger_conv.free == LDKLogger_JCalls_free) {
15422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15423 LDKLogger_JCalls_cloned(&logger_conv);
15425 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);
15426 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15427 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15428 for (size_t u = 0; u < ret_var.datalen; u++) {
15429 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15430 *ret_conv_46_ref = ret_var.data[u];
15431 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15433 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15434 FREE(ret_var.data);
15438 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) {
15439 LDKChannelMonitor this_arg_conv;
15440 this_arg_conv.inner = (void*)(this_arg & (~1));
15441 this_arg_conv.is_owned = false;
15442 unsigned char header_arr[80];
15443 CHECK((*env)->GetArrayLength(env, header) == 80);
15444 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15445 unsigned char (*header_ref)[80] = &header_arr;
15446 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15447 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15448 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15449 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15451 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15452 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15454 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15456 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15457 if (logger_conv.free == LDKLogger_JCalls_free) {
15458 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15459 LDKLogger_JCalls_cloned(&logger_conv);
15461 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15464 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) {
15465 LDKChannelMonitor this_arg_conv;
15466 this_arg_conv.inner = (void*)(this_arg & (~1));
15467 this_arg_conv.is_owned = false;
15468 unsigned char header_arr[80];
15469 CHECK((*env)->GetArrayLength(env, header) == 80);
15470 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15471 unsigned char (*header_ref)[80] = &header_arr;
15472 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
15473 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
15474 if (txdata_constr.datalen > 0)
15475 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
15477 txdata_constr.data = NULL;
15478 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
15479 for (size_t y = 0; y < txdata_constr.datalen; y++) {
15480 int64_t txdata_conv_24 = txdata_vals[y];
15481 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
15482 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
15483 txdata_constr.data[y] = txdata_conv_24_conv;
15485 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
15486 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15487 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15488 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15489 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15491 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15492 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15493 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15494 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15496 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15497 if (logger_conv.free == LDKLogger_JCalls_free) {
15498 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15499 LDKLogger_JCalls_cloned(&logger_conv);
15501 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);
15502 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15503 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15504 for (size_t u = 0; u < ret_var.datalen; u++) {
15505 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15506 *ret_conv_46_ref = ret_var.data[u];
15507 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15509 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15510 FREE(ret_var.data);
15514 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) {
15515 LDKChannelMonitor this_arg_conv;
15516 this_arg_conv.inner = (void*)(this_arg & (~1));
15517 this_arg_conv.is_owned = false;
15518 unsigned char txid_arr[32];
15519 CHECK((*env)->GetArrayLength(env, txid) == 32);
15520 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
15521 unsigned char (*txid_ref)[32] = &txid_arr;
15522 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15523 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15524 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15525 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15527 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15528 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15529 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15530 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15532 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15533 if (logger_conv.free == LDKLogger_JCalls_free) {
15534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15535 LDKLogger_JCalls_cloned(&logger_conv);
15537 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
15540 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) {
15541 LDKChannelMonitor this_arg_conv;
15542 this_arg_conv.inner = (void*)(this_arg & (~1));
15543 this_arg_conv.is_owned = false;
15544 unsigned char header_arr[80];
15545 CHECK((*env)->GetArrayLength(env, header) == 80);
15546 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
15547 unsigned char (*header_ref)[80] = &header_arr;
15548 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
15549 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15550 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15551 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
15553 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
15554 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
15555 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15556 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
15558 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15559 if (logger_conv.free == LDKLogger_JCalls_free) {
15560 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15561 LDKLogger_JCalls_cloned(&logger_conv);
15563 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
15564 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15565 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15566 for (size_t u = 0; u < ret_var.datalen; u++) {
15567 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
15568 *ret_conv_46_ref = ret_var.data[u];
15569 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
15571 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15572 FREE(ret_var.data);
15576 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
15577 LDKChannelMonitor this_arg_conv;
15578 this_arg_conv.inner = (void*)(this_arg & (~1));
15579 this_arg_conv.is_owned = false;
15580 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
15581 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
15583 for (size_t i = 0; i < ret_var.datalen; i++) {
15584 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
15585 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
15586 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
15588 FREE(ret_var.data);
15592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
15593 LDKChannelMonitor this_arg_conv;
15594 this_arg_conv.inner = (void*)(this_arg & (~1));
15595 this_arg_conv.is_owned = false;
15596 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
15597 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15598 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15599 uint64_t ret_ref = (uint64_t)ret_var.inner;
15600 if (ret_var.is_owned) {
15606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15607 if ((this_ptr & 1) != 0) return;
15608 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
15609 FREE((void*)this_ptr);
15610 Persist_free(this_ptr_conv);
15613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
15614 LDKu8slice ser_ref;
15615 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15616 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15617 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
15618 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
15619 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
15620 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15621 return (uint64_t)ret_conv;
15624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15625 LDKOutPoint this_obj_conv;
15626 this_obj_conv.inner = (void*)(this_obj & (~1));
15627 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15628 OutPoint_free(this_obj_conv);
15631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15632 LDKOutPoint this_ptr_conv;
15633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15634 this_ptr_conv.is_owned = false;
15635 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
15640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15641 LDKOutPoint this_ptr_conv;
15642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15643 this_ptr_conv.is_owned = false;
15644 LDKThirtyTwoBytes val_ref;
15645 CHECK((*env)->GetArrayLength(env, val) == 32);
15646 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15647 OutPoint_set_txid(&this_ptr_conv, val_ref);
15650 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
15651 LDKOutPoint this_ptr_conv;
15652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15653 this_ptr_conv.is_owned = false;
15654 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
15658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15659 LDKOutPoint this_ptr_conv;
15660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15661 this_ptr_conv.is_owned = false;
15662 OutPoint_set_index(&this_ptr_conv, val);
15665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
15666 LDKThirtyTwoBytes txid_arg_ref;
15667 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15668 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15669 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
15670 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15671 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15672 uint64_t ret_ref = (uint64_t)ret_var.inner;
15673 if (ret_var.is_owned) {
15679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15680 LDKOutPoint orig_conv;
15681 orig_conv.inner = (void*)(orig & (~1));
15682 orig_conv.is_owned = false;
15683 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
15684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15686 uint64_t ret_ref = (uint64_t)ret_var.inner;
15687 if (ret_var.is_owned) {
15693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15694 LDKOutPoint a_conv;
15695 a_conv.inner = (void*)(a & (~1));
15696 a_conv.is_owned = false;
15697 LDKOutPoint b_conv;
15698 b_conv.inner = (void*)(b & (~1));
15699 b_conv.is_owned = false;
15700 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
15704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
15705 LDKOutPoint o_conv;
15706 o_conv.inner = (void*)(o & (~1));
15707 o_conv.is_owned = false;
15708 int64_t ret_val = OutPoint_hash(&o_conv);
15712 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15713 LDKOutPoint this_arg_conv;
15714 this_arg_conv.inner = (void*)(this_arg & (~1));
15715 this_arg_conv.is_owned = false;
15716 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15717 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
15721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
15722 LDKOutPoint obj_conv;
15723 obj_conv.inner = (void*)(obj & (~1));
15724 obj_conv.is_owned = false;
15725 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
15726 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15727 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15728 CVec_u8Z_free(ret_var);
15732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15733 LDKu8slice ser_ref;
15734 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15735 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15736 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15737 *ret_conv = OutPoint_read(ser_ref);
15738 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15739 return (uint64_t)ret_conv;
15742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15743 LDKDelayedPaymentOutputDescriptor this_obj_conv;
15744 this_obj_conv.inner = (void*)(this_obj & (~1));
15745 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15746 DelayedPaymentOutputDescriptor_free(this_obj_conv);
15749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15750 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15752 this_ptr_conv.is_owned = false;
15753 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15754 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15755 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15756 uint64_t ret_ref = (uint64_t)ret_var.inner;
15757 if (ret_var.is_owned) {
15763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15764 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15766 this_ptr_conv.is_owned = false;
15767 LDKOutPoint val_conv;
15768 val_conv.inner = (void*)(val & (~1));
15769 val_conv.is_owned = (val & 1) || (val == 0);
15770 val_conv = OutPoint_clone(&val_conv);
15771 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
15775 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15777 this_ptr_conv.is_owned = false;
15778 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
15783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15784 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15786 this_ptr_conv.is_owned = false;
15787 LDKPublicKey val_ref;
15788 CHECK((*env)->GetArrayLength(env, val) == 33);
15789 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15790 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
15793 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15794 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15796 this_ptr_conv.is_owned = false;
15797 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
15801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15802 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15804 this_ptr_conv.is_owned = false;
15805 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
15808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15809 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15811 this_ptr_conv.is_owned = false;
15812 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15813 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15817 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15819 this_ptr_conv.is_owned = false;
15820 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
15825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15826 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = false;
15829 LDKPublicKey val_ref;
15830 CHECK((*env)->GetArrayLength(env, val) == 33);
15831 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15832 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
15835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15836 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15838 this_ptr_conv.is_owned = false;
15839 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15840 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15845 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15847 this_ptr_conv.is_owned = false;
15848 LDKThirtyTwoBytes val_ref;
15849 CHECK((*env)->GetArrayLength(env, val) == 32);
15850 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15851 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15855 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15857 this_ptr_conv.is_owned = false;
15858 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15863 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15865 this_ptr_conv.is_owned = false;
15866 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15869 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) {
15870 LDKOutPoint outpoint_arg_conv;
15871 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15872 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15873 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15874 LDKPublicKey per_commitment_point_arg_ref;
15875 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
15876 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
15877 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
15878 LDKPublicKey revocation_pubkey_arg_ref;
15879 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
15880 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
15881 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15882 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
15883 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
15884 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);
15885 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15886 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15887 uint64_t ret_ref = (uint64_t)ret_var.inner;
15888 if (ret_var.is_owned) {
15894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15895 LDKDelayedPaymentOutputDescriptor orig_conv;
15896 orig_conv.inner = (void*)(orig & (~1));
15897 orig_conv.is_owned = false;
15898 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
15899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15901 uint64_t ret_ref = (uint64_t)ret_var.inner;
15902 if (ret_var.is_owned) {
15908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15909 LDKDelayedPaymentOutputDescriptor obj_conv;
15910 obj_conv.inner = (void*)(obj & (~1));
15911 obj_conv.is_owned = false;
15912 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
15913 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15914 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15915 CVec_u8Z_free(ret_var);
15919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15920 LDKu8slice ser_ref;
15921 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15922 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15923 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15924 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
15925 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15926 return (uint64_t)ret_conv;
15929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15930 LDKStaticPaymentOutputDescriptor this_obj_conv;
15931 this_obj_conv.inner = (void*)(this_obj & (~1));
15932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15933 StaticPaymentOutputDescriptor_free(this_obj_conv);
15936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15937 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15939 this_ptr_conv.is_owned = false;
15940 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15943 uint64_t ret_ref = (uint64_t)ret_var.inner;
15944 if (ret_var.is_owned) {
15950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15951 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15953 this_ptr_conv.is_owned = false;
15954 LDKOutPoint val_conv;
15955 val_conv.inner = (void*)(val & (~1));
15956 val_conv.is_owned = (val & 1) || (val == 0);
15957 val_conv = OutPoint_clone(&val_conv);
15958 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15962 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15964 this_ptr_conv.is_owned = false;
15965 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15966 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15970 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15972 this_ptr_conv.is_owned = false;
15973 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15974 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15979 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15981 this_ptr_conv.is_owned = false;
15982 LDKThirtyTwoBytes val_ref;
15983 CHECK((*env)->GetArrayLength(env, val) == 32);
15984 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15985 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15989 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15991 this_ptr_conv.is_owned = false;
15992 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15997 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15999 this_ptr_conv.is_owned = false;
16000 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
16003 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) {
16004 LDKOutPoint outpoint_arg_conv;
16005 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
16006 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
16007 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
16008 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
16009 LDKThirtyTwoBytes channel_keys_id_arg_ref;
16010 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
16011 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
16012 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
16013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16015 uint64_t ret_ref = (uint64_t)ret_var.inner;
16016 if (ret_var.is_owned) {
16022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16023 LDKStaticPaymentOutputDescriptor orig_conv;
16024 orig_conv.inner = (void*)(orig & (~1));
16025 orig_conv.is_owned = false;
16026 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
16027 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16028 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16029 uint64_t ret_ref = (uint64_t)ret_var.inner;
16030 if (ret_var.is_owned) {
16036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16037 LDKStaticPaymentOutputDescriptor obj_conv;
16038 obj_conv.inner = (void*)(obj & (~1));
16039 obj_conv.is_owned = false;
16040 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
16041 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16042 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16043 CVec_u8Z_free(ret_var);
16047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16048 LDKu8slice ser_ref;
16049 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16050 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16051 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
16052 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
16053 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16054 return (uint64_t)ret_conv;
16057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16058 if ((this_ptr & 1) != 0) return;
16059 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
16060 FREE((void*)this_ptr);
16061 SpendableOutputDescriptor_free(this_ptr_conv);
16064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16065 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
16066 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16067 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
16068 uint64_t ret_ref = (uint64_t)ret_copy;
16072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1output(JNIEnv *env, jclass clz, int64_t outpoint, int64_t output) {
16073 LDKOutPoint outpoint_conv;
16074 outpoint_conv.inner = (void*)(outpoint & (~1));
16075 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
16076 outpoint_conv = OutPoint_clone(&outpoint_conv);
16077 LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
16078 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16079 *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
16080 uint64_t ret_ref = (uint64_t)ret_copy;
16084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
16085 LDKDelayedPaymentOutputDescriptor a_conv;
16086 a_conv.inner = (void*)(a & (~1));
16087 a_conv.is_owned = (a & 1) || (a == 0);
16088 a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
16089 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16090 *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
16091 uint64_t ret_ref = (uint64_t)ret_copy;
16095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
16096 LDKStaticPaymentOutputDescriptor a_conv;
16097 a_conv.inner = (void*)(a & (~1));
16098 a_conv.is_owned = (a & 1) || (a == 0);
16099 a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
16100 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
16101 *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
16102 uint64_t ret_ref = (uint64_t)ret_copy;
16106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
16107 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
16108 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
16109 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16110 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16111 CVec_u8Z_free(ret_var);
16115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16116 LDKu8slice ser_ref;
16117 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16118 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16119 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
16120 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
16121 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16122 return (uint64_t)ret_conv;
16125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16126 if ((this_ptr & 1) != 0) return;
16127 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
16128 FREE((void*)this_ptr);
16129 BaseSign_free(this_ptr_conv);
16132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16133 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
16134 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
16135 *ret = Sign_clone(orig_conv);
16136 return (uint64_t)ret;
16139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16140 if ((this_ptr & 1) != 0) return;
16141 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
16142 FREE((void*)this_ptr);
16143 Sign_free(this_ptr_conv);
16146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16147 if ((this_ptr & 1) != 0) return;
16148 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
16149 FREE((void*)this_ptr);
16150 KeysInterface_free(this_ptr_conv);
16153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16154 LDKInMemorySigner this_obj_conv;
16155 this_obj_conv.inner = (void*)(this_obj & (~1));
16156 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16157 InMemorySigner_free(this_obj_conv);
16160 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16161 LDKInMemorySigner this_ptr_conv;
16162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16163 this_ptr_conv.is_owned = false;
16164 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16165 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
16169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16170 LDKInMemorySigner this_ptr_conv;
16171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16172 this_ptr_conv.is_owned = false;
16173 LDKSecretKey val_ref;
16174 CHECK((*env)->GetArrayLength(env, val) == 32);
16175 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16176 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
16179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16180 LDKInMemorySigner this_ptr_conv;
16181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16182 this_ptr_conv.is_owned = false;
16183 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16184 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
16188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16189 LDKInMemorySigner this_ptr_conv;
16190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16191 this_ptr_conv.is_owned = false;
16192 LDKSecretKey val_ref;
16193 CHECK((*env)->GetArrayLength(env, val) == 32);
16194 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16195 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
16198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16199 LDKInMemorySigner this_ptr_conv;
16200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16201 this_ptr_conv.is_owned = false;
16202 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16203 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
16207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16208 LDKInMemorySigner this_ptr_conv;
16209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16210 this_ptr_conv.is_owned = false;
16211 LDKSecretKey val_ref;
16212 CHECK((*env)->GetArrayLength(env, val) == 32);
16213 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16214 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
16217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16218 LDKInMemorySigner this_ptr_conv;
16219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16220 this_ptr_conv.is_owned = false;
16221 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16222 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
16226 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) {
16227 LDKInMemorySigner this_ptr_conv;
16228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16229 this_ptr_conv.is_owned = false;
16230 LDKSecretKey val_ref;
16231 CHECK((*env)->GetArrayLength(env, val) == 32);
16232 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16233 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
16236 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
16237 LDKInMemorySigner this_ptr_conv;
16238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16239 this_ptr_conv.is_owned = false;
16240 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16241 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
16245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16246 LDKInMemorySigner this_ptr_conv;
16247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16248 this_ptr_conv.is_owned = false;
16249 LDKSecretKey val_ref;
16250 CHECK((*env)->GetArrayLength(env, val) == 32);
16251 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
16252 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
16255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
16256 LDKInMemorySigner this_ptr_conv;
16257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16258 this_ptr_conv.is_owned = false;
16259 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
16264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16265 LDKInMemorySigner this_ptr_conv;
16266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16267 this_ptr_conv.is_owned = false;
16268 LDKThirtyTwoBytes val_ref;
16269 CHECK((*env)->GetArrayLength(env, val) == 32);
16270 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16271 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
16274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16275 LDKInMemorySigner orig_conv;
16276 orig_conv.inner = (void*)(orig & (~1));
16277 orig_conv.is_owned = false;
16278 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
16279 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16280 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16281 uint64_t ret_ref = (uint64_t)ret_var.inner;
16282 if (ret_var.is_owned) {
16288 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) {
16289 LDKSecretKey funding_key_ref;
16290 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
16291 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
16292 LDKSecretKey revocation_base_key_ref;
16293 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
16294 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
16295 LDKSecretKey payment_key_ref;
16296 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
16297 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
16298 LDKSecretKey delayed_payment_base_key_ref;
16299 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
16300 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
16301 LDKSecretKey htlc_base_key_ref;
16302 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
16303 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
16304 LDKThirtyTwoBytes commitment_seed_ref;
16305 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
16306 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
16307 LDKThirtyTwoBytes channel_keys_id_ref;
16308 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
16309 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
16310 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);
16311 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16312 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16313 uint64_t ret_ref = (uint64_t)ret_var.inner;
16314 if (ret_var.is_owned) {
16320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
16321 LDKInMemorySigner this_arg_conv;
16322 this_arg_conv.inner = (void*)(this_arg & (~1));
16323 this_arg_conv.is_owned = false;
16324 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
16325 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16326 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16327 uint64_t ret_ref = (uint64_t)ret_var.inner;
16328 if (ret_var.is_owned) {
16334 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
16335 LDKInMemorySigner this_arg_conv;
16336 this_arg_conv.inner = (void*)(this_arg & (~1));
16337 this_arg_conv.is_owned = false;
16338 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
16342 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
16343 LDKInMemorySigner this_arg_conv;
16344 this_arg_conv.inner = (void*)(this_arg & (~1));
16345 this_arg_conv.is_owned = false;
16346 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
16350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
16351 LDKInMemorySigner this_arg_conv;
16352 this_arg_conv.inner = (void*)(this_arg & (~1));
16353 this_arg_conv.is_owned = false;
16354 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
16358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
16359 LDKInMemorySigner this_arg_conv;
16360 this_arg_conv.inner = (void*)(this_arg & (~1));
16361 this_arg_conv.is_owned = false;
16362 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
16363 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16364 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16365 uint64_t ret_ref = (uint64_t)ret_var.inner;
16366 if (ret_var.is_owned) {
16372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
16373 LDKInMemorySigner this_arg_conv;
16374 this_arg_conv.inner = (void*)(this_arg & (~1));
16375 this_arg_conv.is_owned = false;
16376 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
16377 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16378 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16379 uint64_t ret_ref = (uint64_t)ret_var.inner;
16380 if (ret_var.is_owned) {
16386 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) {
16387 LDKInMemorySigner this_arg_conv;
16388 this_arg_conv.inner = (void*)(this_arg & (~1));
16389 this_arg_conv.is_owned = false;
16390 LDKTransaction spend_tx_ref;
16391 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
16392 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
16393 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
16394 spend_tx_ref.data_is_owned = true;
16395 LDKStaticPaymentOutputDescriptor descriptor_conv;
16396 descriptor_conv.inner = (void*)(descriptor & (~1));
16397 descriptor_conv.is_owned = false;
16398 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16399 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
16400 return (uint64_t)ret_conv;
16403 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) {
16404 LDKInMemorySigner this_arg_conv;
16405 this_arg_conv.inner = (void*)(this_arg & (~1));
16406 this_arg_conv.is_owned = false;
16407 LDKTransaction spend_tx_ref;
16408 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
16409 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
16410 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
16411 spend_tx_ref.data_is_owned = true;
16412 LDKDelayedPaymentOutputDescriptor descriptor_conv;
16413 descriptor_conv.inner = (void*)(descriptor & (~1));
16414 descriptor_conv.is_owned = false;
16415 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16416 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
16417 return (uint64_t)ret_conv;
16420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
16421 LDKInMemorySigner this_arg_conv;
16422 this_arg_conv.inner = (void*)(this_arg & (~1));
16423 this_arg_conv.is_owned = false;
16424 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
16425 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
16426 return (uint64_t)ret;
16429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
16430 LDKInMemorySigner this_arg_conv;
16431 this_arg_conv.inner = (void*)(this_arg & (~1));
16432 this_arg_conv.is_owned = false;
16433 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
16434 *ret = InMemorySigner_as_Sign(&this_arg_conv);
16435 return (uint64_t)ret;
16438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
16439 LDKInMemorySigner obj_conv;
16440 obj_conv.inner = (void*)(obj & (~1));
16441 obj_conv.is_owned = false;
16442 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
16443 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16444 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16445 CVec_u8Z_free(ret_var);
16449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16450 LDKu8slice ser_ref;
16451 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16452 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16453 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16454 *ret_conv = InMemorySigner_read(ser_ref);
16455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16456 return (uint64_t)ret_conv;
16459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16460 LDKKeysManager this_obj_conv;
16461 this_obj_conv.inner = (void*)(this_obj & (~1));
16462 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16463 KeysManager_free(this_obj_conv);
16466 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) {
16467 unsigned char seed_arr[32];
16468 CHECK((*env)->GetArrayLength(env, seed) == 32);
16469 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
16470 unsigned char (*seed_ref)[32] = &seed_arr;
16471 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
16472 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16473 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16474 uint64_t ret_ref = (uint64_t)ret_var.inner;
16475 if (ret_var.is_owned) {
16481 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) {
16482 LDKKeysManager this_arg_conv;
16483 this_arg_conv.inner = (void*)(this_arg & (~1));
16484 this_arg_conv.is_owned = false;
16485 unsigned char params_arr[32];
16486 CHECK((*env)->GetArrayLength(env, params) == 32);
16487 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
16488 unsigned char (*params_ref)[32] = ¶ms_arr;
16489 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
16490 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16491 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16492 uint64_t ret_ref = (uint64_t)ret_var.inner;
16493 if (ret_var.is_owned) {
16499 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) {
16500 LDKKeysManager this_arg_conv;
16501 this_arg_conv.inner = (void*)(this_arg & (~1));
16502 this_arg_conv.is_owned = false;
16503 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
16504 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
16505 if (descriptors_constr.datalen > 0)
16506 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
16508 descriptors_constr.data = NULL;
16509 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
16510 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
16511 int64_t descriptors_conv_27 = descriptors_vals[b];
16512 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
16513 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
16514 descriptors_constr.data[b] = descriptors_conv_27_conv;
16516 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
16517 LDKCVec_TxOutZ outputs_constr;
16518 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
16519 if (outputs_constr.datalen > 0)
16520 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16522 outputs_constr.data = NULL;
16523 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
16524 for (size_t h = 0; h < outputs_constr.datalen; h++) {
16525 int64_t outputs_conv_7 = outputs_vals[h];
16526 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
16527 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
16528 outputs_constr.data[h] = outputs_conv_7_conv;
16530 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
16531 LDKCVec_u8Z change_destination_script_ref;
16532 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
16533 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
16534 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
16535 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16536 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
16537 return (uint64_t)ret_conv;
16540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
16541 LDKKeysManager this_arg_conv;
16542 this_arg_conv.inner = (void*)(this_arg & (~1));
16543 this_arg_conv.is_owned = false;
16544 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
16545 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
16546 return (uint64_t)ret;
16549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16550 LDKChannelManager this_obj_conv;
16551 this_obj_conv.inner = (void*)(this_obj & (~1));
16552 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16553 ChannelManager_free(this_obj_conv);
16556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16557 LDKChainParameters this_obj_conv;
16558 this_obj_conv.inner = (void*)(this_obj & (~1));
16559 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16560 ChainParameters_free(this_obj_conv);
16563 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
16564 LDKChainParameters this_ptr_conv;
16565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16566 this_ptr_conv.is_owned = false;
16567 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
16571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
16572 LDKChainParameters this_ptr_conv;
16573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16574 this_ptr_conv.is_owned = false;
16575 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
16576 ChainParameters_set_network(&this_ptr_conv, val_conv);
16579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
16580 LDKChainParameters this_ptr_conv;
16581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16582 this_ptr_conv.is_owned = false;
16583 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
16584 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16585 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16586 uint64_t ret_ref = (uint64_t)ret_var.inner;
16587 if (ret_var.is_owned) {
16593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16594 LDKChainParameters this_ptr_conv;
16595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16596 this_ptr_conv.is_owned = false;
16597 LDKBestBlock val_conv;
16598 val_conv.inner = (void*)(val & (~1));
16599 val_conv.is_owned = (val & 1) || (val == 0);
16600 val_conv = BestBlock_clone(&val_conv);
16601 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
16604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
16605 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
16606 LDKBestBlock best_block_arg_conv;
16607 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
16608 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
16609 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
16610 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
16611 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16612 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16613 uint64_t ret_ref = (uint64_t)ret_var.inner;
16614 if (ret_var.is_owned) {
16620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16621 LDKChainParameters orig_conv;
16622 orig_conv.inner = (void*)(orig & (~1));
16623 orig_conv.is_owned = false;
16624 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
16625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16627 uint64_t ret_ref = (uint64_t)ret_var.inner;
16628 if (ret_var.is_owned) {
16634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16635 LDKChannelCounterparty this_obj_conv;
16636 this_obj_conv.inner = (void*)(this_obj & (~1));
16637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16638 ChannelCounterparty_free(this_obj_conv);
16641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16642 LDKChannelCounterparty this_ptr_conv;
16643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16644 this_ptr_conv.is_owned = false;
16645 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16646 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
16650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16651 LDKChannelCounterparty this_ptr_conv;
16652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16653 this_ptr_conv.is_owned = false;
16654 LDKPublicKey val_ref;
16655 CHECK((*env)->GetArrayLength(env, val) == 33);
16656 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16657 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
16660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16661 LDKChannelCounterparty this_ptr_conv;
16662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16663 this_ptr_conv.is_owned = false;
16664 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
16665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16667 uint64_t ret_ref = (uint64_t)ret_var.inner;
16668 if (ret_var.is_owned) {
16674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16675 LDKChannelCounterparty this_ptr_conv;
16676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16677 this_ptr_conv.is_owned = false;
16678 LDKInitFeatures val_conv;
16679 val_conv.inner = (void*)(val & (~1));
16680 val_conv.is_owned = (val & 1) || (val == 0);
16681 val_conv = InitFeatures_clone(&val_conv);
16682 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
16685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16686 LDKChannelCounterparty this_ptr_conv;
16687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16688 this_ptr_conv.is_owned = false;
16689 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
16693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16694 LDKChannelCounterparty this_ptr_conv;
16695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16696 this_ptr_conv.is_owned = false;
16697 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
16700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16701 LDKChannelCounterparty orig_conv;
16702 orig_conv.inner = (void*)(orig & (~1));
16703 orig_conv.is_owned = false;
16704 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
16705 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16706 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16707 uint64_t ret_ref = (uint64_t)ret_var.inner;
16708 if (ret_var.is_owned) {
16714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16715 LDKChannelDetails this_obj_conv;
16716 this_obj_conv.inner = (void*)(this_obj & (~1));
16717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16718 ChannelDetails_free(this_obj_conv);
16721 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16722 LDKChannelDetails this_ptr_conv;
16723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16724 this_ptr_conv.is_owned = false;
16725 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16726 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
16730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16731 LDKChannelDetails this_ptr_conv;
16732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16733 this_ptr_conv.is_owned = false;
16734 LDKThirtyTwoBytes val_ref;
16735 CHECK((*env)->GetArrayLength(env, val) == 32);
16736 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16737 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
16740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
16741 LDKChannelDetails this_ptr_conv;
16742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16743 this_ptr_conv.is_owned = false;
16744 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
16745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16747 uint64_t ret_ref = (uint64_t)ret_var.inner;
16748 if (ret_var.is_owned) {
16754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16755 LDKChannelDetails this_ptr_conv;
16756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16757 this_ptr_conv.is_owned = false;
16758 LDKChannelCounterparty val_conv;
16759 val_conv.inner = (void*)(val & (~1));
16760 val_conv.is_owned = (val & 1) || (val == 0);
16761 val_conv = ChannelCounterparty_clone(&val_conv);
16762 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
16765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
16766 LDKChannelDetails this_ptr_conv;
16767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16768 this_ptr_conv.is_owned = false;
16769 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
16770 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16771 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16772 uint64_t ret_ref = (uint64_t)ret_var.inner;
16773 if (ret_var.is_owned) {
16779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16780 LDKChannelDetails this_ptr_conv;
16781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16782 this_ptr_conv.is_owned = false;
16783 LDKOutPoint val_conv;
16784 val_conv.inner = (void*)(val & (~1));
16785 val_conv.is_owned = (val & 1) || (val == 0);
16786 val_conv = OutPoint_clone(&val_conv);
16787 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
16790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16791 LDKChannelDetails this_ptr_conv;
16792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16793 this_ptr_conv.is_owned = false;
16794 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16795 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
16796 uint64_t ret_ref = (uint64_t)ret_copy;
16800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16801 LDKChannelDetails this_ptr_conv;
16802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16803 this_ptr_conv.is_owned = false;
16804 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16805 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
16808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16809 LDKChannelDetails this_ptr_conv;
16810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16811 this_ptr_conv.is_owned = false;
16812 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
16816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16817 LDKChannelDetails this_ptr_conv;
16818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16819 this_ptr_conv.is_owned = false;
16820 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
16823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16824 LDKChannelDetails this_ptr_conv;
16825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16826 this_ptr_conv.is_owned = false;
16827 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16828 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16829 uint64_t ret_ref = (uint64_t)ret_copy;
16833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16834 LDKChannelDetails this_ptr_conv;
16835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16836 this_ptr_conv.is_owned = false;
16837 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16838 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16842 LDKChannelDetails this_ptr_conv;
16843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16844 this_ptr_conv.is_owned = false;
16845 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
16849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16850 LDKChannelDetails this_ptr_conv;
16851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16852 this_ptr_conv.is_owned = false;
16853 ChannelDetails_set_user_id(&this_ptr_conv, val);
16856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16857 LDKChannelDetails this_ptr_conv;
16858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16859 this_ptr_conv.is_owned = false;
16860 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16865 LDKChannelDetails this_ptr_conv;
16866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16867 this_ptr_conv.is_owned = false;
16868 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16872 LDKChannelDetails this_ptr_conv;
16873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16874 this_ptr_conv.is_owned = false;
16875 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16880 LDKChannelDetails this_ptr_conv;
16881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16882 this_ptr_conv.is_owned = false;
16883 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
16887 LDKChannelDetails this_ptr_conv;
16888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16889 this_ptr_conv.is_owned = false;
16890 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16891 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16892 uint64_t ret_ref = (uint64_t)ret_copy;
16896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16897 LDKChannelDetails this_ptr_conv;
16898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16899 this_ptr_conv.is_owned = false;
16900 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
16901 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16905 LDKChannelDetails this_ptr_conv;
16906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16907 this_ptr_conv.is_owned = false;
16908 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16909 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16910 uint64_t ret_ref = (uint64_t)ret_copy;
16914 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) {
16915 LDKChannelDetails this_ptr_conv;
16916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16917 this_ptr_conv.is_owned = false;
16918 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
16919 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
16923 LDKChannelDetails this_ptr_conv;
16924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16925 this_ptr_conv.is_owned = false;
16926 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16931 LDKChannelDetails this_ptr_conv;
16932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16933 this_ptr_conv.is_owned = false;
16934 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
16938 LDKChannelDetails this_ptr_conv;
16939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16940 this_ptr_conv.is_owned = false;
16941 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16946 LDKChannelDetails this_ptr_conv;
16947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16948 this_ptr_conv.is_owned = false;
16949 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
16953 LDKChannelDetails this_ptr_conv;
16954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16955 this_ptr_conv.is_owned = false;
16956 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16961 LDKChannelDetails this_ptr_conv;
16962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16963 this_ptr_conv.is_owned = false;
16964 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
16968 LDKChannelDetails this_ptr_conv;
16969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16970 this_ptr_conv.is_owned = false;
16971 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16976 LDKChannelDetails this_ptr_conv;
16977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16978 this_ptr_conv.is_owned = false;
16979 ChannelDetails_set_is_public(&this_ptr_conv, val);
16982 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) {
16983 LDKThirtyTwoBytes channel_id_arg_ref;
16984 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16985 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16986 LDKChannelCounterparty counterparty_arg_conv;
16987 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16988 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16989 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16990 LDKOutPoint funding_txo_arg_conv;
16991 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16992 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16993 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16994 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
16995 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16996 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
16997 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16998 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);
16999 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17000 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17001 uint64_t ret_ref = (uint64_t)ret_var.inner;
17002 if (ret_var.is_owned) {
17008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17009 LDKChannelDetails orig_conv;
17010 orig_conv.inner = (void*)(orig & (~1));
17011 orig_conv.is_owned = false;
17012 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
17013 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17014 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17015 uint64_t ret_ref = (uint64_t)ret_var.inner;
17016 if (ret_var.is_owned) {
17022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
17023 if ((this_ptr & 1) != 0) return;
17024 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
17025 FREE((void*)this_ptr);
17026 PaymentSendFailure_free(this_ptr_conv);
17029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17030 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
17031 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17032 *ret_copy = PaymentSendFailure_clone(orig_conv);
17033 uint64_t ret_ref = (uint64_t)ret_copy;
17037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
17038 LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
17039 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17040 *ret_copy = PaymentSendFailure_parameter_error(a_conv);
17041 uint64_t ret_ref = (uint64_t)ret_copy;
17045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
17046 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
17047 a_constr.datalen = (*env)->GetArrayLength(env, a);
17048 if (a_constr.datalen > 0)
17049 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17051 a_constr.data = NULL;
17052 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17053 for (size_t w = 0; w < a_constr.datalen; w++) {
17054 int64_t a_conv_22 = a_vals[w];
17055 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
17056 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
17057 a_constr.data[w] = a_conv_22_conv;
17059 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17060 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17061 *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
17062 uint64_t ret_ref = (uint64_t)ret_copy;
17066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1retry_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
17067 LDKCVec_APIErrorZ a_constr;
17068 a_constr.datalen = (*env)->GetArrayLength(env, a);
17069 if (a_constr.datalen > 0)
17070 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
17072 a_constr.data = NULL;
17073 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17074 for (size_t k = 0; k < a_constr.datalen; k++) {
17075 int64_t a_conv_10 = a_vals[k];
17076 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(((uint64_t)a_conv_10) & ~1);
17077 a_conv_10_conv = APIError_clone((LDKAPIError*)(((uint64_t)a_conv_10) & ~1));
17078 a_constr.data[k] = a_conv_10_conv;
17080 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17081 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17082 *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
17083 uint64_t ret_ref = (uint64_t)ret_copy;
17087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1partial_1failure(JNIEnv *env, jclass clz, int64_tArray a) {
17088 LDKCVec_CResult_NoneAPIErrorZZ a_constr;
17089 a_constr.datalen = (*env)->GetArrayLength(env, a);
17090 if (a_constr.datalen > 0)
17091 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
17093 a_constr.data = NULL;
17094 int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
17095 for (size_t w = 0; w < a_constr.datalen; w++) {
17096 int64_t a_conv_22 = a_vals[w];
17097 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1);
17098 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)a_conv_22) & ~1));
17099 a_constr.data[w] = a_conv_22_conv;
17101 (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
17102 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
17103 *ret_copy = PaymentSendFailure_partial_failure(a_constr);
17104 uint64_t ret_ref = (uint64_t)ret_copy;
17108 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) {
17109 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
17110 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
17111 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17112 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
17114 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
17115 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
17116 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17117 LDKWatch_JCalls_cloned(&chain_monitor_conv);
17119 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
17120 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17121 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17122 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
17124 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17125 if (logger_conv.free == LDKLogger_JCalls_free) {
17126 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17127 LDKLogger_JCalls_cloned(&logger_conv);
17129 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
17130 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
17131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17132 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
17134 LDKUserConfig config_conv;
17135 config_conv.inner = (void*)(config & (~1));
17136 config_conv.is_owned = (config & 1) || (config == 0);
17137 config_conv = UserConfig_clone(&config_conv);
17138 LDKChainParameters params_conv;
17139 params_conv.inner = (void*)(params & (~1));
17140 params_conv.is_owned = (params & 1) || (params == 0);
17141 params_conv = ChainParameters_clone(¶ms_conv);
17142 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
17143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17145 uint64_t ret_ref = (uint64_t)ret_var.inner;
17146 if (ret_var.is_owned) {
17152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
17153 LDKChannelManager this_arg_conv;
17154 this_arg_conv.inner = (void*)(this_arg & (~1));
17155 this_arg_conv.is_owned = false;
17156 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
17157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17159 uint64_t ret_ref = (uint64_t)ret_var.inner;
17160 if (ret_var.is_owned) {
17166 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) {
17167 LDKChannelManager this_arg_conv;
17168 this_arg_conv.inner = (void*)(this_arg & (~1));
17169 this_arg_conv.is_owned = false;
17170 LDKPublicKey their_network_key_ref;
17171 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
17172 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
17173 LDKUserConfig override_config_conv;
17174 override_config_conv.inner = (void*)(override_config & (~1));
17175 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
17176 override_config_conv = UserConfig_clone(&override_config_conv);
17177 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17178 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
17179 return (uint64_t)ret_conv;
17182 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17183 LDKChannelManager this_arg_conv;
17184 this_arg_conv.inner = (void*)(this_arg & (~1));
17185 this_arg_conv.is_owned = false;
17186 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
17187 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17188 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17189 for (size_t q = 0; q < ret_var.datalen; q++) {
17190 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
17191 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17192 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17193 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
17194 if (ret_conv_16_var.is_owned) {
17195 ret_conv_16_ref |= 1;
17197 ret_arr_ptr[q] = ret_conv_16_ref;
17199 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17200 FREE(ret_var.data);
17204 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17205 LDKChannelManager this_arg_conv;
17206 this_arg_conv.inner = (void*)(this_arg & (~1));
17207 this_arg_conv.is_owned = false;
17208 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
17209 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17210 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17211 for (size_t q = 0; q < ret_var.datalen; q++) {
17212 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
17213 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17214 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17215 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
17216 if (ret_conv_16_var.is_owned) {
17217 ret_conv_16_ref |= 1;
17219 ret_arr_ptr[q] = ret_conv_16_ref;
17221 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17222 FREE(ret_var.data);
17226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
17227 LDKChannelManager this_arg_conv;
17228 this_arg_conv.inner = (void*)(this_arg & (~1));
17229 this_arg_conv.is_owned = false;
17230 unsigned char channel_id_arr[32];
17231 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17232 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17233 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17234 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17235 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
17236 return (uint64_t)ret_conv;
17239 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) {
17240 LDKChannelManager this_arg_conv;
17241 this_arg_conv.inner = (void*)(this_arg & (~1));
17242 this_arg_conv.is_owned = false;
17243 unsigned char channel_id_arr[32];
17244 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17245 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17246 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17247 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17248 *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
17249 return (uint64_t)ret_conv;
17252 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) {
17253 LDKChannelManager this_arg_conv;
17254 this_arg_conv.inner = (void*)(this_arg & (~1));
17255 this_arg_conv.is_owned = false;
17256 unsigned char channel_id_arr[32];
17257 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
17258 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
17259 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
17260 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17261 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
17262 return (uint64_t)ret_conv;
17265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
17266 LDKChannelManager this_arg_conv;
17267 this_arg_conv.inner = (void*)(this_arg & (~1));
17268 this_arg_conv.is_owned = false;
17269 ChannelManager_force_close_all_channels(&this_arg_conv);
17272 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) {
17273 LDKChannelManager this_arg_conv;
17274 this_arg_conv.inner = (void*)(this_arg & (~1));
17275 this_arg_conv.is_owned = false;
17276 LDKRoute route_conv;
17277 route_conv.inner = (void*)(route & (~1));
17278 route_conv.is_owned = false;
17279 LDKThirtyTwoBytes payment_hash_ref;
17280 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17281 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17282 LDKThirtyTwoBytes payment_secret_ref;
17283 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
17284 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
17285 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
17286 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
17287 return (uint64_t)ret_conv;
17290 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) {
17291 LDKChannelManager this_arg_conv;
17292 this_arg_conv.inner = (void*)(this_arg & (~1));
17293 this_arg_conv.is_owned = false;
17294 LDKRoute route_conv;
17295 route_conv.inner = (void*)(route & (~1));
17296 route_conv.is_owned = false;
17297 LDKThirtyTwoBytes payment_preimage_ref;
17298 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17299 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17300 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
17301 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
17302 return (uint64_t)ret_conv;
17305 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) {
17306 LDKChannelManager this_arg_conv;
17307 this_arg_conv.inner = (void*)(this_arg & (~1));
17308 this_arg_conv.is_owned = false;
17309 unsigned char temporary_channel_id_arr[32];
17310 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
17311 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
17312 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
17313 LDKTransaction funding_transaction_ref;
17314 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
17315 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
17316 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
17317 funding_transaction_ref.data_is_owned = true;
17318 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
17319 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
17320 return (uint64_t)ret_conv;
17323 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) {
17324 LDKChannelManager this_arg_conv;
17325 this_arg_conv.inner = (void*)(this_arg & (~1));
17326 this_arg_conv.is_owned = false;
17327 LDKThreeBytes rgb_ref;
17328 CHECK((*env)->GetArrayLength(env, rgb) == 3);
17329 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
17330 LDKThirtyTwoBytes alias_ref;
17331 CHECK((*env)->GetArrayLength(env, alias) == 32);
17332 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
17333 LDKCVec_NetAddressZ addresses_constr;
17334 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
17335 if (addresses_constr.datalen > 0)
17336 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
17338 addresses_constr.data = NULL;
17339 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
17340 for (size_t m = 0; m < addresses_constr.datalen; m++) {
17341 int64_t addresses_conv_12 = addresses_vals[m];
17342 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
17343 addresses_constr.data[m] = addresses_conv_12_conv;
17345 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
17346 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
17349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
17350 LDKChannelManager this_arg_conv;
17351 this_arg_conv.inner = (void*)(this_arg & (~1));
17352 this_arg_conv.is_owned = false;
17353 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
17356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
17357 LDKChannelManager this_arg_conv;
17358 this_arg_conv.inner = (void*)(this_arg & (~1));
17359 this_arg_conv.is_owned = false;
17360 ChannelManager_timer_tick_occurred(&this_arg_conv);
17363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
17364 LDKChannelManager this_arg_conv;
17365 this_arg_conv.inner = (void*)(this_arg & (~1));
17366 this_arg_conv.is_owned = false;
17367 unsigned char payment_hash_arr[32];
17368 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17369 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
17370 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
17371 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
17375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
17376 LDKChannelManager this_arg_conv;
17377 this_arg_conv.inner = (void*)(this_arg & (~1));
17378 this_arg_conv.is_owned = false;
17379 LDKThirtyTwoBytes payment_preimage_ref;
17380 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
17381 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
17382 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
17386 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
17387 LDKChannelManager this_arg_conv;
17388 this_arg_conv.inner = (void*)(this_arg & (~1));
17389 this_arg_conv.is_owned = false;
17390 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17391 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
17395 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) {
17396 LDKChannelManager this_arg_conv;
17397 this_arg_conv.inner = (void*)(this_arg & (~1));
17398 this_arg_conv.is_owned = false;
17399 LDKOutPoint funding_txo_conv;
17400 funding_txo_conv.inner = (void*)(funding_txo & (~1));
17401 funding_txo_conv.is_owned = false;
17402 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
17405 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) {
17406 LDKChannelManager this_arg_conv;
17407 this_arg_conv.inner = (void*)(this_arg & (~1));
17408 this_arg_conv.is_owned = false;
17409 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
17410 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
17411 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
17412 return (uint64_t)ret_ref;
17415 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) {
17416 LDKChannelManager this_arg_conv;
17417 this_arg_conv.inner = (void*)(this_arg & (~1));
17418 this_arg_conv.is_owned = false;
17419 LDKThirtyTwoBytes payment_hash_ref;
17420 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
17421 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
17422 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
17423 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
17424 *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);
17425 return (uint64_t)ret_conv;
17428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17429 LDKChannelManager this_arg_conv;
17430 this_arg_conv.inner = (void*)(this_arg & (~1));
17431 this_arg_conv.is_owned = false;
17432 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
17433 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
17434 return (uint64_t)ret;
17437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
17438 LDKChannelManager this_arg_conv;
17439 this_arg_conv.inner = (void*)(this_arg & (~1));
17440 this_arg_conv.is_owned = false;
17441 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
17442 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
17443 return (uint64_t)ret;
17446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
17447 LDKChannelManager this_arg_conv;
17448 this_arg_conv.inner = (void*)(this_arg & (~1));
17449 this_arg_conv.is_owned = false;
17450 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
17451 *ret = ChannelManager_as_Listen(&this_arg_conv);
17452 return (uint64_t)ret;
17455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
17456 LDKChannelManager this_arg_conv;
17457 this_arg_conv.inner = (void*)(this_arg & (~1));
17458 this_arg_conv.is_owned = false;
17459 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
17460 *ret = ChannelManager_as_Confirm(&this_arg_conv);
17461 return (uint64_t)ret;
17464 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) {
17465 LDKChannelManager this_arg_conv;
17466 this_arg_conv.inner = (void*)(this_arg & (~1));
17467 this_arg_conv.is_owned = false;
17468 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
17472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
17473 LDKChannelManager this_arg_conv;
17474 this_arg_conv.inner = (void*)(this_arg & (~1));
17475 this_arg_conv.is_owned = false;
17476 ChannelManager_await_persistable_update(&this_arg_conv);
17479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
17480 LDKChannelManager this_arg_conv;
17481 this_arg_conv.inner = (void*)(this_arg & (~1));
17482 this_arg_conv.is_owned = false;
17483 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
17484 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17485 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17486 uint64_t ret_ref = (uint64_t)ret_var.inner;
17487 if (ret_var.is_owned) {
17493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
17494 LDKChannelManager this_arg_conv;
17495 this_arg_conv.inner = (void*)(this_arg & (~1));
17496 this_arg_conv.is_owned = false;
17497 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
17498 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
17499 return (uint64_t)ret;
17502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
17503 LDKChannelManager obj_conv;
17504 obj_conv.inner = (void*)(obj & (~1));
17505 obj_conv.is_owned = false;
17506 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
17507 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17508 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17509 CVec_u8Z_free(ret_var);
17513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17514 LDKChannelManagerReadArgs this_obj_conv;
17515 this_obj_conv.inner = (void*)(this_obj & (~1));
17516 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17517 ChannelManagerReadArgs_free(this_obj_conv);
17520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
17521 LDKChannelManagerReadArgs this_ptr_conv;
17522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17523 this_ptr_conv.is_owned = false;
17524 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
17528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17529 LDKChannelManagerReadArgs this_ptr_conv;
17530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17531 this_ptr_conv.is_owned = false;
17532 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
17533 if (val_conv.free == LDKKeysInterface_JCalls_free) {
17534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17535 LDKKeysInterface_JCalls_cloned(&val_conv);
17537 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
17540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
17541 LDKChannelManagerReadArgs this_ptr_conv;
17542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17543 this_ptr_conv.is_owned = false;
17544 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
17548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17549 LDKChannelManagerReadArgs this_ptr_conv;
17550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17551 this_ptr_conv.is_owned = false;
17552 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
17553 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
17554 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17555 LDKFeeEstimator_JCalls_cloned(&val_conv);
17557 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
17560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
17561 LDKChannelManagerReadArgs this_ptr_conv;
17562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17563 this_ptr_conv.is_owned = false;
17564 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
17568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17569 LDKChannelManagerReadArgs this_ptr_conv;
17570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17571 this_ptr_conv.is_owned = false;
17572 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
17573 if (val_conv.free == LDKWatch_JCalls_free) {
17574 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17575 LDKWatch_JCalls_cloned(&val_conv);
17577 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
17580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
17581 LDKChannelManagerReadArgs this_ptr_conv;
17582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17583 this_ptr_conv.is_owned = false;
17584 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
17588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17589 LDKChannelManagerReadArgs this_ptr_conv;
17590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17591 this_ptr_conv.is_owned = false;
17592 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
17593 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
17594 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17595 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
17597 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
17600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
17601 LDKChannelManagerReadArgs this_ptr_conv;
17602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17603 this_ptr_conv.is_owned = false;
17604 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
17608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17609 LDKChannelManagerReadArgs this_ptr_conv;
17610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17611 this_ptr_conv.is_owned = false;
17612 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
17613 if (val_conv.free == LDKLogger_JCalls_free) {
17614 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17615 LDKLogger_JCalls_cloned(&val_conv);
17617 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
17620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
17621 LDKChannelManagerReadArgs this_ptr_conv;
17622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17623 this_ptr_conv.is_owned = false;
17624 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
17625 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17626 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17627 uint64_t ret_ref = (uint64_t)ret_var.inner;
17628 if (ret_var.is_owned) {
17634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17635 LDKChannelManagerReadArgs this_ptr_conv;
17636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17637 this_ptr_conv.is_owned = false;
17638 LDKUserConfig val_conv;
17639 val_conv.inner = (void*)(val & (~1));
17640 val_conv.is_owned = (val & 1) || (val == 0);
17641 val_conv = UserConfig_clone(&val_conv);
17642 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
17645 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) {
17646 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
17647 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
17648 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17649 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
17651 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
17652 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
17653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17654 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
17656 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
17657 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
17658 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17659 LDKWatch_JCalls_cloned(&chain_monitor_conv);
17661 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
17662 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
17663 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17664 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
17666 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
17667 if (logger_conv.free == LDKLogger_JCalls_free) {
17668 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17669 LDKLogger_JCalls_cloned(&logger_conv);
17671 LDKUserConfig default_config_conv;
17672 default_config_conv.inner = (void*)(default_config & (~1));
17673 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
17674 default_config_conv = UserConfig_clone(&default_config_conv);
17675 LDKCVec_ChannelMonitorZ channel_monitors_constr;
17676 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
17677 if (channel_monitors_constr.datalen > 0)
17678 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17680 channel_monitors_constr.data = NULL;
17681 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
17682 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
17683 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
17684 LDKChannelMonitor channel_monitors_conv_16_conv;
17685 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
17686 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
17687 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
17689 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
17690 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);
17691 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17692 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17693 uint64_t ret_ref = (uint64_t)ret_var.inner;
17694 if (ret_var.is_owned) {
17700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
17701 LDKu8slice ser_ref;
17702 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17703 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17704 LDKChannelManagerReadArgs arg_conv;
17705 arg_conv.inner = (void*)(arg & (~1));
17706 arg_conv.is_owned = (arg & 1) || (arg == 0);
17707 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
17708 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17709 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
17710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17711 return (uint64_t)ret_conv;
17714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17715 LDKDecodeError this_obj_conv;
17716 this_obj_conv.inner = (void*)(this_obj & (~1));
17717 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17718 DecodeError_free(this_obj_conv);
17721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17722 LDKDecodeError orig_conv;
17723 orig_conv.inner = (void*)(orig & (~1));
17724 orig_conv.is_owned = false;
17725 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
17726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17728 uint64_t ret_ref = (uint64_t)ret_var.inner;
17729 if (ret_var.is_owned) {
17735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17736 LDKInit this_obj_conv;
17737 this_obj_conv.inner = (void*)(this_obj & (~1));
17738 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17739 Init_free(this_obj_conv);
17742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
17743 LDKInit this_ptr_conv;
17744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17745 this_ptr_conv.is_owned = false;
17746 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
17747 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17748 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17749 uint64_t ret_ref = (uint64_t)ret_var.inner;
17750 if (ret_var.is_owned) {
17756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17757 LDKInit this_ptr_conv;
17758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17759 this_ptr_conv.is_owned = false;
17760 LDKInitFeatures val_conv;
17761 val_conv.inner = (void*)(val & (~1));
17762 val_conv.is_owned = (val & 1) || (val == 0);
17763 val_conv = InitFeatures_clone(&val_conv);
17764 Init_set_features(&this_ptr_conv, val_conv);
17767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
17768 LDKInitFeatures features_arg_conv;
17769 features_arg_conv.inner = (void*)(features_arg & (~1));
17770 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17771 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17772 LDKInit ret_var = Init_new(features_arg_conv);
17773 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17774 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17775 uint64_t ret_ref = (uint64_t)ret_var.inner;
17776 if (ret_var.is_owned) {
17782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17784 orig_conv.inner = (void*)(orig & (~1));
17785 orig_conv.is_owned = false;
17786 LDKInit ret_var = Init_clone(&orig_conv);
17787 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17788 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17789 uint64_t ret_ref = (uint64_t)ret_var.inner;
17790 if (ret_var.is_owned) {
17796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17797 LDKErrorMessage this_obj_conv;
17798 this_obj_conv.inner = (void*)(this_obj & (~1));
17799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17800 ErrorMessage_free(this_obj_conv);
17803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17804 LDKErrorMessage this_ptr_conv;
17805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17806 this_ptr_conv.is_owned = false;
17807 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17808 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
17812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17813 LDKErrorMessage this_ptr_conv;
17814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17815 this_ptr_conv.is_owned = false;
17816 LDKThirtyTwoBytes val_ref;
17817 CHECK((*env)->GetArrayLength(env, val) == 32);
17818 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17819 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
17822 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
17823 LDKErrorMessage this_ptr_conv;
17824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17825 this_ptr_conv.is_owned = false;
17826 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
17827 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
17832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
17833 LDKErrorMessage this_ptr_conv;
17834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17835 this_ptr_conv.is_owned = false;
17836 LDKStr val_conv = java_to_owned_str(env, val);
17837 ErrorMessage_set_data(&this_ptr_conv, val_conv);
17840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
17841 LDKThirtyTwoBytes channel_id_arg_ref;
17842 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17843 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17844 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
17845 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
17846 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17847 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17848 uint64_t ret_ref = (uint64_t)ret_var.inner;
17849 if (ret_var.is_owned) {
17855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17856 LDKErrorMessage orig_conv;
17857 orig_conv.inner = (void*)(orig & (~1));
17858 orig_conv.is_owned = false;
17859 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
17860 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17861 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17862 uint64_t ret_ref = (uint64_t)ret_var.inner;
17863 if (ret_var.is_owned) {
17869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17870 LDKPing this_obj_conv;
17871 this_obj_conv.inner = (void*)(this_obj & (~1));
17872 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17873 Ping_free(this_obj_conv);
17876 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17877 LDKPing this_ptr_conv;
17878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17879 this_ptr_conv.is_owned = false;
17880 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17885 LDKPing this_ptr_conv;
17886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17887 this_ptr_conv.is_owned = false;
17888 Ping_set_ponglen(&this_ptr_conv, val);
17891 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17892 LDKPing this_ptr_conv;
17893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17894 this_ptr_conv.is_owned = false;
17895 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17900 LDKPing this_ptr_conv;
17901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17902 this_ptr_conv.is_owned = false;
17903 Ping_set_byteslen(&this_ptr_conv, val);
17906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
17907 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17910 uint64_t ret_ref = (uint64_t)ret_var.inner;
17911 if (ret_var.is_owned) {
17917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17919 orig_conv.inner = (void*)(orig & (~1));
17920 orig_conv.is_owned = false;
17921 LDKPing ret_var = Ping_clone(&orig_conv);
17922 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17923 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17924 uint64_t ret_ref = (uint64_t)ret_var.inner;
17925 if (ret_var.is_owned) {
17931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17932 LDKPong this_obj_conv;
17933 this_obj_conv.inner = (void*)(this_obj & (~1));
17934 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17935 Pong_free(this_obj_conv);
17938 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17939 LDKPong this_ptr_conv;
17940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17941 this_ptr_conv.is_owned = false;
17942 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17947 LDKPong this_ptr_conv;
17948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17949 this_ptr_conv.is_owned = false;
17950 Pong_set_byteslen(&this_ptr_conv, val);
17953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
17954 LDKPong ret_var = Pong_new(byteslen_arg);
17955 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17956 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17957 uint64_t ret_ref = (uint64_t)ret_var.inner;
17958 if (ret_var.is_owned) {
17964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17966 orig_conv.inner = (void*)(orig & (~1));
17967 orig_conv.is_owned = false;
17968 LDKPong ret_var = Pong_clone(&orig_conv);
17969 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17970 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17971 uint64_t ret_ref = (uint64_t)ret_var.inner;
17972 if (ret_var.is_owned) {
17978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17979 LDKOpenChannel this_obj_conv;
17980 this_obj_conv.inner = (void*)(this_obj & (~1));
17981 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17982 OpenChannel_free(this_obj_conv);
17985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17986 LDKOpenChannel this_ptr_conv;
17987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17988 this_ptr_conv.is_owned = false;
17989 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17990 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
17994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17995 LDKOpenChannel this_ptr_conv;
17996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17997 this_ptr_conv.is_owned = false;
17998 LDKThirtyTwoBytes val_ref;
17999 CHECK((*env)->GetArrayLength(env, val) == 32);
18000 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18001 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
18004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18005 LDKOpenChannel this_ptr_conv;
18006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18007 this_ptr_conv.is_owned = false;
18008 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18009 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
18013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18014 LDKOpenChannel this_ptr_conv;
18015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18016 this_ptr_conv.is_owned = false;
18017 LDKThirtyTwoBytes val_ref;
18018 CHECK((*env)->GetArrayLength(env, val) == 32);
18019 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18020 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18024 LDKOpenChannel this_ptr_conv;
18025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18026 this_ptr_conv.is_owned = false;
18027 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
18031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18032 LDKOpenChannel this_ptr_conv;
18033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18034 this_ptr_conv.is_owned = false;
18035 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
18038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18039 LDKOpenChannel this_ptr_conv;
18040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18041 this_ptr_conv.is_owned = false;
18042 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
18046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18047 LDKOpenChannel this_ptr_conv;
18048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18049 this_ptr_conv.is_owned = false;
18050 OpenChannel_set_push_msat(&this_ptr_conv, val);
18053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18054 LDKOpenChannel this_ptr_conv;
18055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18056 this_ptr_conv.is_owned = false;
18057 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
18061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18062 LDKOpenChannel this_ptr_conv;
18063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18064 this_ptr_conv.is_owned = false;
18065 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18068 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) {
18069 LDKOpenChannel this_ptr_conv;
18070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18071 this_ptr_conv.is_owned = false;
18072 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18076 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) {
18077 LDKOpenChannel this_ptr_conv;
18078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18079 this_ptr_conv.is_owned = false;
18080 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18084 LDKOpenChannel this_ptr_conv;
18085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18086 this_ptr_conv.is_owned = false;
18087 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18092 LDKOpenChannel this_ptr_conv;
18093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18094 this_ptr_conv.is_owned = false;
18095 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18099 LDKOpenChannel this_ptr_conv;
18100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18101 this_ptr_conv.is_owned = false;
18102 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
18106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18107 LDKOpenChannel this_ptr_conv;
18108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18109 this_ptr_conv.is_owned = false;
18110 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18113 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
18114 LDKOpenChannel this_ptr_conv;
18115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18116 this_ptr_conv.is_owned = false;
18117 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
18121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18122 LDKOpenChannel this_ptr_conv;
18123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18124 this_ptr_conv.is_owned = false;
18125 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
18128 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18129 LDKOpenChannel this_ptr_conv;
18130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18131 this_ptr_conv.is_owned = false;
18132 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
18136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18137 LDKOpenChannel this_ptr_conv;
18138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18139 this_ptr_conv.is_owned = false;
18140 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
18143 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
18144 LDKOpenChannel this_ptr_conv;
18145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18146 this_ptr_conv.is_owned = false;
18147 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
18151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18152 LDKOpenChannel this_ptr_conv;
18153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18154 this_ptr_conv.is_owned = false;
18155 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18159 LDKOpenChannel this_ptr_conv;
18160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18161 this_ptr_conv.is_owned = false;
18162 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18163 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
18167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18168 LDKOpenChannel this_ptr_conv;
18169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18170 this_ptr_conv.is_owned = false;
18171 LDKPublicKey val_ref;
18172 CHECK((*env)->GetArrayLength(env, val) == 33);
18173 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18174 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18178 LDKOpenChannel this_ptr_conv;
18179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18180 this_ptr_conv.is_owned = false;
18181 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
18186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18187 LDKOpenChannel this_ptr_conv;
18188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18189 this_ptr_conv.is_owned = false;
18190 LDKPublicKey val_ref;
18191 CHECK((*env)->GetArrayLength(env, val) == 33);
18192 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18193 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18197 LDKOpenChannel this_ptr_conv;
18198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18199 this_ptr_conv.is_owned = false;
18200 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18201 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
18205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18206 LDKOpenChannel this_ptr_conv;
18207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18208 this_ptr_conv.is_owned = false;
18209 LDKPublicKey val_ref;
18210 CHECK((*env)->GetArrayLength(env, val) == 33);
18211 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18212 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
18215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18216 LDKOpenChannel this_ptr_conv;
18217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18218 this_ptr_conv.is_owned = false;
18219 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18220 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
18224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18225 LDKOpenChannel this_ptr_conv;
18226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18227 this_ptr_conv.is_owned = false;
18228 LDKPublicKey val_ref;
18229 CHECK((*env)->GetArrayLength(env, val) == 33);
18230 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18231 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18235 LDKOpenChannel this_ptr_conv;
18236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18237 this_ptr_conv.is_owned = false;
18238 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18239 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
18243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18244 LDKOpenChannel this_ptr_conv;
18245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18246 this_ptr_conv.is_owned = false;
18247 LDKPublicKey val_ref;
18248 CHECK((*env)->GetArrayLength(env, val) == 33);
18249 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18250 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18253 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18254 LDKOpenChannel this_ptr_conv;
18255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18256 this_ptr_conv.is_owned = false;
18257 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18258 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
18262 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) {
18263 LDKOpenChannel this_ptr_conv;
18264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18265 this_ptr_conv.is_owned = false;
18266 LDKPublicKey val_ref;
18267 CHECK((*env)->GetArrayLength(env, val) == 33);
18268 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18269 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18272 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18273 LDKOpenChannel this_ptr_conv;
18274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18275 this_ptr_conv.is_owned = false;
18276 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
18280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18281 LDKOpenChannel this_ptr_conv;
18282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18283 this_ptr_conv.is_owned = false;
18284 OpenChannel_set_channel_flags(&this_ptr_conv, val);
18287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18288 LDKOpenChannel orig_conv;
18289 orig_conv.inner = (void*)(orig & (~1));
18290 orig_conv.is_owned = false;
18291 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
18292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18294 uint64_t ret_ref = (uint64_t)ret_var.inner;
18295 if (ret_var.is_owned) {
18301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18302 LDKAcceptChannel this_obj_conv;
18303 this_obj_conv.inner = (void*)(this_obj & (~1));
18304 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18305 AcceptChannel_free(this_obj_conv);
18308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18309 LDKAcceptChannel this_ptr_conv;
18310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18311 this_ptr_conv.is_owned = false;
18312 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18313 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
18317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18318 LDKAcceptChannel this_ptr_conv;
18319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18320 this_ptr_conv.is_owned = false;
18321 LDKThirtyTwoBytes val_ref;
18322 CHECK((*env)->GetArrayLength(env, val) == 32);
18323 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18324 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
18327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18328 LDKAcceptChannel this_ptr_conv;
18329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18330 this_ptr_conv.is_owned = false;
18331 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
18335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18336 LDKAcceptChannel this_ptr_conv;
18337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18338 this_ptr_conv.is_owned = false;
18339 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
18342 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) {
18343 LDKAcceptChannel this_ptr_conv;
18344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18345 this_ptr_conv.is_owned = false;
18346 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
18350 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) {
18351 LDKAcceptChannel this_ptr_conv;
18352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18353 this_ptr_conv.is_owned = false;
18354 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
18357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18358 LDKAcceptChannel this_ptr_conv;
18359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18360 this_ptr_conv.is_owned = false;
18361 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
18365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18366 LDKAcceptChannel this_ptr_conv;
18367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18368 this_ptr_conv.is_owned = false;
18369 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
18372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18373 LDKAcceptChannel this_ptr_conv;
18374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18375 this_ptr_conv.is_owned = false;
18376 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
18380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18381 LDKAcceptChannel this_ptr_conv;
18382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18383 this_ptr_conv.is_owned = false;
18384 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
18387 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
18388 LDKAcceptChannel this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
18395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18396 LDKAcceptChannel this_ptr_conv;
18397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18398 this_ptr_conv.is_owned = false;
18399 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
18402 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
18403 LDKAcceptChannel this_ptr_conv;
18404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18405 this_ptr_conv.is_owned = false;
18406 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
18410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18411 LDKAcceptChannel this_ptr_conv;
18412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18413 this_ptr_conv.is_owned = false;
18414 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
18417 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
18418 LDKAcceptChannel this_ptr_conv;
18419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18420 this_ptr_conv.is_owned = false;
18421 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
18425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18426 LDKAcceptChannel this_ptr_conv;
18427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18428 this_ptr_conv.is_owned = false;
18429 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
18432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18433 LDKAcceptChannel this_ptr_conv;
18434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18435 this_ptr_conv.is_owned = false;
18436 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18437 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
18441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18442 LDKAcceptChannel this_ptr_conv;
18443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18444 this_ptr_conv.is_owned = false;
18445 LDKPublicKey val_ref;
18446 CHECK((*env)->GetArrayLength(env, val) == 33);
18447 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18448 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
18451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18452 LDKAcceptChannel this_ptr_conv;
18453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18454 this_ptr_conv.is_owned = false;
18455 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18456 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
18460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18461 LDKAcceptChannel this_ptr_conv;
18462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18463 this_ptr_conv.is_owned = false;
18464 LDKPublicKey val_ref;
18465 CHECK((*env)->GetArrayLength(env, val) == 33);
18466 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18467 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
18470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18471 LDKAcceptChannel this_ptr_conv;
18472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18473 this_ptr_conv.is_owned = false;
18474 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18475 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
18479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18480 LDKAcceptChannel this_ptr_conv;
18481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18482 this_ptr_conv.is_owned = false;
18483 LDKPublicKey val_ref;
18484 CHECK((*env)->GetArrayLength(env, val) == 33);
18485 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18486 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
18489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18490 LDKAcceptChannel this_ptr_conv;
18491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18492 this_ptr_conv.is_owned = false;
18493 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18494 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
18498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18499 LDKAcceptChannel this_ptr_conv;
18500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18501 this_ptr_conv.is_owned = false;
18502 LDKPublicKey val_ref;
18503 CHECK((*env)->GetArrayLength(env, val) == 33);
18504 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18505 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
18508 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
18509 LDKAcceptChannel this_ptr_conv;
18510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18511 this_ptr_conv.is_owned = false;
18512 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18513 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
18517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18518 LDKAcceptChannel this_ptr_conv;
18519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18520 this_ptr_conv.is_owned = false;
18521 LDKPublicKey val_ref;
18522 CHECK((*env)->GetArrayLength(env, val) == 33);
18523 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18524 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
18527 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18528 LDKAcceptChannel this_ptr_conv;
18529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18530 this_ptr_conv.is_owned = false;
18531 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18532 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
18536 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) {
18537 LDKAcceptChannel this_ptr_conv;
18538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18539 this_ptr_conv.is_owned = false;
18540 LDKPublicKey val_ref;
18541 CHECK((*env)->GetArrayLength(env, val) == 33);
18542 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18543 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
18546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18547 LDKAcceptChannel orig_conv;
18548 orig_conv.inner = (void*)(orig & (~1));
18549 orig_conv.is_owned = false;
18550 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
18551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18553 uint64_t ret_ref = (uint64_t)ret_var.inner;
18554 if (ret_var.is_owned) {
18560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18561 LDKFundingCreated this_obj_conv;
18562 this_obj_conv.inner = (void*)(this_obj & (~1));
18563 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18564 FundingCreated_free(this_obj_conv);
18567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18568 LDKFundingCreated this_ptr_conv;
18569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18570 this_ptr_conv.is_owned = false;
18571 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18572 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
18576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18577 LDKFundingCreated this_ptr_conv;
18578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18579 this_ptr_conv.is_owned = false;
18580 LDKThirtyTwoBytes val_ref;
18581 CHECK((*env)->GetArrayLength(env, val) == 32);
18582 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18583 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
18586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
18587 LDKFundingCreated this_ptr_conv;
18588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18589 this_ptr_conv.is_owned = false;
18590 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18591 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
18595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18596 LDKFundingCreated this_ptr_conv;
18597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18598 this_ptr_conv.is_owned = false;
18599 LDKThirtyTwoBytes val_ref;
18600 CHECK((*env)->GetArrayLength(env, val) == 32);
18601 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18602 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
18605 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
18606 LDKFundingCreated this_ptr_conv;
18607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18608 this_ptr_conv.is_owned = false;
18609 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
18613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18614 LDKFundingCreated this_ptr_conv;
18615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18616 this_ptr_conv.is_owned = false;
18617 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
18620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18621 LDKFundingCreated this_ptr_conv;
18622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18623 this_ptr_conv.is_owned = false;
18624 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
18629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18630 LDKFundingCreated this_ptr_conv;
18631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18632 this_ptr_conv.is_owned = false;
18633 LDKSignature val_ref;
18634 CHECK((*env)->GetArrayLength(env, val) == 64);
18635 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18636 FundingCreated_set_signature(&this_ptr_conv, val_ref);
18639 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) {
18640 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
18641 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
18642 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
18643 LDKThirtyTwoBytes funding_txid_arg_ref;
18644 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
18645 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
18646 LDKSignature signature_arg_ref;
18647 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18648 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18649 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
18650 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18651 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18652 uint64_t ret_ref = (uint64_t)ret_var.inner;
18653 if (ret_var.is_owned) {
18659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18660 LDKFundingCreated orig_conv;
18661 orig_conv.inner = (void*)(orig & (~1));
18662 orig_conv.is_owned = false;
18663 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
18664 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18665 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18666 uint64_t ret_ref = (uint64_t)ret_var.inner;
18667 if (ret_var.is_owned) {
18673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18674 LDKFundingSigned this_obj_conv;
18675 this_obj_conv.inner = (void*)(this_obj & (~1));
18676 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18677 FundingSigned_free(this_obj_conv);
18680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18681 LDKFundingSigned this_ptr_conv;
18682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18683 this_ptr_conv.is_owned = false;
18684 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
18689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18690 LDKFundingSigned this_ptr_conv;
18691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18692 this_ptr_conv.is_owned = false;
18693 LDKThirtyTwoBytes val_ref;
18694 CHECK((*env)->GetArrayLength(env, val) == 32);
18695 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18696 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
18699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18700 LDKFundingSigned this_ptr_conv;
18701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18702 this_ptr_conv.is_owned = false;
18703 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18704 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
18708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18709 LDKFundingSigned this_ptr_conv;
18710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18711 this_ptr_conv.is_owned = false;
18712 LDKSignature val_ref;
18713 CHECK((*env)->GetArrayLength(env, val) == 64);
18714 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18715 FundingSigned_set_signature(&this_ptr_conv, val_ref);
18718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
18719 LDKThirtyTwoBytes channel_id_arg_ref;
18720 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18721 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18722 LDKSignature signature_arg_ref;
18723 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18724 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18725 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
18726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18728 uint64_t ret_ref = (uint64_t)ret_var.inner;
18729 if (ret_var.is_owned) {
18735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18736 LDKFundingSigned orig_conv;
18737 orig_conv.inner = (void*)(orig & (~1));
18738 orig_conv.is_owned = false;
18739 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
18740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18742 uint64_t ret_ref = (uint64_t)ret_var.inner;
18743 if (ret_var.is_owned) {
18749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18750 LDKFundingLocked this_obj_conv;
18751 this_obj_conv.inner = (void*)(this_obj & (~1));
18752 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18753 FundingLocked_free(this_obj_conv);
18756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18757 LDKFundingLocked this_ptr_conv;
18758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18759 this_ptr_conv.is_owned = false;
18760 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18761 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
18765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18766 LDKFundingLocked this_ptr_conv;
18767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18768 this_ptr_conv.is_owned = false;
18769 LDKThirtyTwoBytes val_ref;
18770 CHECK((*env)->GetArrayLength(env, val) == 32);
18771 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18772 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
18775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18776 LDKFundingLocked this_ptr_conv;
18777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18778 this_ptr_conv.is_owned = false;
18779 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18780 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18784 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) {
18785 LDKFundingLocked this_ptr_conv;
18786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18787 this_ptr_conv.is_owned = false;
18788 LDKPublicKey val_ref;
18789 CHECK((*env)->GetArrayLength(env, val) == 33);
18790 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18791 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18794 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) {
18795 LDKThirtyTwoBytes channel_id_arg_ref;
18796 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18797 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18798 LDKPublicKey next_per_commitment_point_arg_ref;
18799 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18800 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18801 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
18802 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18803 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18804 uint64_t ret_ref = (uint64_t)ret_var.inner;
18805 if (ret_var.is_owned) {
18811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18812 LDKFundingLocked orig_conv;
18813 orig_conv.inner = (void*)(orig & (~1));
18814 orig_conv.is_owned = false;
18815 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
18816 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18817 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18818 uint64_t ret_ref = (uint64_t)ret_var.inner;
18819 if (ret_var.is_owned) {
18825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18826 LDKShutdown this_obj_conv;
18827 this_obj_conv.inner = (void*)(this_obj & (~1));
18828 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18829 Shutdown_free(this_obj_conv);
18832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18833 LDKShutdown this_ptr_conv;
18834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18835 this_ptr_conv.is_owned = false;
18836 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18837 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
18841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18842 LDKShutdown this_ptr_conv;
18843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18844 this_ptr_conv.is_owned = false;
18845 LDKThirtyTwoBytes val_ref;
18846 CHECK((*env)->GetArrayLength(env, val) == 32);
18847 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18848 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
18851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18852 LDKShutdown this_ptr_conv;
18853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18854 this_ptr_conv.is_owned = false;
18855 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
18856 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18857 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18862 LDKShutdown this_ptr_conv;
18863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18864 this_ptr_conv.is_owned = false;
18865 LDKCVec_u8Z val_ref;
18866 val_ref.datalen = (*env)->GetArrayLength(env, val);
18867 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18868 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18869 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18873 LDKThirtyTwoBytes channel_id_arg_ref;
18874 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18875 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18876 LDKCVec_u8Z scriptpubkey_arg_ref;
18877 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
18878 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18879 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
18880 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18883 uint64_t ret_ref = (uint64_t)ret_var.inner;
18884 if (ret_var.is_owned) {
18890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18891 LDKShutdown orig_conv;
18892 orig_conv.inner = (void*)(orig & (~1));
18893 orig_conv.is_owned = false;
18894 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18897 uint64_t ret_ref = (uint64_t)ret_var.inner;
18898 if (ret_var.is_owned) {
18904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18905 LDKClosingSignedFeeRange this_obj_conv;
18906 this_obj_conv.inner = (void*)(this_obj & (~1));
18907 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18908 ClosingSignedFeeRange_free(this_obj_conv);
18911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18912 LDKClosingSignedFeeRange this_ptr_conv;
18913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18914 this_ptr_conv.is_owned = false;
18915 int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
18919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18920 LDKClosingSignedFeeRange this_ptr_conv;
18921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18922 this_ptr_conv.is_owned = false;
18923 ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
18926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18927 LDKClosingSignedFeeRange this_ptr_conv;
18928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18929 this_ptr_conv.is_owned = false;
18930 int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
18934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18935 LDKClosingSignedFeeRange this_ptr_conv;
18936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18937 this_ptr_conv.is_owned = false;
18938 ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
18941 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) {
18942 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
18943 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18944 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18945 uint64_t ret_ref = (uint64_t)ret_var.inner;
18946 if (ret_var.is_owned) {
18952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18953 LDKClosingSignedFeeRange orig_conv;
18954 orig_conv.inner = (void*)(orig & (~1));
18955 orig_conv.is_owned = false;
18956 LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
18957 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18958 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18959 uint64_t ret_ref = (uint64_t)ret_var.inner;
18960 if (ret_var.is_owned) {
18966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18967 LDKClosingSigned this_obj_conv;
18968 this_obj_conv.inner = (void*)(this_obj & (~1));
18969 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18970 ClosingSigned_free(this_obj_conv);
18973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18974 LDKClosingSigned this_ptr_conv;
18975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18976 this_ptr_conv.is_owned = false;
18977 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18978 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
18982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18983 LDKClosingSigned this_ptr_conv;
18984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18985 this_ptr_conv.is_owned = false;
18986 LDKThirtyTwoBytes val_ref;
18987 CHECK((*env)->GetArrayLength(env, val) == 32);
18988 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18989 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18993 LDKClosingSigned this_ptr_conv;
18994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18995 this_ptr_conv.is_owned = false;
18996 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
19000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19001 LDKClosingSigned this_ptr_conv;
19002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19003 this_ptr_conv.is_owned = false;
19004 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
19007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19008 LDKClosingSigned this_ptr_conv;
19009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19010 this_ptr_conv.is_owned = false;
19011 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19012 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
19016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19017 LDKClosingSigned this_ptr_conv;
19018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19019 this_ptr_conv.is_owned = false;
19020 LDKSignature val_ref;
19021 CHECK((*env)->GetArrayLength(env, val) == 64);
19022 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19023 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
19026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19027 LDKClosingSigned this_ptr_conv;
19028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19029 this_ptr_conv.is_owned = false;
19030 LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
19031 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19032 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19033 uint64_t ret_ref = (uint64_t)ret_var.inner;
19034 if (ret_var.is_owned) {
19040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19041 LDKClosingSigned this_ptr_conv;
19042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19043 this_ptr_conv.is_owned = false;
19044 LDKClosingSignedFeeRange val_conv;
19045 val_conv.inner = (void*)(val & (~1));
19046 val_conv.is_owned = (val & 1) || (val == 0);
19047 val_conv = ClosingSignedFeeRange_clone(&val_conv);
19048 ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
19051 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) {
19052 LDKThirtyTwoBytes channel_id_arg_ref;
19053 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19054 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19055 LDKSignature signature_arg_ref;
19056 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19057 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19058 LDKClosingSignedFeeRange fee_range_arg_conv;
19059 fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
19060 fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
19061 fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
19062 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
19063 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19064 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19065 uint64_t ret_ref = (uint64_t)ret_var.inner;
19066 if (ret_var.is_owned) {
19072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19073 LDKClosingSigned orig_conv;
19074 orig_conv.inner = (void*)(orig & (~1));
19075 orig_conv.is_owned = false;
19076 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
19077 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19078 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19079 uint64_t ret_ref = (uint64_t)ret_var.inner;
19080 if (ret_var.is_owned) {
19086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19087 LDKUpdateAddHTLC this_obj_conv;
19088 this_obj_conv.inner = (void*)(this_obj & (~1));
19089 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19090 UpdateAddHTLC_free(this_obj_conv);
19093 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19094 LDKUpdateAddHTLC this_ptr_conv;
19095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19096 this_ptr_conv.is_owned = false;
19097 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19098 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
19102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19103 LDKUpdateAddHTLC this_ptr_conv;
19104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19105 this_ptr_conv.is_owned = false;
19106 LDKThirtyTwoBytes val_ref;
19107 CHECK((*env)->GetArrayLength(env, val) == 32);
19108 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19109 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
19112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19113 LDKUpdateAddHTLC this_ptr_conv;
19114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19115 this_ptr_conv.is_owned = false;
19116 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
19120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19121 LDKUpdateAddHTLC this_ptr_conv;
19122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19123 this_ptr_conv.is_owned = false;
19124 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
19127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19128 LDKUpdateAddHTLC this_ptr_conv;
19129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19130 this_ptr_conv.is_owned = false;
19131 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
19135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19136 LDKUpdateAddHTLC this_ptr_conv;
19137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19138 this_ptr_conv.is_owned = false;
19139 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
19142 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19143 LDKUpdateAddHTLC this_ptr_conv;
19144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19145 this_ptr_conv.is_owned = false;
19146 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19147 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
19151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19152 LDKUpdateAddHTLC this_ptr_conv;
19153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19154 this_ptr_conv.is_owned = false;
19155 LDKThirtyTwoBytes val_ref;
19156 CHECK((*env)->GetArrayLength(env, val) == 32);
19157 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19158 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
19161 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
19162 LDKUpdateAddHTLC this_ptr_conv;
19163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19164 this_ptr_conv.is_owned = false;
19165 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
19169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19170 LDKUpdateAddHTLC this_ptr_conv;
19171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19172 this_ptr_conv.is_owned = false;
19173 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
19176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19177 LDKUpdateAddHTLC orig_conv;
19178 orig_conv.inner = (void*)(orig & (~1));
19179 orig_conv.is_owned = false;
19180 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
19181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19183 uint64_t ret_ref = (uint64_t)ret_var.inner;
19184 if (ret_var.is_owned) {
19190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19191 LDKUpdateFulfillHTLC this_obj_conv;
19192 this_obj_conv.inner = (void*)(this_obj & (~1));
19193 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19194 UpdateFulfillHTLC_free(this_obj_conv);
19197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19198 LDKUpdateFulfillHTLC this_ptr_conv;
19199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19200 this_ptr_conv.is_owned = false;
19201 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19202 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
19206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19207 LDKUpdateFulfillHTLC this_ptr_conv;
19208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19209 this_ptr_conv.is_owned = false;
19210 LDKThirtyTwoBytes val_ref;
19211 CHECK((*env)->GetArrayLength(env, val) == 32);
19212 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19213 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
19216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19217 LDKUpdateFulfillHTLC this_ptr_conv;
19218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19219 this_ptr_conv.is_owned = false;
19220 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
19224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19225 LDKUpdateFulfillHTLC this_ptr_conv;
19226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19227 this_ptr_conv.is_owned = false;
19228 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
19231 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
19232 LDKUpdateFulfillHTLC this_ptr_conv;
19233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19234 this_ptr_conv.is_owned = false;
19235 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19236 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
19240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19241 LDKUpdateFulfillHTLC this_ptr_conv;
19242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19243 this_ptr_conv.is_owned = false;
19244 LDKThirtyTwoBytes val_ref;
19245 CHECK((*env)->GetArrayLength(env, val) == 32);
19246 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19247 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
19250 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) {
19251 LDKThirtyTwoBytes channel_id_arg_ref;
19252 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19253 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19254 LDKThirtyTwoBytes payment_preimage_arg_ref;
19255 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
19256 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
19257 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
19258 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19259 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19260 uint64_t ret_ref = (uint64_t)ret_var.inner;
19261 if (ret_var.is_owned) {
19267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19268 LDKUpdateFulfillHTLC orig_conv;
19269 orig_conv.inner = (void*)(orig & (~1));
19270 orig_conv.is_owned = false;
19271 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
19272 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19273 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19274 uint64_t ret_ref = (uint64_t)ret_var.inner;
19275 if (ret_var.is_owned) {
19281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19282 LDKUpdateFailHTLC this_obj_conv;
19283 this_obj_conv.inner = (void*)(this_obj & (~1));
19284 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19285 UpdateFailHTLC_free(this_obj_conv);
19288 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19289 LDKUpdateFailHTLC this_ptr_conv;
19290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19291 this_ptr_conv.is_owned = false;
19292 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19293 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
19297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19298 LDKUpdateFailHTLC this_ptr_conv;
19299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19300 this_ptr_conv.is_owned = false;
19301 LDKThirtyTwoBytes val_ref;
19302 CHECK((*env)->GetArrayLength(env, val) == 32);
19303 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19304 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
19307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19308 LDKUpdateFailHTLC this_ptr_conv;
19309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19310 this_ptr_conv.is_owned = false;
19311 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
19315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19316 LDKUpdateFailHTLC this_ptr_conv;
19317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19318 this_ptr_conv.is_owned = false;
19319 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
19322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19323 LDKUpdateFailHTLC orig_conv;
19324 orig_conv.inner = (void*)(orig & (~1));
19325 orig_conv.is_owned = false;
19326 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
19327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19329 uint64_t ret_ref = (uint64_t)ret_var.inner;
19330 if (ret_var.is_owned) {
19336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19337 LDKUpdateFailMalformedHTLC this_obj_conv;
19338 this_obj_conv.inner = (void*)(this_obj & (~1));
19339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19340 UpdateFailMalformedHTLC_free(this_obj_conv);
19343 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19344 LDKUpdateFailMalformedHTLC this_ptr_conv;
19345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19346 this_ptr_conv.is_owned = false;
19347 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19348 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
19352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19353 LDKUpdateFailMalformedHTLC this_ptr_conv;
19354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19355 this_ptr_conv.is_owned = false;
19356 LDKThirtyTwoBytes val_ref;
19357 CHECK((*env)->GetArrayLength(env, val) == 32);
19358 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19359 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
19362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19363 LDKUpdateFailMalformedHTLC this_ptr_conv;
19364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19365 this_ptr_conv.is_owned = false;
19366 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
19370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19371 LDKUpdateFailMalformedHTLC this_ptr_conv;
19372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19373 this_ptr_conv.is_owned = false;
19374 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
19377 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
19378 LDKUpdateFailMalformedHTLC this_ptr_conv;
19379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19380 this_ptr_conv.is_owned = false;
19381 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
19385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19386 LDKUpdateFailMalformedHTLC this_ptr_conv;
19387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19388 this_ptr_conv.is_owned = false;
19389 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
19392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19393 LDKUpdateFailMalformedHTLC orig_conv;
19394 orig_conv.inner = (void*)(orig & (~1));
19395 orig_conv.is_owned = false;
19396 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
19397 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19398 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19399 uint64_t ret_ref = (uint64_t)ret_var.inner;
19400 if (ret_var.is_owned) {
19406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19407 LDKCommitmentSigned this_obj_conv;
19408 this_obj_conv.inner = (void*)(this_obj & (~1));
19409 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19410 CommitmentSigned_free(this_obj_conv);
19413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19414 LDKCommitmentSigned this_ptr_conv;
19415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19416 this_ptr_conv.is_owned = false;
19417 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19418 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
19422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19423 LDKCommitmentSigned this_ptr_conv;
19424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19425 this_ptr_conv.is_owned = false;
19426 LDKThirtyTwoBytes val_ref;
19427 CHECK((*env)->GetArrayLength(env, val) == 32);
19428 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19429 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
19432 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19433 LDKCommitmentSigned this_ptr_conv;
19434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19435 this_ptr_conv.is_owned = false;
19436 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19437 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
19441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19442 LDKCommitmentSigned this_ptr_conv;
19443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19444 this_ptr_conv.is_owned = false;
19445 LDKSignature val_ref;
19446 CHECK((*env)->GetArrayLength(env, val) == 64);
19447 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19448 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
19451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
19452 LDKCommitmentSigned this_ptr_conv;
19453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19454 this_ptr_conv.is_owned = false;
19455 LDKCVec_SignatureZ val_constr;
19456 val_constr.datalen = (*env)->GetArrayLength(env, val);
19457 if (val_constr.datalen > 0)
19458 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19460 val_constr.data = NULL;
19461 for (size_t i = 0; i < val_constr.datalen; i++) {
19462 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
19463 LDKSignature val_conv_8_ref;
19464 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
19465 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
19466 val_constr.data[i] = val_conv_8_ref;
19468 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
19471 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) {
19472 LDKThirtyTwoBytes channel_id_arg_ref;
19473 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19474 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19475 LDKSignature signature_arg_ref;
19476 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19477 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19478 LDKCVec_SignatureZ htlc_signatures_arg_constr;
19479 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
19480 if (htlc_signatures_arg_constr.datalen > 0)
19481 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
19483 htlc_signatures_arg_constr.data = NULL;
19484 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
19485 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
19486 LDKSignature htlc_signatures_arg_conv_8_ref;
19487 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
19488 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
19489 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
19491 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
19492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19494 uint64_t ret_ref = (uint64_t)ret_var.inner;
19495 if (ret_var.is_owned) {
19501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19502 LDKCommitmentSigned orig_conv;
19503 orig_conv.inner = (void*)(orig & (~1));
19504 orig_conv.is_owned = false;
19505 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
19506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19508 uint64_t ret_ref = (uint64_t)ret_var.inner;
19509 if (ret_var.is_owned) {
19515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19516 LDKRevokeAndACK this_obj_conv;
19517 this_obj_conv.inner = (void*)(this_obj & (~1));
19518 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19519 RevokeAndACK_free(this_obj_conv);
19522 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19523 LDKRevokeAndACK this_ptr_conv;
19524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19525 this_ptr_conv.is_owned = false;
19526 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19527 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
19531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19532 LDKRevokeAndACK this_ptr_conv;
19533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19534 this_ptr_conv.is_owned = false;
19535 LDKThirtyTwoBytes val_ref;
19536 CHECK((*env)->GetArrayLength(env, val) == 32);
19537 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19538 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
19541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
19542 LDKRevokeAndACK this_ptr_conv;
19543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19544 this_ptr_conv.is_owned = false;
19545 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19546 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
19550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19551 LDKRevokeAndACK this_ptr_conv;
19552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19553 this_ptr_conv.is_owned = false;
19554 LDKThirtyTwoBytes val_ref;
19555 CHECK((*env)->GetArrayLength(env, val) == 32);
19556 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19557 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
19560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19561 LDKRevokeAndACK this_ptr_conv;
19562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19563 this_ptr_conv.is_owned = false;
19564 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19565 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
19569 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) {
19570 LDKRevokeAndACK this_ptr_conv;
19571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19572 this_ptr_conv.is_owned = false;
19573 LDKPublicKey val_ref;
19574 CHECK((*env)->GetArrayLength(env, val) == 33);
19575 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19576 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
19579 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) {
19580 LDKThirtyTwoBytes channel_id_arg_ref;
19581 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19582 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19583 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
19584 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
19585 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
19586 LDKPublicKey next_per_commitment_point_arg_ref;
19587 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
19588 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
19589 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
19590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19592 uint64_t ret_ref = (uint64_t)ret_var.inner;
19593 if (ret_var.is_owned) {
19599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19600 LDKRevokeAndACK orig_conv;
19601 orig_conv.inner = (void*)(orig & (~1));
19602 orig_conv.is_owned = false;
19603 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
19604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19606 uint64_t ret_ref = (uint64_t)ret_var.inner;
19607 if (ret_var.is_owned) {
19613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19614 LDKUpdateFee this_obj_conv;
19615 this_obj_conv.inner = (void*)(this_obj & (~1));
19616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19617 UpdateFee_free(this_obj_conv);
19620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19621 LDKUpdateFee this_ptr_conv;
19622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19623 this_ptr_conv.is_owned = false;
19624 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19625 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
19629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19630 LDKUpdateFee this_ptr_conv;
19631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19632 this_ptr_conv.is_owned = false;
19633 LDKThirtyTwoBytes val_ref;
19634 CHECK((*env)->GetArrayLength(env, val) == 32);
19635 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19636 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
19639 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
19640 LDKUpdateFee this_ptr_conv;
19641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19642 this_ptr_conv.is_owned = false;
19643 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
19647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19648 LDKUpdateFee this_ptr_conv;
19649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19650 this_ptr_conv.is_owned = false;
19651 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
19654 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) {
19655 LDKThirtyTwoBytes channel_id_arg_ref;
19656 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19657 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19658 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
19659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19661 uint64_t ret_ref = (uint64_t)ret_var.inner;
19662 if (ret_var.is_owned) {
19668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19669 LDKUpdateFee orig_conv;
19670 orig_conv.inner = (void*)(orig & (~1));
19671 orig_conv.is_owned = false;
19672 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
19673 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19674 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19675 uint64_t ret_ref = (uint64_t)ret_var.inner;
19676 if (ret_var.is_owned) {
19682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19683 LDKDataLossProtect this_obj_conv;
19684 this_obj_conv.inner = (void*)(this_obj & (~1));
19685 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19686 DataLossProtect_free(this_obj_conv);
19689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
19690 LDKDataLossProtect this_ptr_conv;
19691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19692 this_ptr_conv.is_owned = false;
19693 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19694 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
19698 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) {
19699 LDKDataLossProtect this_ptr_conv;
19700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19701 this_ptr_conv.is_owned = false;
19702 LDKThirtyTwoBytes val_ref;
19703 CHECK((*env)->GetArrayLength(env, val) == 32);
19704 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19705 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
19708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
19709 LDKDataLossProtect this_ptr_conv;
19710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19711 this_ptr_conv.is_owned = false;
19712 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19713 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
19717 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) {
19718 LDKDataLossProtect this_ptr_conv;
19719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19720 this_ptr_conv.is_owned = false;
19721 LDKPublicKey val_ref;
19722 CHECK((*env)->GetArrayLength(env, val) == 33);
19723 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19724 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
19727 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) {
19728 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
19729 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
19730 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
19731 LDKPublicKey my_current_per_commitment_point_arg_ref;
19732 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
19733 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
19734 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
19735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19737 uint64_t ret_ref = (uint64_t)ret_var.inner;
19738 if (ret_var.is_owned) {
19744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19745 LDKDataLossProtect orig_conv;
19746 orig_conv.inner = (void*)(orig & (~1));
19747 orig_conv.is_owned = false;
19748 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
19749 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19750 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19751 uint64_t ret_ref = (uint64_t)ret_var.inner;
19752 if (ret_var.is_owned) {
19758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19759 LDKChannelReestablish this_obj_conv;
19760 this_obj_conv.inner = (void*)(this_obj & (~1));
19761 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19762 ChannelReestablish_free(this_obj_conv);
19765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19766 LDKChannelReestablish this_ptr_conv;
19767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19768 this_ptr_conv.is_owned = false;
19769 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19770 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
19774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19775 LDKChannelReestablish this_ptr_conv;
19776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19777 this_ptr_conv.is_owned = false;
19778 LDKThirtyTwoBytes val_ref;
19779 CHECK((*env)->GetArrayLength(env, val) == 32);
19780 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19781 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
19784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
19785 LDKChannelReestablish this_ptr_conv;
19786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19787 this_ptr_conv.is_owned = false;
19788 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
19792 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) {
19793 LDKChannelReestablish this_ptr_conv;
19794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19795 this_ptr_conv.is_owned = false;
19796 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
19799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
19800 LDKChannelReestablish this_ptr_conv;
19801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19802 this_ptr_conv.is_owned = false;
19803 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
19807 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) {
19808 LDKChannelReestablish this_ptr_conv;
19809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19810 this_ptr_conv.is_owned = false;
19811 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
19814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19815 LDKChannelReestablish orig_conv;
19816 orig_conv.inner = (void*)(orig & (~1));
19817 orig_conv.is_owned = false;
19818 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
19819 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19820 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19821 uint64_t ret_ref = (uint64_t)ret_var.inner;
19822 if (ret_var.is_owned) {
19828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19829 LDKAnnouncementSignatures this_obj_conv;
19830 this_obj_conv.inner = (void*)(this_obj & (~1));
19831 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19832 AnnouncementSignatures_free(this_obj_conv);
19835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19836 LDKAnnouncementSignatures this_ptr_conv;
19837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19838 this_ptr_conv.is_owned = false;
19839 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19840 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
19844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19845 LDKAnnouncementSignatures this_ptr_conv;
19846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19847 this_ptr_conv.is_owned = false;
19848 LDKThirtyTwoBytes val_ref;
19849 CHECK((*env)->GetArrayLength(env, val) == 32);
19850 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19851 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
19854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19855 LDKAnnouncementSignatures this_ptr_conv;
19856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19857 this_ptr_conv.is_owned = false;
19858 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
19862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19863 LDKAnnouncementSignatures this_ptr_conv;
19864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19865 this_ptr_conv.is_owned = false;
19866 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19870 LDKAnnouncementSignatures this_ptr_conv;
19871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19872 this_ptr_conv.is_owned = false;
19873 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
19878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19879 LDKAnnouncementSignatures this_ptr_conv;
19880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19881 this_ptr_conv.is_owned = false;
19882 LDKSignature val_ref;
19883 CHECK((*env)->GetArrayLength(env, val) == 64);
19884 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19885 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19889 LDKAnnouncementSignatures this_ptr_conv;
19890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19891 this_ptr_conv.is_owned = false;
19892 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19893 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
19897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19898 LDKAnnouncementSignatures this_ptr_conv;
19899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19900 this_ptr_conv.is_owned = false;
19901 LDKSignature val_ref;
19902 CHECK((*env)->GetArrayLength(env, val) == 64);
19903 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19904 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19907 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) {
19908 LDKThirtyTwoBytes channel_id_arg_ref;
19909 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19910 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19911 LDKSignature node_signature_arg_ref;
19912 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
19913 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
19914 LDKSignature bitcoin_signature_arg_ref;
19915 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
19916 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
19917 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19918 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19919 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19920 uint64_t ret_ref = (uint64_t)ret_var.inner;
19921 if (ret_var.is_owned) {
19927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19928 LDKAnnouncementSignatures orig_conv;
19929 orig_conv.inner = (void*)(orig & (~1));
19930 orig_conv.is_owned = false;
19931 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19932 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19933 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19934 uint64_t ret_ref = (uint64_t)ret_var.inner;
19935 if (ret_var.is_owned) {
19941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19942 if ((this_ptr & 1) != 0) return;
19943 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
19944 FREE((void*)this_ptr);
19945 NetAddress_free(this_ptr_conv);
19948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19949 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19950 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19951 *ret_copy = NetAddress_clone(orig_conv);
19952 uint64_t ret_ref = (uint64_t)ret_copy;
19956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19957 LDKFourBytes addr_ref;
19958 CHECK((*env)->GetArrayLength(env, addr) == 4);
19959 (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
19960 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19961 *ret_copy = NetAddress_ipv4(addr_ref, port);
19962 uint64_t ret_ref = (uint64_t)ret_copy;
19966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19967 LDKSixteenBytes addr_ref;
19968 CHECK((*env)->GetArrayLength(env, addr) == 16);
19969 (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
19970 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19971 *ret_copy = NetAddress_ipv6(addr_ref, port);
19972 uint64_t ret_ref = (uint64_t)ret_copy;
19976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
19977 LDKTenBytes addr_ref;
19978 CHECK((*env)->GetArrayLength(env, addr) == 10);
19979 (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data);
19980 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19981 *ret_copy = NetAddress_onion_v2(addr_ref, port);
19982 uint64_t ret_ref = (uint64_t)ret_copy;
19986 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) {
19987 LDKThirtyTwoBytes ed25519_pubkey_ref;
19988 CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
19989 (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
19990 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19991 *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
19992 uint64_t ret_ref = (uint64_t)ret_copy;
19996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
19997 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19998 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19999 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20000 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20001 CVec_u8Z_free(ret_var);
20005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20006 LDKu8slice ser_ref;
20007 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20008 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20009 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
20010 *ret_conv = Result_read(ser_ref);
20011 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20012 return (uint64_t)ret_conv;
20015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20016 LDKu8slice ser_ref;
20017 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20018 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20019 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
20020 *ret_conv = NetAddress_read(ser_ref);
20021 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20022 return (uint64_t)ret_conv;
20025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20026 LDKUnsignedNodeAnnouncement this_obj_conv;
20027 this_obj_conv.inner = (void*)(this_obj & (~1));
20028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20029 UnsignedNodeAnnouncement_free(this_obj_conv);
20032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20033 LDKUnsignedNodeAnnouncement this_ptr_conv;
20034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20035 this_ptr_conv.is_owned = false;
20036 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
20037 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20038 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20039 uint64_t ret_ref = (uint64_t)ret_var.inner;
20040 if (ret_var.is_owned) {
20046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20047 LDKUnsignedNodeAnnouncement this_ptr_conv;
20048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20049 this_ptr_conv.is_owned = false;
20050 LDKNodeFeatures val_conv;
20051 val_conv.inner = (void*)(val & (~1));
20052 val_conv.is_owned = (val & 1) || (val == 0);
20053 val_conv = NodeFeatures_clone(&val_conv);
20054 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
20057 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
20058 LDKUnsignedNodeAnnouncement this_ptr_conv;
20059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20060 this_ptr_conv.is_owned = false;
20061 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
20065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20066 LDKUnsignedNodeAnnouncement this_ptr_conv;
20067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20068 this_ptr_conv.is_owned = false;
20069 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
20072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20073 LDKUnsignedNodeAnnouncement this_ptr_conv;
20074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20075 this_ptr_conv.is_owned = false;
20076 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20077 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
20081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20082 LDKUnsignedNodeAnnouncement this_ptr_conv;
20083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20084 this_ptr_conv.is_owned = false;
20085 LDKPublicKey val_ref;
20086 CHECK((*env)->GetArrayLength(env, val) == 33);
20087 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20088 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
20091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
20092 LDKUnsignedNodeAnnouncement this_ptr_conv;
20093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20094 this_ptr_conv.is_owned = false;
20095 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
20096 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
20100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20101 LDKUnsignedNodeAnnouncement this_ptr_conv;
20102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20103 this_ptr_conv.is_owned = false;
20104 LDKThreeBytes val_ref;
20105 CHECK((*env)->GetArrayLength(env, val) == 3);
20106 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
20107 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
20110 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
20111 LDKUnsignedNodeAnnouncement this_ptr_conv;
20112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20113 this_ptr_conv.is_owned = false;
20114 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20115 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
20119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20120 LDKUnsignedNodeAnnouncement this_ptr_conv;
20121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20122 this_ptr_conv.is_owned = false;
20123 LDKThirtyTwoBytes val_ref;
20124 CHECK((*env)->GetArrayLength(env, val) == 32);
20125 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20126 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
20129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20130 LDKUnsignedNodeAnnouncement this_ptr_conv;
20131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20132 this_ptr_conv.is_owned = false;
20133 LDKCVec_NetAddressZ val_constr;
20134 val_constr.datalen = (*env)->GetArrayLength(env, val);
20135 if (val_constr.datalen > 0)
20136 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20138 val_constr.data = NULL;
20139 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20140 for (size_t m = 0; m < val_constr.datalen; m++) {
20141 int64_t val_conv_12 = val_vals[m];
20142 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
20143 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
20144 val_constr.data[m] = val_conv_12_conv;
20146 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20147 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
20150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20151 LDKUnsignedNodeAnnouncement orig_conv;
20152 orig_conv.inner = (void*)(orig & (~1));
20153 orig_conv.is_owned = false;
20154 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
20155 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20156 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20157 uint64_t ret_ref = (uint64_t)ret_var.inner;
20158 if (ret_var.is_owned) {
20164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20165 LDKNodeAnnouncement this_obj_conv;
20166 this_obj_conv.inner = (void*)(this_obj & (~1));
20167 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20168 NodeAnnouncement_free(this_obj_conv);
20171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20172 LDKNodeAnnouncement this_ptr_conv;
20173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20174 this_ptr_conv.is_owned = false;
20175 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20176 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
20180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20181 LDKNodeAnnouncement this_ptr_conv;
20182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20183 this_ptr_conv.is_owned = false;
20184 LDKSignature val_ref;
20185 CHECK((*env)->GetArrayLength(env, val) == 64);
20186 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20187 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
20190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20191 LDKNodeAnnouncement this_ptr_conv;
20192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20193 this_ptr_conv.is_owned = false;
20194 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
20195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20197 uint64_t ret_ref = (uint64_t)ret_var.inner;
20198 if (ret_var.is_owned) {
20204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20205 LDKNodeAnnouncement this_ptr_conv;
20206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20207 this_ptr_conv.is_owned = false;
20208 LDKUnsignedNodeAnnouncement val_conv;
20209 val_conv.inner = (void*)(val & (~1));
20210 val_conv.is_owned = (val & 1) || (val == 0);
20211 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
20212 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
20215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
20216 LDKSignature signature_arg_ref;
20217 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20218 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20219 LDKUnsignedNodeAnnouncement contents_arg_conv;
20220 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20221 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20222 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
20223 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
20224 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20225 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20226 uint64_t ret_ref = (uint64_t)ret_var.inner;
20227 if (ret_var.is_owned) {
20233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20234 LDKNodeAnnouncement orig_conv;
20235 orig_conv.inner = (void*)(orig & (~1));
20236 orig_conv.is_owned = false;
20237 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
20238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20240 uint64_t ret_ref = (uint64_t)ret_var.inner;
20241 if (ret_var.is_owned) {
20247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20248 LDKUnsignedChannelAnnouncement this_obj_conv;
20249 this_obj_conv.inner = (void*)(this_obj & (~1));
20250 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20251 UnsignedChannelAnnouncement_free(this_obj_conv);
20254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
20255 LDKUnsignedChannelAnnouncement this_ptr_conv;
20256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20257 this_ptr_conv.is_owned = false;
20258 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
20259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20261 uint64_t ret_ref = (uint64_t)ret_var.inner;
20262 if (ret_var.is_owned) {
20268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20269 LDKUnsignedChannelAnnouncement this_ptr_conv;
20270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20271 this_ptr_conv.is_owned = false;
20272 LDKChannelFeatures val_conv;
20273 val_conv.inner = (void*)(val & (~1));
20274 val_conv.is_owned = (val & 1) || (val == 0);
20275 val_conv = ChannelFeatures_clone(&val_conv);
20276 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
20279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20280 LDKUnsignedChannelAnnouncement this_ptr_conv;
20281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20282 this_ptr_conv.is_owned = false;
20283 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20284 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
20288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20289 LDKUnsignedChannelAnnouncement this_ptr_conv;
20290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20291 this_ptr_conv.is_owned = false;
20292 LDKThirtyTwoBytes val_ref;
20293 CHECK((*env)->GetArrayLength(env, val) == 32);
20294 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20295 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
20298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20299 LDKUnsignedChannelAnnouncement this_ptr_conv;
20300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20301 this_ptr_conv.is_owned = false;
20302 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
20306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20307 LDKUnsignedChannelAnnouncement this_ptr_conv;
20308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20309 this_ptr_conv.is_owned = false;
20310 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
20313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20314 LDKUnsignedChannelAnnouncement this_ptr_conv;
20315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20316 this_ptr_conv.is_owned = false;
20317 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20318 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
20322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20323 LDKUnsignedChannelAnnouncement this_ptr_conv;
20324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20325 this_ptr_conv.is_owned = false;
20326 LDKPublicKey val_ref;
20327 CHECK((*env)->GetArrayLength(env, val) == 33);
20328 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20329 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
20332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20333 LDKUnsignedChannelAnnouncement this_ptr_conv;
20334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20335 this_ptr_conv.is_owned = false;
20336 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20337 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
20341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20342 LDKUnsignedChannelAnnouncement this_ptr_conv;
20343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20344 this_ptr_conv.is_owned = false;
20345 LDKPublicKey val_ref;
20346 CHECK((*env)->GetArrayLength(env, val) == 33);
20347 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20348 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
20351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20352 LDKUnsignedChannelAnnouncement this_ptr_conv;
20353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20354 this_ptr_conv.is_owned = false;
20355 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20356 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
20360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20361 LDKUnsignedChannelAnnouncement this_ptr_conv;
20362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20363 this_ptr_conv.is_owned = false;
20364 LDKPublicKey val_ref;
20365 CHECK((*env)->GetArrayLength(env, val) == 33);
20366 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20367 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
20370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20371 LDKUnsignedChannelAnnouncement this_ptr_conv;
20372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20373 this_ptr_conv.is_owned = false;
20374 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20375 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
20379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20380 LDKUnsignedChannelAnnouncement this_ptr_conv;
20381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20382 this_ptr_conv.is_owned = false;
20383 LDKPublicKey val_ref;
20384 CHECK((*env)->GetArrayLength(env, val) == 33);
20385 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20386 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
20389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20390 LDKUnsignedChannelAnnouncement orig_conv;
20391 orig_conv.inner = (void*)(orig & (~1));
20392 orig_conv.is_owned = false;
20393 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
20394 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20395 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20396 uint64_t ret_ref = (uint64_t)ret_var.inner;
20397 if (ret_var.is_owned) {
20403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20404 LDKChannelAnnouncement this_obj_conv;
20405 this_obj_conv.inner = (void*)(this_obj & (~1));
20406 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20407 ChannelAnnouncement_free(this_obj_conv);
20410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20411 LDKChannelAnnouncement this_ptr_conv;
20412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20413 this_ptr_conv.is_owned = false;
20414 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20415 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
20419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20420 LDKChannelAnnouncement this_ptr_conv;
20421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20422 this_ptr_conv.is_owned = false;
20423 LDKSignature val_ref;
20424 CHECK((*env)->GetArrayLength(env, val) == 64);
20425 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20426 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
20429 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20430 LDKChannelAnnouncement this_ptr_conv;
20431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20432 this_ptr_conv.is_owned = false;
20433 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20434 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
20438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20439 LDKChannelAnnouncement this_ptr_conv;
20440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20441 this_ptr_conv.is_owned = false;
20442 LDKSignature val_ref;
20443 CHECK((*env)->GetArrayLength(env, val) == 64);
20444 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20445 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
20448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
20449 LDKChannelAnnouncement this_ptr_conv;
20450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20451 this_ptr_conv.is_owned = false;
20452 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
20457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20458 LDKChannelAnnouncement this_ptr_conv;
20459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20460 this_ptr_conv.is_owned = false;
20461 LDKSignature val_ref;
20462 CHECK((*env)->GetArrayLength(env, val) == 64);
20463 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20464 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
20467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
20468 LDKChannelAnnouncement 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, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
20476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20477 LDKChannelAnnouncement 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 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
20486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20487 LDKChannelAnnouncement this_ptr_conv;
20488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20489 this_ptr_conv.is_owned = false;
20490 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&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_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20501 LDKChannelAnnouncement this_ptr_conv;
20502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20503 this_ptr_conv.is_owned = false;
20504 LDKUnsignedChannelAnnouncement val_conv;
20505 val_conv.inner = (void*)(val & (~1));
20506 val_conv.is_owned = (val & 1) || (val == 0);
20507 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
20508 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
20511 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) {
20512 LDKSignature node_signature_1_arg_ref;
20513 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
20514 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
20515 LDKSignature node_signature_2_arg_ref;
20516 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
20517 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
20518 LDKSignature bitcoin_signature_1_arg_ref;
20519 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
20520 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
20521 LDKSignature bitcoin_signature_2_arg_ref;
20522 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
20523 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
20524 LDKUnsignedChannelAnnouncement contents_arg_conv;
20525 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20526 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20527 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
20528 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);
20529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20531 uint64_t ret_ref = (uint64_t)ret_var.inner;
20532 if (ret_var.is_owned) {
20538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20539 LDKChannelAnnouncement orig_conv;
20540 orig_conv.inner = (void*)(orig & (~1));
20541 orig_conv.is_owned = false;
20542 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
20543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20545 uint64_t ret_ref = (uint64_t)ret_var.inner;
20546 if (ret_var.is_owned) {
20552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20553 LDKUnsignedChannelUpdate this_obj_conv;
20554 this_obj_conv.inner = (void*)(this_obj & (~1));
20555 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20556 UnsignedChannelUpdate_free(this_obj_conv);
20559 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20560 LDKUnsignedChannelUpdate this_ptr_conv;
20561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20562 this_ptr_conv.is_owned = false;
20563 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20564 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
20568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20569 LDKUnsignedChannelUpdate this_ptr_conv;
20570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20571 this_ptr_conv.is_owned = false;
20572 LDKThirtyTwoBytes val_ref;
20573 CHECK((*env)->GetArrayLength(env, val) == 32);
20574 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20575 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
20578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
20579 LDKUnsignedChannelUpdate this_ptr_conv;
20580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20581 this_ptr_conv.is_owned = false;
20582 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
20586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20587 LDKUnsignedChannelUpdate this_ptr_conv;
20588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20589 this_ptr_conv.is_owned = false;
20590 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
20593 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
20594 LDKUnsignedChannelUpdate this_ptr_conv;
20595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20596 this_ptr_conv.is_owned = false;
20597 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
20601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20602 LDKUnsignedChannelUpdate this_ptr_conv;
20603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20604 this_ptr_conv.is_owned = false;
20605 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
20608 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
20609 LDKUnsignedChannelUpdate this_ptr_conv;
20610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20611 this_ptr_conv.is_owned = false;
20612 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
20616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
20617 LDKUnsignedChannelUpdate this_ptr_conv;
20618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20619 this_ptr_conv.is_owned = false;
20620 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
20623 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
20624 LDKUnsignedChannelUpdate this_ptr_conv;
20625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20626 this_ptr_conv.is_owned = false;
20627 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
20631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
20632 LDKUnsignedChannelUpdate this_ptr_conv;
20633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20634 this_ptr_conv.is_owned = false;
20635 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
20638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20639 LDKUnsignedChannelUpdate this_ptr_conv;
20640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20641 this_ptr_conv.is_owned = false;
20642 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
20646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20647 LDKUnsignedChannelUpdate this_ptr_conv;
20648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20649 this_ptr_conv.is_owned = false;
20650 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
20653 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
20654 LDKUnsignedChannelUpdate this_ptr_conv;
20655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20656 this_ptr_conv.is_owned = false;
20657 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
20661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20662 LDKUnsignedChannelUpdate this_ptr_conv;
20663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20664 this_ptr_conv.is_owned = false;
20665 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
20668 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
20669 LDKUnsignedChannelUpdate this_ptr_conv;
20670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20671 this_ptr_conv.is_owned = false;
20672 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
20676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20677 LDKUnsignedChannelUpdate this_ptr_conv;
20678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20679 this_ptr_conv.is_owned = false;
20680 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
20683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20684 LDKUnsignedChannelUpdate orig_conv;
20685 orig_conv.inner = (void*)(orig & (~1));
20686 orig_conv.is_owned = false;
20687 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
20688 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20689 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20690 uint64_t ret_ref = (uint64_t)ret_var.inner;
20691 if (ret_var.is_owned) {
20697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20698 LDKChannelUpdate this_obj_conv;
20699 this_obj_conv.inner = (void*)(this_obj & (~1));
20700 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20701 ChannelUpdate_free(this_obj_conv);
20704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
20705 LDKChannelUpdate this_ptr_conv;
20706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20707 this_ptr_conv.is_owned = false;
20708 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
20709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
20713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20714 LDKChannelUpdate this_ptr_conv;
20715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20716 this_ptr_conv.is_owned = false;
20717 LDKSignature val_ref;
20718 CHECK((*env)->GetArrayLength(env, val) == 64);
20719 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
20720 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
20723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
20724 LDKChannelUpdate this_ptr_conv;
20725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20726 this_ptr_conv.is_owned = false;
20727 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
20728 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20729 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20730 uint64_t ret_ref = (uint64_t)ret_var.inner;
20731 if (ret_var.is_owned) {
20737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20738 LDKChannelUpdate this_ptr_conv;
20739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20740 this_ptr_conv.is_owned = false;
20741 LDKUnsignedChannelUpdate val_conv;
20742 val_conv.inner = (void*)(val & (~1));
20743 val_conv.is_owned = (val & 1) || (val == 0);
20744 val_conv = UnsignedChannelUpdate_clone(&val_conv);
20745 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
20748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
20749 LDKSignature signature_arg_ref;
20750 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
20751 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
20752 LDKUnsignedChannelUpdate contents_arg_conv;
20753 contents_arg_conv.inner = (void*)(contents_arg & (~1));
20754 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
20755 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
20756 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
20757 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20758 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20759 uint64_t ret_ref = (uint64_t)ret_var.inner;
20760 if (ret_var.is_owned) {
20766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20767 LDKChannelUpdate orig_conv;
20768 orig_conv.inner = (void*)(orig & (~1));
20769 orig_conv.is_owned = false;
20770 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
20771 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20772 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20773 uint64_t ret_ref = (uint64_t)ret_var.inner;
20774 if (ret_var.is_owned) {
20780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20781 LDKQueryChannelRange this_obj_conv;
20782 this_obj_conv.inner = (void*)(this_obj & (~1));
20783 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20784 QueryChannelRange_free(this_obj_conv);
20787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20788 LDKQueryChannelRange this_ptr_conv;
20789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20790 this_ptr_conv.is_owned = false;
20791 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20792 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
20796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20797 LDKQueryChannelRange this_ptr_conv;
20798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20799 this_ptr_conv.is_owned = false;
20800 LDKThirtyTwoBytes val_ref;
20801 CHECK((*env)->GetArrayLength(env, val) == 32);
20802 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20803 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20806 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
20807 LDKQueryChannelRange this_ptr_conv;
20808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20809 this_ptr_conv.is_owned = false;
20810 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
20814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20815 LDKQueryChannelRange this_ptr_conv;
20816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20817 this_ptr_conv.is_owned = false;
20818 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
20821 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
20822 LDKQueryChannelRange this_ptr_conv;
20823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20824 this_ptr_conv.is_owned = false;
20825 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
20829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20830 LDKQueryChannelRange this_ptr_conv;
20831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20832 this_ptr_conv.is_owned = false;
20833 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20836 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) {
20837 LDKThirtyTwoBytes chain_hash_arg_ref;
20838 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20839 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20840 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
20841 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20842 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20843 uint64_t ret_ref = (uint64_t)ret_var.inner;
20844 if (ret_var.is_owned) {
20850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20851 LDKQueryChannelRange orig_conv;
20852 orig_conv.inner = (void*)(orig & (~1));
20853 orig_conv.is_owned = false;
20854 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
20855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20857 uint64_t ret_ref = (uint64_t)ret_var.inner;
20858 if (ret_var.is_owned) {
20864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20865 LDKReplyChannelRange this_obj_conv;
20866 this_obj_conv.inner = (void*)(this_obj & (~1));
20867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20868 ReplyChannelRange_free(this_obj_conv);
20871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20872 LDKReplyChannelRange this_ptr_conv;
20873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20874 this_ptr_conv.is_owned = false;
20875 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20876 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
20880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20881 LDKReplyChannelRange this_ptr_conv;
20882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20883 this_ptr_conv.is_owned = false;
20884 LDKThirtyTwoBytes val_ref;
20885 CHECK((*env)->GetArrayLength(env, val) == 32);
20886 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20887 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20890 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
20891 LDKReplyChannelRange this_ptr_conv;
20892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20893 this_ptr_conv.is_owned = false;
20894 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20899 LDKReplyChannelRange this_ptr_conv;
20900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20901 this_ptr_conv.is_owned = false;
20902 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20905 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
20906 LDKReplyChannelRange this_ptr_conv;
20907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20908 this_ptr_conv.is_owned = false;
20909 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20914 LDKReplyChannelRange this_ptr_conv;
20915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20916 this_ptr_conv.is_owned = false;
20917 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
20921 LDKReplyChannelRange this_ptr_conv;
20922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20923 this_ptr_conv.is_owned = false;
20924 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20929 LDKReplyChannelRange this_ptr_conv;
20930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20931 this_ptr_conv.is_owned = false;
20932 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20936 LDKReplyChannelRange this_ptr_conv;
20937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20938 this_ptr_conv.is_owned = false;
20939 LDKCVec_u64Z val_constr;
20940 val_constr.datalen = (*env)->GetArrayLength(env, val);
20941 if (val_constr.datalen > 0)
20942 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20944 val_constr.data = NULL;
20945 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20946 for (size_t g = 0; g < val_constr.datalen; g++) {
20947 int64_t val_conv_6 = val_vals[g];
20948 val_constr.data[g] = val_conv_6;
20950 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20951 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20954 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) {
20955 LDKThirtyTwoBytes chain_hash_arg_ref;
20956 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20957 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20958 LDKCVec_u64Z short_channel_ids_arg_constr;
20959 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
20960 if (short_channel_ids_arg_constr.datalen > 0)
20961 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20963 short_channel_ids_arg_constr.data = NULL;
20964 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
20965 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
20966 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
20967 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
20969 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
20970 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20971 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20972 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20973 uint64_t ret_ref = (uint64_t)ret_var.inner;
20974 if (ret_var.is_owned) {
20980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20981 LDKReplyChannelRange orig_conv;
20982 orig_conv.inner = (void*)(orig & (~1));
20983 orig_conv.is_owned = false;
20984 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20985 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20986 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20987 uint64_t ret_ref = (uint64_t)ret_var.inner;
20988 if (ret_var.is_owned) {
20994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20995 LDKQueryShortChannelIds this_obj_conv;
20996 this_obj_conv.inner = (void*)(this_obj & (~1));
20997 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20998 QueryShortChannelIds_free(this_obj_conv);
21001 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21002 LDKQueryShortChannelIds 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, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
21010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21011 LDKQueryShortChannelIds 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 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
21020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21021 LDKQueryShortChannelIds this_ptr_conv;
21022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21023 this_ptr_conv.is_owned = false;
21024 LDKCVec_u64Z val_constr;
21025 val_constr.datalen = (*env)->GetArrayLength(env, val);
21026 if (val_constr.datalen > 0)
21027 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21029 val_constr.data = NULL;
21030 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21031 for (size_t g = 0; g < val_constr.datalen; g++) {
21032 int64_t val_conv_6 = val_vals[g];
21033 val_constr.data[g] = val_conv_6;
21035 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21036 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
21039 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) {
21040 LDKThirtyTwoBytes chain_hash_arg_ref;
21041 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21042 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21043 LDKCVec_u64Z short_channel_ids_arg_constr;
21044 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
21045 if (short_channel_ids_arg_constr.datalen > 0)
21046 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
21048 short_channel_ids_arg_constr.data = NULL;
21049 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
21050 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
21051 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
21052 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
21054 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
21055 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
21056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21058 uint64_t ret_ref = (uint64_t)ret_var.inner;
21059 if (ret_var.is_owned) {
21065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21066 LDKQueryShortChannelIds orig_conv;
21067 orig_conv.inner = (void*)(orig & (~1));
21068 orig_conv.is_owned = false;
21069 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
21070 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21071 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21072 uint64_t ret_ref = (uint64_t)ret_var.inner;
21073 if (ret_var.is_owned) {
21079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21080 LDKReplyShortChannelIdsEnd this_obj_conv;
21081 this_obj_conv.inner = (void*)(this_obj & (~1));
21082 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21083 ReplyShortChannelIdsEnd_free(this_obj_conv);
21086 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21087 LDKReplyShortChannelIdsEnd this_ptr_conv;
21088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21089 this_ptr_conv.is_owned = false;
21090 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21091 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
21095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21096 LDKReplyShortChannelIdsEnd this_ptr_conv;
21097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21098 this_ptr_conv.is_owned = false;
21099 LDKThirtyTwoBytes val_ref;
21100 CHECK((*env)->GetArrayLength(env, val) == 32);
21101 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21102 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
21105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
21106 LDKReplyShortChannelIdsEnd this_ptr_conv;
21107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21108 this_ptr_conv.is_owned = false;
21109 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
21113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21114 LDKReplyShortChannelIdsEnd this_ptr_conv;
21115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21116 this_ptr_conv.is_owned = false;
21117 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
21120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
21121 LDKThirtyTwoBytes chain_hash_arg_ref;
21122 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21123 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21124 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
21125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21127 uint64_t ret_ref = (uint64_t)ret_var.inner;
21128 if (ret_var.is_owned) {
21134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21135 LDKReplyShortChannelIdsEnd orig_conv;
21136 orig_conv.inner = (void*)(orig & (~1));
21137 orig_conv.is_owned = false;
21138 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
21139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21141 uint64_t ret_ref = (uint64_t)ret_var.inner;
21142 if (ret_var.is_owned) {
21148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21149 LDKGossipTimestampFilter this_obj_conv;
21150 this_obj_conv.inner = (void*)(this_obj & (~1));
21151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21152 GossipTimestampFilter_free(this_obj_conv);
21155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21156 LDKGossipTimestampFilter this_ptr_conv;
21157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21158 this_ptr_conv.is_owned = false;
21159 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21160 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
21164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21165 LDKGossipTimestampFilter this_ptr_conv;
21166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21167 this_ptr_conv.is_owned = false;
21168 LDKThirtyTwoBytes val_ref;
21169 CHECK((*env)->GetArrayLength(env, val) == 32);
21170 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21171 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
21174 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
21175 LDKGossipTimestampFilter this_ptr_conv;
21176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21177 this_ptr_conv.is_owned = false;
21178 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
21182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21183 LDKGossipTimestampFilter this_ptr_conv;
21184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21185 this_ptr_conv.is_owned = false;
21186 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
21189 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
21190 LDKGossipTimestampFilter this_ptr_conv;
21191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21192 this_ptr_conv.is_owned = false;
21193 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
21197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21198 LDKGossipTimestampFilter this_ptr_conv;
21199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21200 this_ptr_conv.is_owned = false;
21201 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
21204 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) {
21205 LDKThirtyTwoBytes chain_hash_arg_ref;
21206 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
21207 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
21208 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
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 int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21219 LDKGossipTimestampFilter orig_conv;
21220 orig_conv.inner = (void*)(orig & (~1));
21221 orig_conv.is_owned = false;
21222 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
21223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21225 uint64_t ret_ref = (uint64_t)ret_var.inner;
21226 if (ret_var.is_owned) {
21232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21233 if ((this_ptr & 1) != 0) return;
21234 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
21235 FREE((void*)this_ptr);
21236 ErrorAction_free(this_ptr_conv);
21239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21240 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
21241 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21242 *ret_copy = ErrorAction_clone(orig_conv);
21243 uint64_t ret_ref = (uint64_t)ret_copy;
21247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
21248 LDKErrorMessage msg_conv;
21249 msg_conv.inner = (void*)(msg & (~1));
21250 msg_conv.is_owned = (msg & 1) || (msg == 0);
21251 msg_conv = ErrorMessage_clone(&msg_conv);
21252 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21253 *ret_copy = ErrorAction_disconnect_peer(msg_conv);
21254 uint64_t ret_ref = (uint64_t)ret_copy;
21258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
21259 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21260 *ret_copy = ErrorAction_ignore_error();
21261 uint64_t ret_ref = (uint64_t)ret_copy;
21265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
21266 LDKLevel a_conv = LDKLevel_from_java(env, a);
21267 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21268 *ret_copy = ErrorAction_ignore_and_log(a_conv);
21269 uint64_t ret_ref = (uint64_t)ret_copy;
21273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
21274 LDKErrorMessage msg_conv;
21275 msg_conv.inner = (void*)(msg & (~1));
21276 msg_conv.is_owned = (msg & 1) || (msg == 0);
21277 msg_conv = ErrorMessage_clone(&msg_conv);
21278 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21279 *ret_copy = ErrorAction_send_error_message(msg_conv);
21280 uint64_t ret_ref = (uint64_t)ret_copy;
21284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21285 LDKLightningError this_obj_conv;
21286 this_obj_conv.inner = (void*)(this_obj & (~1));
21287 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21288 LightningError_free(this_obj_conv);
21291 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
21292 LDKLightningError this_ptr_conv;
21293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21294 this_ptr_conv.is_owned = false;
21295 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
21296 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
21301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
21302 LDKLightningError this_ptr_conv;
21303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21304 this_ptr_conv.is_owned = false;
21305 LDKStr val_conv = java_to_owned_str(env, val);
21306 LightningError_set_err(&this_ptr_conv, val_conv);
21309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
21310 LDKLightningError this_ptr_conv;
21311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21312 this_ptr_conv.is_owned = false;
21313 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
21314 *ret_copy = LightningError_get_action(&this_ptr_conv);
21315 uint64_t ret_ref = (uint64_t)ret_copy;
21319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21320 LDKLightningError this_ptr_conv;
21321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21322 this_ptr_conv.is_owned = false;
21323 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
21324 LightningError_set_action(&this_ptr_conv, val_conv);
21327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
21328 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
21329 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
21330 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
21331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21333 uint64_t ret_ref = (uint64_t)ret_var.inner;
21334 if (ret_var.is_owned) {
21340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21341 LDKLightningError orig_conv;
21342 orig_conv.inner = (void*)(orig & (~1));
21343 orig_conv.is_owned = false;
21344 LDKLightningError ret_var = LightningError_clone(&orig_conv);
21345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21347 uint64_t ret_ref = (uint64_t)ret_var.inner;
21348 if (ret_var.is_owned) {
21354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21355 LDKCommitmentUpdate this_obj_conv;
21356 this_obj_conv.inner = (void*)(this_obj & (~1));
21357 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21358 CommitmentUpdate_free(this_obj_conv);
21361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21362 LDKCommitmentUpdate this_ptr_conv;
21363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21364 this_ptr_conv.is_owned = false;
21365 LDKCVec_UpdateAddHTLCZ val_constr;
21366 val_constr.datalen = (*env)->GetArrayLength(env, val);
21367 if (val_constr.datalen > 0)
21368 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21370 val_constr.data = NULL;
21371 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21372 for (size_t p = 0; p < val_constr.datalen; p++) {
21373 int64_t val_conv_15 = val_vals[p];
21374 LDKUpdateAddHTLC val_conv_15_conv;
21375 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
21376 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
21377 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
21378 val_constr.data[p] = val_conv_15_conv;
21380 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21381 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
21384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21385 LDKCommitmentUpdate this_ptr_conv;
21386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21387 this_ptr_conv.is_owned = false;
21388 LDKCVec_UpdateFulfillHTLCZ val_constr;
21389 val_constr.datalen = (*env)->GetArrayLength(env, val);
21390 if (val_constr.datalen > 0)
21391 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21393 val_constr.data = NULL;
21394 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21395 for (size_t t = 0; t < val_constr.datalen; t++) {
21396 int64_t val_conv_19 = val_vals[t];
21397 LDKUpdateFulfillHTLC val_conv_19_conv;
21398 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
21399 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
21400 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
21401 val_constr.data[t] = val_conv_19_conv;
21403 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21404 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
21407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
21408 LDKCommitmentUpdate this_ptr_conv;
21409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21410 this_ptr_conv.is_owned = false;
21411 LDKCVec_UpdateFailHTLCZ val_constr;
21412 val_constr.datalen = (*env)->GetArrayLength(env, val);
21413 if (val_constr.datalen > 0)
21414 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21416 val_constr.data = NULL;
21417 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21418 for (size_t q = 0; q < val_constr.datalen; q++) {
21419 int64_t val_conv_16 = val_vals[q];
21420 LDKUpdateFailHTLC val_conv_16_conv;
21421 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
21422 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
21423 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
21424 val_constr.data[q] = val_conv_16_conv;
21426 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21427 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
21430 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) {
21431 LDKCommitmentUpdate this_ptr_conv;
21432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21433 this_ptr_conv.is_owned = false;
21434 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
21435 val_constr.datalen = (*env)->GetArrayLength(env, val);
21436 if (val_constr.datalen > 0)
21437 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21439 val_constr.data = NULL;
21440 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
21441 for (size_t z = 0; z < val_constr.datalen; z++) {
21442 int64_t val_conv_25 = val_vals[z];
21443 LDKUpdateFailMalformedHTLC val_conv_25_conv;
21444 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
21445 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
21446 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
21447 val_constr.data[z] = val_conv_25_conv;
21449 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
21450 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
21453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
21454 LDKCommitmentUpdate this_ptr_conv;
21455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21456 this_ptr_conv.is_owned = false;
21457 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
21458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21460 uint64_t ret_ref = (uint64_t)ret_var.inner;
21461 if (ret_var.is_owned) {
21467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21468 LDKCommitmentUpdate this_ptr_conv;
21469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21470 this_ptr_conv.is_owned = false;
21471 LDKUpdateFee val_conv;
21472 val_conv.inner = (void*)(val & (~1));
21473 val_conv.is_owned = (val & 1) || (val == 0);
21474 val_conv = UpdateFee_clone(&val_conv);
21475 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
21478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
21479 LDKCommitmentUpdate this_ptr_conv;
21480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21481 this_ptr_conv.is_owned = false;
21482 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
21483 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21484 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21485 uint64_t ret_ref = (uint64_t)ret_var.inner;
21486 if (ret_var.is_owned) {
21492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21493 LDKCommitmentUpdate this_ptr_conv;
21494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21495 this_ptr_conv.is_owned = false;
21496 LDKCommitmentSigned val_conv;
21497 val_conv.inner = (void*)(val & (~1));
21498 val_conv.is_owned = (val & 1) || (val == 0);
21499 val_conv = CommitmentSigned_clone(&val_conv);
21500 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
21503 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) {
21504 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
21505 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
21506 if (update_add_htlcs_arg_constr.datalen > 0)
21507 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
21509 update_add_htlcs_arg_constr.data = NULL;
21510 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
21511 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
21512 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
21513 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
21514 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
21515 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
21516 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
21517 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
21519 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
21520 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
21521 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
21522 if (update_fulfill_htlcs_arg_constr.datalen > 0)
21523 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
21525 update_fulfill_htlcs_arg_constr.data = NULL;
21526 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
21527 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
21528 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
21529 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
21530 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
21531 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
21532 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
21533 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
21535 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
21536 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
21537 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
21538 if (update_fail_htlcs_arg_constr.datalen > 0)
21539 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
21541 update_fail_htlcs_arg_constr.data = NULL;
21542 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
21543 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
21544 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
21545 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
21546 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
21547 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
21548 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
21549 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
21551 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
21552 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
21553 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
21554 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
21555 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
21557 update_fail_malformed_htlcs_arg_constr.data = NULL;
21558 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
21559 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
21560 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
21561 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
21562 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
21563 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);
21564 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
21565 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
21567 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
21568 LDKUpdateFee update_fee_arg_conv;
21569 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
21570 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
21571 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
21572 LDKCommitmentSigned commitment_signed_arg_conv;
21573 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
21574 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
21575 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
21576 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);
21577 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21578 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21579 uint64_t ret_ref = (uint64_t)ret_var.inner;
21580 if (ret_var.is_owned) {
21586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21587 LDKCommitmentUpdate orig_conv;
21588 orig_conv.inner = (void*)(orig & (~1));
21589 orig_conv.is_owned = false;
21590 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
21591 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21592 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21593 uint64_t ret_ref = (uint64_t)ret_var.inner;
21594 if (ret_var.is_owned) {
21600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21601 if ((this_ptr & 1) != 0) return;
21602 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
21603 FREE((void*)this_ptr);
21604 HTLCFailChannelUpdate_free(this_ptr_conv);
21607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21608 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
21609 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21610 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
21611 uint64_t ret_ref = (uint64_t)ret_copy;
21615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
21616 LDKChannelUpdate msg_conv;
21617 msg_conv.inner = (void*)(msg & (~1));
21618 msg_conv.is_owned = (msg & 1) || (msg == 0);
21619 msg_conv = ChannelUpdate_clone(&msg_conv);
21620 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21621 *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
21622 uint64_t ret_ref = (uint64_t)ret_copy;
21626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
21627 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21628 *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
21629 uint64_t ret_ref = (uint64_t)ret_copy;
21633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
21634 LDKPublicKey node_id_ref;
21635 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21636 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21637 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
21638 *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
21639 uint64_t ret_ref = (uint64_t)ret_copy;
21643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21644 if ((this_ptr & 1) != 0) return;
21645 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
21646 FREE((void*)this_ptr);
21647 ChannelMessageHandler_free(this_ptr_conv);
21650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21651 if ((this_ptr & 1) != 0) return;
21652 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
21653 FREE((void*)this_ptr);
21654 RoutingMessageHandler_free(this_ptr_conv);
21657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
21658 LDKAcceptChannel obj_conv;
21659 obj_conv.inner = (void*)(obj & (~1));
21660 obj_conv.is_owned = false;
21661 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
21662 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21663 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21664 CVec_u8Z_free(ret_var);
21668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21669 LDKu8slice ser_ref;
21670 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21671 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21672 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
21673 *ret_conv = AcceptChannel_read(ser_ref);
21674 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21675 return (uint64_t)ret_conv;
21678 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
21679 LDKAnnouncementSignatures obj_conv;
21680 obj_conv.inner = (void*)(obj & (~1));
21681 obj_conv.is_owned = false;
21682 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
21683 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21684 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21685 CVec_u8Z_free(ret_var);
21689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21690 LDKu8slice ser_ref;
21691 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21692 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21693 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
21694 *ret_conv = AnnouncementSignatures_read(ser_ref);
21695 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21696 return (uint64_t)ret_conv;
21699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
21700 LDKChannelReestablish obj_conv;
21701 obj_conv.inner = (void*)(obj & (~1));
21702 obj_conv.is_owned = false;
21703 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
21704 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21705 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21706 CVec_u8Z_free(ret_var);
21710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21711 LDKu8slice ser_ref;
21712 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21713 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21714 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
21715 *ret_conv = ChannelReestablish_read(ser_ref);
21716 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21717 return (uint64_t)ret_conv;
21720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21721 LDKClosingSigned obj_conv;
21722 obj_conv.inner = (void*)(obj & (~1));
21723 obj_conv.is_owned = false;
21724 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
21725 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21726 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21727 CVec_u8Z_free(ret_var);
21731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21732 LDKu8slice ser_ref;
21733 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21734 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21735 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
21736 *ret_conv = ClosingSigned_read(ser_ref);
21737 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21738 return (uint64_t)ret_conv;
21741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
21742 LDKClosingSignedFeeRange obj_conv;
21743 obj_conv.inner = (void*)(obj & (~1));
21744 obj_conv.is_owned = false;
21745 LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
21746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21748 CVec_u8Z_free(ret_var);
21752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21753 LDKu8slice ser_ref;
21754 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21755 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21756 LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
21757 *ret_conv = ClosingSignedFeeRange_read(ser_ref);
21758 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21759 return (uint64_t)ret_conv;
21762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21763 LDKCommitmentSigned obj_conv;
21764 obj_conv.inner = (void*)(obj & (~1));
21765 obj_conv.is_owned = false;
21766 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
21767 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21768 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21769 CVec_u8Z_free(ret_var);
21773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21774 LDKu8slice ser_ref;
21775 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21776 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21777 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
21778 *ret_conv = CommitmentSigned_read(ser_ref);
21779 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21780 return (uint64_t)ret_conv;
21783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
21784 LDKFundingCreated obj_conv;
21785 obj_conv.inner = (void*)(obj & (~1));
21786 obj_conv.is_owned = false;
21787 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
21788 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21789 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21790 CVec_u8Z_free(ret_var);
21794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21795 LDKu8slice ser_ref;
21796 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21797 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21798 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
21799 *ret_conv = FundingCreated_read(ser_ref);
21800 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21801 return (uint64_t)ret_conv;
21804 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
21805 LDKFundingSigned obj_conv;
21806 obj_conv.inner = (void*)(obj & (~1));
21807 obj_conv.is_owned = false;
21808 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
21809 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21810 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21811 CVec_u8Z_free(ret_var);
21815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21816 LDKu8slice ser_ref;
21817 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21818 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21819 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
21820 *ret_conv = FundingSigned_read(ser_ref);
21821 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21822 return (uint64_t)ret_conv;
21825 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
21826 LDKFundingLocked obj_conv;
21827 obj_conv.inner = (void*)(obj & (~1));
21828 obj_conv.is_owned = false;
21829 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
21830 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21831 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21832 CVec_u8Z_free(ret_var);
21836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21837 LDKu8slice ser_ref;
21838 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21839 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21840 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
21841 *ret_conv = FundingLocked_read(ser_ref);
21842 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21843 return (uint64_t)ret_conv;
21846 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
21848 obj_conv.inner = (void*)(obj & (~1));
21849 obj_conv.is_owned = false;
21850 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
21851 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21852 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21853 CVec_u8Z_free(ret_var);
21857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21858 LDKu8slice ser_ref;
21859 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21860 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21861 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
21862 *ret_conv = Init_read(ser_ref);
21863 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21864 return (uint64_t)ret_conv;
21867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
21868 LDKOpenChannel obj_conv;
21869 obj_conv.inner = (void*)(obj & (~1));
21870 obj_conv.is_owned = false;
21871 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
21872 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21873 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21874 CVec_u8Z_free(ret_var);
21878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21879 LDKu8slice ser_ref;
21880 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21881 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21882 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
21883 *ret_conv = OpenChannel_read(ser_ref);
21884 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21885 return (uint64_t)ret_conv;
21888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
21889 LDKRevokeAndACK obj_conv;
21890 obj_conv.inner = (void*)(obj & (~1));
21891 obj_conv.is_owned = false;
21892 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
21893 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21894 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21895 CVec_u8Z_free(ret_var);
21899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21900 LDKu8slice ser_ref;
21901 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21902 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21903 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
21904 *ret_conv = RevokeAndACK_read(ser_ref);
21905 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21906 return (uint64_t)ret_conv;
21909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
21910 LDKShutdown obj_conv;
21911 obj_conv.inner = (void*)(obj & (~1));
21912 obj_conv.is_owned = false;
21913 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
21914 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21915 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21916 CVec_u8Z_free(ret_var);
21920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21921 LDKu8slice ser_ref;
21922 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21923 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21924 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
21925 *ret_conv = Shutdown_read(ser_ref);
21926 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21927 return (uint64_t)ret_conv;
21930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21931 LDKUpdateFailHTLC obj_conv;
21932 obj_conv.inner = (void*)(obj & (~1));
21933 obj_conv.is_owned = false;
21934 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
21935 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21936 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21937 CVec_u8Z_free(ret_var);
21941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21942 LDKu8slice ser_ref;
21943 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21944 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21945 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
21946 *ret_conv = UpdateFailHTLC_read(ser_ref);
21947 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21948 return (uint64_t)ret_conv;
21951 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21952 LDKUpdateFailMalformedHTLC obj_conv;
21953 obj_conv.inner = (void*)(obj & (~1));
21954 obj_conv.is_owned = false;
21955 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
21956 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21957 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21958 CVec_u8Z_free(ret_var);
21962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21963 LDKu8slice ser_ref;
21964 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21965 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21966 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21967 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21968 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21969 return (uint64_t)ret_conv;
21972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
21973 LDKUpdateFee obj_conv;
21974 obj_conv.inner = (void*)(obj & (~1));
21975 obj_conv.is_owned = false;
21976 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21977 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21978 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21979 CVec_u8Z_free(ret_var);
21983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21984 LDKu8slice ser_ref;
21985 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21986 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21987 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21988 *ret_conv = UpdateFee_read(ser_ref);
21989 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21990 return (uint64_t)ret_conv;
21993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21994 LDKUpdateFulfillHTLC obj_conv;
21995 obj_conv.inner = (void*)(obj & (~1));
21996 obj_conv.is_owned = false;
21997 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21998 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21999 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22000 CVec_u8Z_free(ret_var);
22004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22005 LDKu8slice ser_ref;
22006 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22007 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22008 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
22009 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
22010 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22011 return (uint64_t)ret_conv;
22014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
22015 LDKUpdateAddHTLC obj_conv;
22016 obj_conv.inner = (void*)(obj & (~1));
22017 obj_conv.is_owned = false;
22018 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
22019 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22020 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22021 CVec_u8Z_free(ret_var);
22025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22026 LDKu8slice ser_ref;
22027 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22028 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22029 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
22030 *ret_conv = UpdateAddHTLC_read(ser_ref);
22031 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22032 return (uint64_t)ret_conv;
22035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
22037 obj_conv.inner = (void*)(obj & (~1));
22038 obj_conv.is_owned = false;
22039 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
22040 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22041 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22042 CVec_u8Z_free(ret_var);
22046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22047 LDKu8slice ser_ref;
22048 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22049 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22050 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
22051 *ret_conv = Ping_read(ser_ref);
22052 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22053 return (uint64_t)ret_conv;
22056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
22058 obj_conv.inner = (void*)(obj & (~1));
22059 obj_conv.is_owned = false;
22060 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
22061 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22062 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22063 CVec_u8Z_free(ret_var);
22067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22068 LDKu8slice ser_ref;
22069 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22070 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22071 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
22072 *ret_conv = Pong_read(ser_ref);
22073 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22074 return (uint64_t)ret_conv;
22077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22078 LDKUnsignedChannelAnnouncement obj_conv;
22079 obj_conv.inner = (void*)(obj & (~1));
22080 obj_conv.is_owned = false;
22081 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
22082 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22083 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22084 CVec_u8Z_free(ret_var);
22088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22089 LDKu8slice ser_ref;
22090 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22091 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22092 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
22093 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
22094 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22095 return (uint64_t)ret_conv;
22098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22099 LDKChannelAnnouncement obj_conv;
22100 obj_conv.inner = (void*)(obj & (~1));
22101 obj_conv.is_owned = false;
22102 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
22103 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22104 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22105 CVec_u8Z_free(ret_var);
22109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22110 LDKu8slice ser_ref;
22111 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22112 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22113 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
22114 *ret_conv = ChannelAnnouncement_read(ser_ref);
22115 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22116 return (uint64_t)ret_conv;
22119 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22120 LDKUnsignedChannelUpdate obj_conv;
22121 obj_conv.inner = (void*)(obj & (~1));
22122 obj_conv.is_owned = false;
22123 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
22124 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22125 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22126 CVec_u8Z_free(ret_var);
22130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22131 LDKu8slice ser_ref;
22132 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22133 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22134 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
22135 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
22136 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22137 return (uint64_t)ret_conv;
22140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
22141 LDKChannelUpdate obj_conv;
22142 obj_conv.inner = (void*)(obj & (~1));
22143 obj_conv.is_owned = false;
22144 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
22145 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22146 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22147 CVec_u8Z_free(ret_var);
22151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22152 LDKu8slice ser_ref;
22153 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22154 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22155 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
22156 *ret_conv = ChannelUpdate_read(ser_ref);
22157 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22158 return (uint64_t)ret_conv;
22161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
22162 LDKErrorMessage obj_conv;
22163 obj_conv.inner = (void*)(obj & (~1));
22164 obj_conv.is_owned = false;
22165 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
22166 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22167 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22168 CVec_u8Z_free(ret_var);
22172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22173 LDKu8slice ser_ref;
22174 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22175 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22176 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
22177 *ret_conv = ErrorMessage_read(ser_ref);
22178 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22179 return (uint64_t)ret_conv;
22182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22183 LDKUnsignedNodeAnnouncement obj_conv;
22184 obj_conv.inner = (void*)(obj & (~1));
22185 obj_conv.is_owned = false;
22186 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
22187 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22188 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22189 CVec_u8Z_free(ret_var);
22193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22194 LDKu8slice ser_ref;
22195 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22196 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22197 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
22198 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
22199 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22200 return (uint64_t)ret_conv;
22203 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
22204 LDKNodeAnnouncement obj_conv;
22205 obj_conv.inner = (void*)(obj & (~1));
22206 obj_conv.is_owned = false;
22207 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
22208 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22209 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22210 CVec_u8Z_free(ret_var);
22214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22215 LDKu8slice ser_ref;
22216 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22217 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22218 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
22219 *ret_conv = NodeAnnouncement_read(ser_ref);
22220 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22221 return (uint64_t)ret_conv;
22224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22225 LDKu8slice ser_ref;
22226 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22227 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22228 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
22229 *ret_conv = QueryShortChannelIds_read(ser_ref);
22230 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22231 return (uint64_t)ret_conv;
22234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
22235 LDKQueryShortChannelIds obj_conv;
22236 obj_conv.inner = (void*)(obj & (~1));
22237 obj_conv.is_owned = false;
22238 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
22239 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22240 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22241 CVec_u8Z_free(ret_var);
22245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22246 LDKu8slice ser_ref;
22247 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22248 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22249 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
22250 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
22251 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22252 return (uint64_t)ret_conv;
22255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
22256 LDKReplyShortChannelIdsEnd obj_conv;
22257 obj_conv.inner = (void*)(obj & (~1));
22258 obj_conv.is_owned = false;
22259 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
22260 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22261 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22262 CVec_u8Z_free(ret_var);
22266 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
22267 LDKQueryChannelRange this_arg_conv;
22268 this_arg_conv.inner = (void*)(this_arg & (~1));
22269 this_arg_conv.is_owned = false;
22270 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
22274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22275 LDKu8slice ser_ref;
22276 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22277 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22278 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
22279 *ret_conv = QueryChannelRange_read(ser_ref);
22280 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22281 return (uint64_t)ret_conv;
22284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
22285 LDKQueryChannelRange obj_conv;
22286 obj_conv.inner = (void*)(obj & (~1));
22287 obj_conv.is_owned = false;
22288 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
22289 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22290 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22291 CVec_u8Z_free(ret_var);
22295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22296 LDKu8slice ser_ref;
22297 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22298 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22299 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
22300 *ret_conv = ReplyChannelRange_read(ser_ref);
22301 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22302 return (uint64_t)ret_conv;
22305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
22306 LDKReplyChannelRange obj_conv;
22307 obj_conv.inner = (void*)(obj & (~1));
22308 obj_conv.is_owned = false;
22309 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
22310 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22311 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22312 CVec_u8Z_free(ret_var);
22316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22317 LDKu8slice ser_ref;
22318 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22319 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22320 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
22321 *ret_conv = GossipTimestampFilter_read(ser_ref);
22322 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22323 return (uint64_t)ret_conv;
22326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
22327 LDKGossipTimestampFilter obj_conv;
22328 obj_conv.inner = (void*)(obj & (~1));
22329 obj_conv.is_owned = false;
22330 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
22331 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22332 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22333 CVec_u8Z_free(ret_var);
22337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22338 LDKIgnoringMessageHandler this_obj_conv;
22339 this_obj_conv.inner = (void*)(this_obj & (~1));
22340 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22341 IgnoringMessageHandler_free(this_obj_conv);
22344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
22345 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
22346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22348 uint64_t ret_ref = (uint64_t)ret_var.inner;
22349 if (ret_var.is_owned) {
22355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
22356 LDKIgnoringMessageHandler this_arg_conv;
22357 this_arg_conv.inner = (void*)(this_arg & (~1));
22358 this_arg_conv.is_owned = false;
22359 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22360 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22361 return (uint64_t)ret;
22364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
22365 LDKIgnoringMessageHandler this_arg_conv;
22366 this_arg_conv.inner = (void*)(this_arg & (~1));
22367 this_arg_conv.is_owned = false;
22368 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
22369 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
22370 return (uint64_t)ret;
22373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22374 LDKErroringMessageHandler this_obj_conv;
22375 this_obj_conv.inner = (void*)(this_obj & (~1));
22376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22377 ErroringMessageHandler_free(this_obj_conv);
22380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
22381 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
22382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22384 uint64_t ret_ref = (uint64_t)ret_var.inner;
22385 if (ret_var.is_owned) {
22391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
22392 LDKErroringMessageHandler this_arg_conv;
22393 this_arg_conv.inner = (void*)(this_arg & (~1));
22394 this_arg_conv.is_owned = false;
22395 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
22396 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
22397 return (uint64_t)ret;
22400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
22401 LDKErroringMessageHandler this_arg_conv;
22402 this_arg_conv.inner = (void*)(this_arg & (~1));
22403 this_arg_conv.is_owned = false;
22404 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
22405 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
22406 return (uint64_t)ret;
22409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22410 LDKMessageHandler this_obj_conv;
22411 this_obj_conv.inner = (void*)(this_obj & (~1));
22412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22413 MessageHandler_free(this_obj_conv);
22416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
22417 LDKMessageHandler this_ptr_conv;
22418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22419 this_ptr_conv.is_owned = false;
22420 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
22424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22425 LDKMessageHandler this_ptr_conv;
22426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22427 this_ptr_conv.is_owned = false;
22428 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
22429 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
22430 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22431 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
22433 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
22436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
22437 LDKMessageHandler this_ptr_conv;
22438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22439 this_ptr_conv.is_owned = false;
22440 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
22444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22445 LDKMessageHandler this_ptr_conv;
22446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22447 this_ptr_conv.is_owned = false;
22448 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
22449 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
22450 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22451 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
22453 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
22456 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) {
22457 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
22458 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
22459 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22460 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
22462 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
22463 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
22464 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22465 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
22467 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
22468 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22469 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22470 uint64_t ret_ref = (uint64_t)ret_var.inner;
22471 if (ret_var.is_owned) {
22477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22478 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
22479 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22480 *ret = SocketDescriptor_clone(orig_conv);
22481 return (uint64_t)ret;
22484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
22485 if ((this_ptr & 1) != 0) return;
22486 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
22487 FREE((void*)this_ptr);
22488 SocketDescriptor_free(this_ptr_conv);
22491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22492 LDKPeerHandleError this_obj_conv;
22493 this_obj_conv.inner = (void*)(this_obj & (~1));
22494 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22495 PeerHandleError_free(this_obj_conv);
22498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
22499 LDKPeerHandleError this_ptr_conv;
22500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22501 this_ptr_conv.is_owned = false;
22502 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
22506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22507 LDKPeerHandleError this_ptr_conv;
22508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22509 this_ptr_conv.is_owned = false;
22510 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
22513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
22514 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
22515 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22516 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22517 uint64_t ret_ref = (uint64_t)ret_var.inner;
22518 if (ret_var.is_owned) {
22524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22525 LDKPeerHandleError orig_conv;
22526 orig_conv.inner = (void*)(orig & (~1));
22527 orig_conv.is_owned = false;
22528 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
22529 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22530 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22531 uint64_t ret_ref = (uint64_t)ret_var.inner;
22532 if (ret_var.is_owned) {
22538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22539 LDKPeerManager this_obj_conv;
22540 this_obj_conv.inner = (void*)(this_obj & (~1));
22541 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22542 PeerManager_free(this_obj_conv);
22545 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) {
22546 LDKMessageHandler message_handler_conv;
22547 message_handler_conv.inner = (void*)(message_handler & (~1));
22548 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
22549 // Warning: we need a move here but no clone is available for LDKMessageHandler
22550 LDKSecretKey our_node_secret_ref;
22551 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
22552 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
22553 unsigned char ephemeral_random_data_arr[32];
22554 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
22555 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
22556 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
22557 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
22558 if (logger_conv.free == LDKLogger_JCalls_free) {
22559 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22560 LDKLogger_JCalls_cloned(&logger_conv);
22562 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
22563 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22564 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22565 uint64_t ret_ref = (uint64_t)ret_var.inner;
22566 if (ret_var.is_owned) {
22572 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
22573 LDKPeerManager this_arg_conv;
22574 this_arg_conv.inner = (void*)(this_arg & (~1));
22575 this_arg_conv.is_owned = false;
22576 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
22577 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
22579 for (size_t i = 0; i < ret_var.datalen; i++) {
22580 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
22581 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
22582 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
22584 FREE(ret_var.data);
22588 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) {
22589 LDKPeerManager this_arg_conv;
22590 this_arg_conv.inner = (void*)(this_arg & (~1));
22591 this_arg_conv.is_owned = false;
22592 LDKPublicKey their_node_id_ref;
22593 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22594 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22595 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22596 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
22597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22598 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
22600 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
22601 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
22602 return (uint64_t)ret_conv;
22605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
22606 LDKPeerManager this_arg_conv;
22607 this_arg_conv.inner = (void*)(this_arg & (~1));
22608 this_arg_conv.is_owned = false;
22609 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22610 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
22611 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22612 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
22614 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22615 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
22616 return (uint64_t)ret_conv;
22619 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) {
22620 LDKPeerManager this_arg_conv;
22621 this_arg_conv.inner = (void*)(this_arg & (~1));
22622 this_arg_conv.is_owned = false;
22623 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22624 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
22625 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
22626 return (uint64_t)ret_conv;
22629 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) {
22630 LDKPeerManager this_arg_conv;
22631 this_arg_conv.inner = (void*)(this_arg & (~1));
22632 this_arg_conv.is_owned = false;
22633 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
22634 LDKu8slice data_ref;
22635 data_ref.datalen = (*env)->GetArrayLength(env, data);
22636 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
22637 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
22638 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
22639 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
22640 return (uint64_t)ret_conv;
22643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
22644 LDKPeerManager this_arg_conv;
22645 this_arg_conv.inner = (void*)(this_arg & (~1));
22646 this_arg_conv.is_owned = false;
22647 PeerManager_process_events(&this_arg_conv);
22650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
22651 LDKPeerManager this_arg_conv;
22652 this_arg_conv.inner = (void*)(this_arg & (~1));
22653 this_arg_conv.is_owned = false;
22654 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
22655 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
22658 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) {
22659 LDKPeerManager this_arg_conv;
22660 this_arg_conv.inner = (void*)(this_arg & (~1));
22661 this_arg_conv.is_owned = false;
22662 LDKPublicKey node_id_ref;
22663 CHECK((*env)->GetArrayLength(env, node_id) == 33);
22664 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
22665 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
22668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
22669 LDKPeerManager this_arg_conv;
22670 this_arg_conv.inner = (void*)(this_arg & (~1));
22671 this_arg_conv.is_owned = false;
22672 PeerManager_timer_tick_occurred(&this_arg_conv);
22675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
22676 unsigned char commitment_seed_arr[32];
22677 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
22678 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
22679 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
22680 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22681 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
22685 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) {
22686 LDKPublicKey per_commitment_point_ref;
22687 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22688 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22689 unsigned char base_secret_arr[32];
22690 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
22691 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
22692 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
22693 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22694 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
22695 return (uint64_t)ret_conv;
22698 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) {
22699 LDKPublicKey per_commitment_point_ref;
22700 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22701 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22702 LDKPublicKey base_point_ref;
22703 CHECK((*env)->GetArrayLength(env, base_point) == 33);
22704 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
22705 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22706 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
22707 return (uint64_t)ret_conv;
22710 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) {
22711 unsigned char per_commitment_secret_arr[32];
22712 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
22713 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
22714 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
22715 unsigned char countersignatory_revocation_base_secret_arr[32];
22716 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
22717 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
22718 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
22719 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
22720 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
22721 return (uint64_t)ret_conv;
22724 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) {
22725 LDKPublicKey per_commitment_point_ref;
22726 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22727 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22728 LDKPublicKey countersignatory_revocation_base_point_ref;
22729 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
22730 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
22731 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22732 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
22733 return (uint64_t)ret_conv;
22736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22737 LDKTxCreationKeys this_obj_conv;
22738 this_obj_conv.inner = (void*)(this_obj & (~1));
22739 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22740 TxCreationKeys_free(this_obj_conv);
22743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22744 LDKTxCreationKeys this_ptr_conv;
22745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22746 this_ptr_conv.is_owned = false;
22747 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22748 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
22752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22753 LDKTxCreationKeys this_ptr_conv;
22754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22755 this_ptr_conv.is_owned = false;
22756 LDKPublicKey val_ref;
22757 CHECK((*env)->GetArrayLength(env, val) == 33);
22758 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22759 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
22762 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22763 LDKTxCreationKeys this_ptr_conv;
22764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22765 this_ptr_conv.is_owned = false;
22766 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22767 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
22771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22772 LDKTxCreationKeys this_ptr_conv;
22773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22774 this_ptr_conv.is_owned = false;
22775 LDKPublicKey val_ref;
22776 CHECK((*env)->GetArrayLength(env, val) == 33);
22777 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22778 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
22781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22782 LDKTxCreationKeys this_ptr_conv;
22783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22784 this_ptr_conv.is_owned = false;
22785 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22786 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
22790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22791 LDKTxCreationKeys this_ptr_conv;
22792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22793 this_ptr_conv.is_owned = false;
22794 LDKPublicKey val_ref;
22795 CHECK((*env)->GetArrayLength(env, val) == 33);
22796 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22797 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
22800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22801 LDKTxCreationKeys this_ptr_conv;
22802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22803 this_ptr_conv.is_owned = false;
22804 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
22809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22810 LDKTxCreationKeys this_ptr_conv;
22811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22812 this_ptr_conv.is_owned = false;
22813 LDKPublicKey val_ref;
22814 CHECK((*env)->GetArrayLength(env, val) == 33);
22815 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22816 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
22819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
22820 LDKTxCreationKeys this_ptr_conv;
22821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22822 this_ptr_conv.is_owned = false;
22823 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22824 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
22828 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) {
22829 LDKTxCreationKeys this_ptr_conv;
22830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22831 this_ptr_conv.is_owned = false;
22832 LDKPublicKey val_ref;
22833 CHECK((*env)->GetArrayLength(env, val) == 33);
22834 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22835 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
22838 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) {
22839 LDKPublicKey per_commitment_point_arg_ref;
22840 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
22841 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
22842 LDKPublicKey revocation_key_arg_ref;
22843 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
22844 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
22845 LDKPublicKey broadcaster_htlc_key_arg_ref;
22846 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
22847 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
22848 LDKPublicKey countersignatory_htlc_key_arg_ref;
22849 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
22850 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
22851 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
22852 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
22853 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
22854 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);
22855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22857 uint64_t ret_ref = (uint64_t)ret_var.inner;
22858 if (ret_var.is_owned) {
22864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22865 LDKTxCreationKeys orig_conv;
22866 orig_conv.inner = (void*)(orig & (~1));
22867 orig_conv.is_owned = false;
22868 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
22869 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22870 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22871 uint64_t ret_ref = (uint64_t)ret_var.inner;
22872 if (ret_var.is_owned) {
22878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
22879 LDKTxCreationKeys obj_conv;
22880 obj_conv.inner = (void*)(obj & (~1));
22881 obj_conv.is_owned = false;
22882 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
22883 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22884 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22885 CVec_u8Z_free(ret_var);
22889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22890 LDKu8slice ser_ref;
22891 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22892 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22893 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
22894 *ret_conv = TxCreationKeys_read(ser_ref);
22895 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22896 return (uint64_t)ret_conv;
22899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22900 LDKChannelPublicKeys this_obj_conv;
22901 this_obj_conv.inner = (void*)(this_obj & (~1));
22902 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22903 ChannelPublicKeys_free(this_obj_conv);
22906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22907 LDKChannelPublicKeys this_ptr_conv;
22908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22909 this_ptr_conv.is_owned = false;
22910 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
22915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22916 LDKChannelPublicKeys this_ptr_conv;
22917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22918 this_ptr_conv.is_owned = false;
22919 LDKPublicKey val_ref;
22920 CHECK((*env)->GetArrayLength(env, val) == 33);
22921 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22922 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
22925 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22926 LDKChannelPublicKeys this_ptr_conv;
22927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22928 this_ptr_conv.is_owned = false;
22929 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22930 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
22934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22935 LDKChannelPublicKeys this_ptr_conv;
22936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22937 this_ptr_conv.is_owned = false;
22938 LDKPublicKey val_ref;
22939 CHECK((*env)->GetArrayLength(env, val) == 33);
22940 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22941 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
22944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
22945 LDKChannelPublicKeys this_ptr_conv;
22946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22947 this_ptr_conv.is_owned = false;
22948 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22949 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
22953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22954 LDKChannelPublicKeys this_ptr_conv;
22955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22956 this_ptr_conv.is_owned = false;
22957 LDKPublicKey val_ref;
22958 CHECK((*env)->GetArrayLength(env, val) == 33);
22959 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22960 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
22963 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22964 LDKChannelPublicKeys this_ptr_conv;
22965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22966 this_ptr_conv.is_owned = false;
22967 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22968 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
22972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22973 LDKChannelPublicKeys this_ptr_conv;
22974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22975 this_ptr_conv.is_owned = false;
22976 LDKPublicKey val_ref;
22977 CHECK((*env)->GetArrayLength(env, val) == 33);
22978 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22979 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22983 LDKChannelPublicKeys this_ptr_conv;
22984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22985 this_ptr_conv.is_owned = false;
22986 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22987 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
22991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22992 LDKChannelPublicKeys this_ptr_conv;
22993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22994 this_ptr_conv.is_owned = false;
22995 LDKPublicKey val_ref;
22996 CHECK((*env)->GetArrayLength(env, val) == 33);
22997 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22998 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
23001 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) {
23002 LDKPublicKey funding_pubkey_arg_ref;
23003 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
23004 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
23005 LDKPublicKey revocation_basepoint_arg_ref;
23006 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
23007 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
23008 LDKPublicKey payment_point_arg_ref;
23009 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
23010 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
23011 LDKPublicKey delayed_payment_basepoint_arg_ref;
23012 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
23013 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
23014 LDKPublicKey htlc_basepoint_arg_ref;
23015 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
23016 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
23017 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);
23018 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23019 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23020 uint64_t ret_ref = (uint64_t)ret_var.inner;
23021 if (ret_var.is_owned) {
23027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23028 LDKChannelPublicKeys orig_conv;
23029 orig_conv.inner = (void*)(orig & (~1));
23030 orig_conv.is_owned = false;
23031 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
23032 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23033 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23034 uint64_t ret_ref = (uint64_t)ret_var.inner;
23035 if (ret_var.is_owned) {
23041 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
23042 LDKChannelPublicKeys obj_conv;
23043 obj_conv.inner = (void*)(obj & (~1));
23044 obj_conv.is_owned = false;
23045 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
23046 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23047 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23048 CVec_u8Z_free(ret_var);
23052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23053 LDKu8slice ser_ref;
23054 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23055 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23056 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
23057 *ret_conv = ChannelPublicKeys_read(ser_ref);
23058 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23059 return (uint64_t)ret_conv;
23062 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) {
23063 LDKPublicKey per_commitment_point_ref;
23064 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
23065 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
23066 LDKPublicKey broadcaster_delayed_payment_base_ref;
23067 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
23068 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
23069 LDKPublicKey broadcaster_htlc_base_ref;
23070 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
23071 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
23072 LDKPublicKey countersignatory_revocation_base_ref;
23073 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
23074 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
23075 LDKPublicKey countersignatory_htlc_base_ref;
23076 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
23077 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
23078 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
23079 *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);
23080 return (uint64_t)ret_conv;
23083 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) {
23084 LDKPublicKey per_commitment_point_ref;
23085 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
23086 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
23087 LDKChannelPublicKeys broadcaster_keys_conv;
23088 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23089 broadcaster_keys_conv.is_owned = false;
23090 LDKChannelPublicKeys countersignatory_keys_conv;
23091 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23092 countersignatory_keys_conv.is_owned = false;
23093 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
23094 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
23095 return (uint64_t)ret_conv;
23098 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) {
23099 LDKPublicKey revocation_key_ref;
23100 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
23101 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
23102 LDKPublicKey broadcaster_delayed_payment_key_ref;
23103 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
23104 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
23105 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
23106 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23107 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23108 CVec_u8Z_free(ret_var);
23112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23113 LDKHTLCOutputInCommitment this_obj_conv;
23114 this_obj_conv.inner = (void*)(this_obj & (~1));
23115 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23116 HTLCOutputInCommitment_free(this_obj_conv);
23119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
23120 LDKHTLCOutputInCommitment this_ptr_conv;
23121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23122 this_ptr_conv.is_owned = false;
23123 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
23127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23128 LDKHTLCOutputInCommitment this_ptr_conv;
23129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23130 this_ptr_conv.is_owned = false;
23131 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
23134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23135 LDKHTLCOutputInCommitment this_ptr_conv;
23136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23137 this_ptr_conv.is_owned = false;
23138 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
23142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23143 LDKHTLCOutputInCommitment this_ptr_conv;
23144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23145 this_ptr_conv.is_owned = false;
23146 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
23149 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
23150 LDKHTLCOutputInCommitment this_ptr_conv;
23151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23152 this_ptr_conv.is_owned = false;
23153 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
23157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23158 LDKHTLCOutputInCommitment this_ptr_conv;
23159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23160 this_ptr_conv.is_owned = false;
23161 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
23164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
23165 LDKHTLCOutputInCommitment this_ptr_conv;
23166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23167 this_ptr_conv.is_owned = false;
23168 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23169 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
23173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23174 LDKHTLCOutputInCommitment this_ptr_conv;
23175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23176 this_ptr_conv.is_owned = false;
23177 LDKThirtyTwoBytes val_ref;
23178 CHECK((*env)->GetArrayLength(env, val) == 32);
23179 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23180 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
23183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
23184 LDKHTLCOutputInCommitment this_ptr_conv;
23185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23186 this_ptr_conv.is_owned = false;
23187 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
23188 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
23189 uint64_t ret_ref = (uint64_t)ret_copy;
23193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23194 LDKHTLCOutputInCommitment this_ptr_conv;
23195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23196 this_ptr_conv.is_owned = false;
23197 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
23198 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
23201 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) {
23202 LDKThirtyTwoBytes payment_hash_arg_ref;
23203 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
23204 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
23205 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
23206 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
23207 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23208 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23209 uint64_t ret_ref = (uint64_t)ret_var.inner;
23210 if (ret_var.is_owned) {
23216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23217 LDKHTLCOutputInCommitment orig_conv;
23218 orig_conv.inner = (void*)(orig & (~1));
23219 orig_conv.is_owned = false;
23220 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
23221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23223 uint64_t ret_ref = (uint64_t)ret_var.inner;
23224 if (ret_var.is_owned) {
23230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
23231 LDKHTLCOutputInCommitment obj_conv;
23232 obj_conv.inner = (void*)(obj & (~1));
23233 obj_conv.is_owned = false;
23234 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
23235 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23236 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23237 CVec_u8Z_free(ret_var);
23241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23242 LDKu8slice ser_ref;
23243 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23244 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23245 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
23246 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
23247 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23248 return (uint64_t)ret_conv;
23251 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
23252 LDKHTLCOutputInCommitment htlc_conv;
23253 htlc_conv.inner = (void*)(htlc & (~1));
23254 htlc_conv.is_owned = false;
23255 LDKTxCreationKeys keys_conv;
23256 keys_conv.inner = (void*)(keys & (~1));
23257 keys_conv.is_owned = false;
23258 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
23259 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23260 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23261 CVec_u8Z_free(ret_var);
23265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
23266 LDKPublicKey broadcaster_ref;
23267 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
23268 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
23269 LDKPublicKey countersignatory_ref;
23270 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
23271 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
23272 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
23273 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23274 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23275 CVec_u8Z_free(ret_var);
23279 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) {
23280 unsigned char commitment_txid_arr[32];
23281 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
23282 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
23283 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
23284 LDKHTLCOutputInCommitment htlc_conv;
23285 htlc_conv.inner = (void*)(htlc & (~1));
23286 htlc_conv.is_owned = false;
23287 LDKPublicKey broadcaster_delayed_payment_key_ref;
23288 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
23289 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
23290 LDKPublicKey revocation_key_ref;
23291 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
23292 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
23293 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
23294 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23295 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23296 Transaction_free(ret_var);
23300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23301 LDKChannelTransactionParameters this_obj_conv;
23302 this_obj_conv.inner = (void*)(this_obj & (~1));
23303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23304 ChannelTransactionParameters_free(this_obj_conv);
23307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
23308 LDKChannelTransactionParameters this_ptr_conv;
23309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23310 this_ptr_conv.is_owned = false;
23311 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
23312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23314 uint64_t ret_ref = (uint64_t)ret_var.inner;
23315 if (ret_var.is_owned) {
23321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23322 LDKChannelTransactionParameters this_ptr_conv;
23323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23324 this_ptr_conv.is_owned = false;
23325 LDKChannelPublicKeys val_conv;
23326 val_conv.inner = (void*)(val & (~1));
23327 val_conv.is_owned = (val & 1) || (val == 0);
23328 val_conv = ChannelPublicKeys_clone(&val_conv);
23329 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
23332 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23333 LDKChannelTransactionParameters this_ptr_conv;
23334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23335 this_ptr_conv.is_owned = false;
23336 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
23340 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) {
23341 LDKChannelTransactionParameters this_ptr_conv;
23342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23343 this_ptr_conv.is_owned = false;
23344 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
23347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
23348 LDKChannelTransactionParameters this_ptr_conv;
23349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23350 this_ptr_conv.is_owned = false;
23351 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
23355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23356 LDKChannelTransactionParameters this_ptr_conv;
23357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23358 this_ptr_conv.is_owned = false;
23359 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
23362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
23363 LDKChannelTransactionParameters this_ptr_conv;
23364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23365 this_ptr_conv.is_owned = false;
23366 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
23367 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23368 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23369 uint64_t ret_ref = (uint64_t)ret_var.inner;
23370 if (ret_var.is_owned) {
23376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23377 LDKChannelTransactionParameters this_ptr_conv;
23378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23379 this_ptr_conv.is_owned = false;
23380 LDKCounterpartyChannelTransactionParameters val_conv;
23381 val_conv.inner = (void*)(val & (~1));
23382 val_conv.is_owned = (val & 1) || (val == 0);
23383 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
23384 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
23387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
23388 LDKChannelTransactionParameters this_ptr_conv;
23389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23390 this_ptr_conv.is_owned = false;
23391 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
23392 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23393 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23394 uint64_t ret_ref = (uint64_t)ret_var.inner;
23395 if (ret_var.is_owned) {
23401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23402 LDKChannelTransactionParameters this_ptr_conv;
23403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23404 this_ptr_conv.is_owned = false;
23405 LDKOutPoint val_conv;
23406 val_conv.inner = (void*)(val & (~1));
23407 val_conv.is_owned = (val & 1) || (val == 0);
23408 val_conv = OutPoint_clone(&val_conv);
23409 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
23412 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) {
23413 LDKChannelPublicKeys holder_pubkeys_arg_conv;
23414 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
23415 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
23416 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
23417 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
23418 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
23419 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
23420 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
23421 LDKOutPoint funding_outpoint_arg_conv;
23422 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
23423 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
23424 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
23425 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);
23426 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23427 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23428 uint64_t ret_ref = (uint64_t)ret_var.inner;
23429 if (ret_var.is_owned) {
23435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23436 LDKChannelTransactionParameters orig_conv;
23437 orig_conv.inner = (void*)(orig & (~1));
23438 orig_conv.is_owned = false;
23439 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
23440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23442 uint64_t ret_ref = (uint64_t)ret_var.inner;
23443 if (ret_var.is_owned) {
23449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23450 LDKCounterpartyChannelTransactionParameters this_obj_conv;
23451 this_obj_conv.inner = (void*)(this_obj & (~1));
23452 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23453 CounterpartyChannelTransactionParameters_free(this_obj_conv);
23456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
23457 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23459 this_ptr_conv.is_owned = false;
23460 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
23461 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23462 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23463 uint64_t ret_ref = (uint64_t)ret_var.inner;
23464 if (ret_var.is_owned) {
23470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23471 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23473 this_ptr_conv.is_owned = false;
23474 LDKChannelPublicKeys val_conv;
23475 val_conv.inner = (void*)(val & (~1));
23476 val_conv.is_owned = (val & 1) || (val == 0);
23477 val_conv = ChannelPublicKeys_clone(&val_conv);
23478 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
23481 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
23482 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23484 this_ptr_conv.is_owned = false;
23485 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
23489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23490 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
23491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23492 this_ptr_conv.is_owned = false;
23493 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
23496 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) {
23497 LDKChannelPublicKeys pubkeys_arg_conv;
23498 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
23499 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
23500 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
23501 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
23502 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23503 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23504 uint64_t ret_ref = (uint64_t)ret_var.inner;
23505 if (ret_var.is_owned) {
23511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23512 LDKCounterpartyChannelTransactionParameters orig_conv;
23513 orig_conv.inner = (void*)(orig & (~1));
23514 orig_conv.is_owned = false;
23515 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
23516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23518 uint64_t ret_ref = (uint64_t)ret_var.inner;
23519 if (ret_var.is_owned) {
23525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
23526 LDKChannelTransactionParameters this_arg_conv;
23527 this_arg_conv.inner = (void*)(this_arg & (~1));
23528 this_arg_conv.is_owned = false;
23529 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
23533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
23534 LDKChannelTransactionParameters this_arg_conv;
23535 this_arg_conv.inner = (void*)(this_arg & (~1));
23536 this_arg_conv.is_owned = false;
23537 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
23538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23540 uint64_t ret_ref = (uint64_t)ret_var.inner;
23541 if (ret_var.is_owned) {
23547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
23548 LDKChannelTransactionParameters this_arg_conv;
23549 this_arg_conv.inner = (void*)(this_arg & (~1));
23550 this_arg_conv.is_owned = false;
23551 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
23552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23554 uint64_t ret_ref = (uint64_t)ret_var.inner;
23555 if (ret_var.is_owned) {
23561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
23562 LDKCounterpartyChannelTransactionParameters obj_conv;
23563 obj_conv.inner = (void*)(obj & (~1));
23564 obj_conv.is_owned = false;
23565 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
23566 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23567 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23568 CVec_u8Z_free(ret_var);
23572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23573 LDKu8slice ser_ref;
23574 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23575 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23576 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
23577 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
23578 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23579 return (uint64_t)ret_conv;
23582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
23583 LDKChannelTransactionParameters obj_conv;
23584 obj_conv.inner = (void*)(obj & (~1));
23585 obj_conv.is_owned = false;
23586 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
23587 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23588 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23589 CVec_u8Z_free(ret_var);
23593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23594 LDKu8slice ser_ref;
23595 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23596 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23597 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
23598 *ret_conv = ChannelTransactionParameters_read(ser_ref);
23599 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23600 return (uint64_t)ret_conv;
23603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23604 LDKDirectedChannelTransactionParameters this_obj_conv;
23605 this_obj_conv.inner = (void*)(this_obj & (~1));
23606 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23607 DirectedChannelTransactionParameters_free(this_obj_conv);
23610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
23611 LDKDirectedChannelTransactionParameters this_arg_conv;
23612 this_arg_conv.inner = (void*)(this_arg & (~1));
23613 this_arg_conv.is_owned = false;
23614 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
23615 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23616 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23617 uint64_t ret_ref = (uint64_t)ret_var.inner;
23618 if (ret_var.is_owned) {
23624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
23625 LDKDirectedChannelTransactionParameters this_arg_conv;
23626 this_arg_conv.inner = (void*)(this_arg & (~1));
23627 this_arg_conv.is_owned = false;
23628 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
23629 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23630 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23631 uint64_t ret_ref = (uint64_t)ret_var.inner;
23632 if (ret_var.is_owned) {
23638 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
23639 LDKDirectedChannelTransactionParameters this_arg_conv;
23640 this_arg_conv.inner = (void*)(this_arg & (~1));
23641 this_arg_conv.is_owned = false;
23642 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
23646 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
23647 LDKDirectedChannelTransactionParameters this_arg_conv;
23648 this_arg_conv.inner = (void*)(this_arg & (~1));
23649 this_arg_conv.is_owned = false;
23650 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
23654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
23655 LDKDirectedChannelTransactionParameters this_arg_conv;
23656 this_arg_conv.inner = (void*)(this_arg & (~1));
23657 this_arg_conv.is_owned = false;
23658 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
23659 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23660 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23661 uint64_t ret_ref = (uint64_t)ret_var.inner;
23662 if (ret_var.is_owned) {
23668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23669 LDKHolderCommitmentTransaction this_obj_conv;
23670 this_obj_conv.inner = (void*)(this_obj & (~1));
23671 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23672 HolderCommitmentTransaction_free(this_obj_conv);
23675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
23676 LDKHolderCommitmentTransaction this_ptr_conv;
23677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23678 this_ptr_conv.is_owned = false;
23679 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23680 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
23684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23685 LDKHolderCommitmentTransaction this_ptr_conv;
23686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23687 this_ptr_conv.is_owned = false;
23688 LDKSignature val_ref;
23689 CHECK((*env)->GetArrayLength(env, val) == 64);
23690 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
23691 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
23694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23695 LDKHolderCommitmentTransaction this_ptr_conv;
23696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23697 this_ptr_conv.is_owned = false;
23698 LDKCVec_SignatureZ val_constr;
23699 val_constr.datalen = (*env)->GetArrayLength(env, val);
23700 if (val_constr.datalen > 0)
23701 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23703 val_constr.data = NULL;
23704 for (size_t i = 0; i < val_constr.datalen; i++) {
23705 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
23706 LDKSignature val_conv_8_ref;
23707 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
23708 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
23709 val_constr.data[i] = val_conv_8_ref;
23711 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
23714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23715 LDKHolderCommitmentTransaction orig_conv;
23716 orig_conv.inner = (void*)(orig & (~1));
23717 orig_conv.is_owned = false;
23718 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
23719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23721 uint64_t ret_ref = (uint64_t)ret_var.inner;
23722 if (ret_var.is_owned) {
23728 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23729 LDKHolderCommitmentTransaction obj_conv;
23730 obj_conv.inner = (void*)(obj & (~1));
23731 obj_conv.is_owned = false;
23732 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
23733 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23734 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23735 CVec_u8Z_free(ret_var);
23739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23740 LDKu8slice ser_ref;
23741 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23742 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23743 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
23744 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
23745 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23746 return (uint64_t)ret_conv;
23749 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) {
23750 LDKCommitmentTransaction commitment_tx_conv;
23751 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
23752 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
23753 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
23754 LDKSignature counterparty_sig_ref;
23755 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
23756 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
23757 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
23758 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
23759 if (counterparty_htlc_sigs_constr.datalen > 0)
23760 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
23762 counterparty_htlc_sigs_constr.data = NULL;
23763 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
23764 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
23765 LDKSignature counterparty_htlc_sigs_conv_8_ref;
23766 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
23767 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
23768 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
23770 LDKPublicKey holder_funding_key_ref;
23771 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
23772 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
23773 LDKPublicKey counterparty_funding_key_ref;
23774 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
23775 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
23776 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
23777 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23778 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23779 uint64_t ret_ref = (uint64_t)ret_var.inner;
23780 if (ret_var.is_owned) {
23786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23787 LDKBuiltCommitmentTransaction this_obj_conv;
23788 this_obj_conv.inner = (void*)(this_obj & (~1));
23789 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23790 BuiltCommitmentTransaction_free(this_obj_conv);
23793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
23794 LDKBuiltCommitmentTransaction this_ptr_conv;
23795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23796 this_ptr_conv.is_owned = false;
23797 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
23798 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23799 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23800 Transaction_free(ret_var);
23804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23805 LDKBuiltCommitmentTransaction this_ptr_conv;
23806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23807 this_ptr_conv.is_owned = false;
23808 LDKTransaction val_ref;
23809 val_ref.datalen = (*env)->GetArrayLength(env, val);
23810 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
23811 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
23812 val_ref.data_is_owned = true;
23813 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
23816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
23817 LDKBuiltCommitmentTransaction this_ptr_conv;
23818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23819 this_ptr_conv.is_owned = false;
23820 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
23825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23826 LDKBuiltCommitmentTransaction this_ptr_conv;
23827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23828 this_ptr_conv.is_owned = false;
23829 LDKThirtyTwoBytes val_ref;
23830 CHECK((*env)->GetArrayLength(env, val) == 32);
23831 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23832 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
23835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
23836 LDKTransaction transaction_arg_ref;
23837 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
23838 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
23839 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
23840 transaction_arg_ref.data_is_owned = true;
23841 LDKThirtyTwoBytes txid_arg_ref;
23842 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
23843 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
23844 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
23845 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23846 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23847 uint64_t ret_ref = (uint64_t)ret_var.inner;
23848 if (ret_var.is_owned) {
23854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23855 LDKBuiltCommitmentTransaction orig_conv;
23856 orig_conv.inner = (void*)(orig & (~1));
23857 orig_conv.is_owned = false;
23858 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
23859 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23860 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23861 uint64_t ret_ref = (uint64_t)ret_var.inner;
23862 if (ret_var.is_owned) {
23868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23869 LDKBuiltCommitmentTransaction obj_conv;
23870 obj_conv.inner = (void*)(obj & (~1));
23871 obj_conv.is_owned = false;
23872 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
23873 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23874 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23875 CVec_u8Z_free(ret_var);
23879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23880 LDKu8slice ser_ref;
23881 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23882 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23883 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
23884 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
23885 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23886 return (uint64_t)ret_conv;
23889 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) {
23890 LDKBuiltCommitmentTransaction this_arg_conv;
23891 this_arg_conv.inner = (void*)(this_arg & (~1));
23892 this_arg_conv.is_owned = false;
23893 LDKu8slice funding_redeemscript_ref;
23894 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
23895 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
23896 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
23898 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
23902 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) {
23903 LDKBuiltCommitmentTransaction this_arg_conv;
23904 this_arg_conv.inner = (void*)(this_arg & (~1));
23905 this_arg_conv.is_owned = false;
23906 unsigned char funding_key_arr[32];
23907 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
23908 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
23909 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
23910 LDKu8slice funding_redeemscript_ref;
23911 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
23912 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
23913 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
23914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
23915 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
23919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23920 LDKCommitmentTransaction this_obj_conv;
23921 this_obj_conv.inner = (void*)(this_obj & (~1));
23922 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23923 CommitmentTransaction_free(this_obj_conv);
23926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23927 LDKCommitmentTransaction orig_conv;
23928 orig_conv.inner = (void*)(orig & (~1));
23929 orig_conv.is_owned = false;
23930 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
23931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23933 uint64_t ret_ref = (uint64_t)ret_var.inner;
23934 if (ret_var.is_owned) {
23940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
23941 LDKCommitmentTransaction obj_conv;
23942 obj_conv.inner = (void*)(obj & (~1));
23943 obj_conv.is_owned = false;
23944 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
23945 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23946 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23947 CVec_u8Z_free(ret_var);
23951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23952 LDKu8slice ser_ref;
23953 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23954 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23955 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
23956 *ret_conv = CommitmentTransaction_read(ser_ref);
23957 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23958 return (uint64_t)ret_conv;
23961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
23962 LDKCommitmentTransaction this_arg_conv;
23963 this_arg_conv.inner = (void*)(this_arg & (~1));
23964 this_arg_conv.is_owned = false;
23965 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23970 LDKCommitmentTransaction this_arg_conv;
23971 this_arg_conv.inner = (void*)(this_arg & (~1));
23972 this_arg_conv.is_owned = false;
23973 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23978 LDKCommitmentTransaction this_arg_conv;
23979 this_arg_conv.inner = (void*)(this_arg & (~1));
23980 this_arg_conv.is_owned = false;
23981 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23985 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
23986 LDKCommitmentTransaction this_arg_conv;
23987 this_arg_conv.inner = (void*)(this_arg & (~1));
23988 this_arg_conv.is_owned = false;
23989 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
23994 LDKCommitmentTransaction this_arg_conv;
23995 this_arg_conv.inner = (void*)(this_arg & (~1));
23996 this_arg_conv.is_owned = false;
23997 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23998 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23999 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24000 uint64_t ret_ref = (uint64_t)ret_var.inner;
24001 if (ret_var.is_owned) {
24007 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) {
24008 LDKCommitmentTransaction this_arg_conv;
24009 this_arg_conv.inner = (void*)(this_arg & (~1));
24010 this_arg_conv.is_owned = false;
24011 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24012 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24013 channel_parameters_conv.is_owned = false;
24014 LDKChannelPublicKeys broadcaster_keys_conv;
24015 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
24016 broadcaster_keys_conv.is_owned = false;
24017 LDKChannelPublicKeys countersignatory_keys_conv;
24018 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
24019 countersignatory_keys_conv.is_owned = false;
24020 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
24021 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
24022 return (uint64_t)ret_conv;
24025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24026 LDKTrustedCommitmentTransaction this_obj_conv;
24027 this_obj_conv.inner = (void*)(this_obj & (~1));
24028 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24029 TrustedCommitmentTransaction_free(this_obj_conv);
24032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
24033 LDKTrustedCommitmentTransaction this_arg_conv;
24034 this_arg_conv.inner = (void*)(this_arg & (~1));
24035 this_arg_conv.is_owned = false;
24036 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24037 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
24041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
24042 LDKTrustedCommitmentTransaction this_arg_conv;
24043 this_arg_conv.inner = (void*)(this_arg & (~1));
24044 this_arg_conv.is_owned = false;
24045 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
24046 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24047 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24048 uint64_t ret_ref = (uint64_t)ret_var.inner;
24049 if (ret_var.is_owned) {
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
24056 LDKTrustedCommitmentTransaction this_arg_conv;
24057 this_arg_conv.inner = (void*)(this_arg & (~1));
24058 this_arg_conv.is_owned = false;
24059 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
24060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24062 uint64_t ret_ref = (uint64_t)ret_var.inner;
24063 if (ret_var.is_owned) {
24069 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) {
24070 LDKTrustedCommitmentTransaction this_arg_conv;
24071 this_arg_conv.inner = (void*)(this_arg & (~1));
24072 this_arg_conv.is_owned = false;
24073 unsigned char htlc_base_key_arr[32];
24074 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
24075 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
24076 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
24077 LDKDirectedChannelTransactionParameters channel_parameters_conv;
24078 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
24079 channel_parameters_conv.is_owned = false;
24080 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
24081 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
24082 return (uint64_t)ret_conv;
24085 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) {
24086 LDKPublicKey broadcaster_payment_basepoint_ref;
24087 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
24088 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
24089 LDKPublicKey countersignatory_payment_basepoint_ref;
24090 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
24091 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
24092 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
24096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24097 LDKInitFeatures a_conv;
24098 a_conv.inner = (void*)(a & (~1));
24099 a_conv.is_owned = false;
24100 LDKInitFeatures b_conv;
24101 b_conv.inner = (void*)(b & (~1));
24102 b_conv.is_owned = false;
24103 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
24107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24108 LDKNodeFeatures a_conv;
24109 a_conv.inner = (void*)(a & (~1));
24110 a_conv.is_owned = false;
24111 LDKNodeFeatures b_conv;
24112 b_conv.inner = (void*)(b & (~1));
24113 b_conv.is_owned = false;
24114 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
24118 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24119 LDKChannelFeatures a_conv;
24120 a_conv.inner = (void*)(a & (~1));
24121 a_conv.is_owned = false;
24122 LDKChannelFeatures b_conv;
24123 b_conv.inner = (void*)(b & (~1));
24124 b_conv.is_owned = false;
24125 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
24129 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24130 LDKInvoiceFeatures a_conv;
24131 a_conv.inner = (void*)(a & (~1));
24132 a_conv.is_owned = false;
24133 LDKInvoiceFeatures b_conv;
24134 b_conv.inner = (void*)(b & (~1));
24135 b_conv.is_owned = false;
24136 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
24140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24141 LDKInitFeatures orig_conv;
24142 orig_conv.inner = (void*)(orig & (~1));
24143 orig_conv.is_owned = false;
24144 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
24145 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24146 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24147 uint64_t ret_ref = (uint64_t)ret_var.inner;
24148 if (ret_var.is_owned) {
24154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24155 LDKNodeFeatures orig_conv;
24156 orig_conv.inner = (void*)(orig & (~1));
24157 orig_conv.is_owned = false;
24158 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
24159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24161 uint64_t ret_ref = (uint64_t)ret_var.inner;
24162 if (ret_var.is_owned) {
24168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24169 LDKChannelFeatures orig_conv;
24170 orig_conv.inner = (void*)(orig & (~1));
24171 orig_conv.is_owned = false;
24172 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
24173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24175 uint64_t ret_ref = (uint64_t)ret_var.inner;
24176 if (ret_var.is_owned) {
24182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24183 LDKInvoiceFeatures orig_conv;
24184 orig_conv.inner = (void*)(orig & (~1));
24185 orig_conv.is_owned = false;
24186 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
24187 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24188 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24189 uint64_t ret_ref = (uint64_t)ret_var.inner;
24190 if (ret_var.is_owned) {
24196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24197 LDKInitFeatures this_obj_conv;
24198 this_obj_conv.inner = (void*)(this_obj & (~1));
24199 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24200 InitFeatures_free(this_obj_conv);
24203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24204 LDKNodeFeatures this_obj_conv;
24205 this_obj_conv.inner = (void*)(this_obj & (~1));
24206 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24207 NodeFeatures_free(this_obj_conv);
24210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24211 LDKChannelFeatures this_obj_conv;
24212 this_obj_conv.inner = (void*)(this_obj & (~1));
24213 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24214 ChannelFeatures_free(this_obj_conv);
24217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24218 LDKInvoiceFeatures this_obj_conv;
24219 this_obj_conv.inner = (void*)(this_obj & (~1));
24220 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24221 InvoiceFeatures_free(this_obj_conv);
24224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
24225 LDKInitFeatures ret_var = InitFeatures_empty();
24226 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24227 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24228 uint64_t ret_ref = (uint64_t)ret_var.inner;
24229 if (ret_var.is_owned) {
24235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
24236 LDKInitFeatures ret_var = InitFeatures_known();
24237 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24238 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24239 uint64_t ret_ref = (uint64_t)ret_var.inner;
24240 if (ret_var.is_owned) {
24246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
24247 LDKNodeFeatures ret_var = NodeFeatures_empty();
24248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24250 uint64_t ret_ref = (uint64_t)ret_var.inner;
24251 if (ret_var.is_owned) {
24257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
24258 LDKNodeFeatures ret_var = NodeFeatures_known();
24259 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24260 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24261 uint64_t ret_ref = (uint64_t)ret_var.inner;
24262 if (ret_var.is_owned) {
24268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
24269 LDKChannelFeatures ret_var = ChannelFeatures_empty();
24270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24272 uint64_t ret_ref = (uint64_t)ret_var.inner;
24273 if (ret_var.is_owned) {
24279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
24280 LDKChannelFeatures ret_var = ChannelFeatures_known();
24281 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24282 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24283 uint64_t ret_ref = (uint64_t)ret_var.inner;
24284 if (ret_var.is_owned) {
24290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
24291 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
24292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24294 uint64_t ret_ref = (uint64_t)ret_var.inner;
24295 if (ret_var.is_owned) {
24301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
24302 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
24303 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24304 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24305 uint64_t ret_ref = (uint64_t)ret_var.inner;
24306 if (ret_var.is_owned) {
24312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24313 LDKInitFeatures this_arg_conv;
24314 this_arg_conv.inner = (void*)(this_arg & (~1));
24315 this_arg_conv.is_owned = false;
24316 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
24320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24321 LDKNodeFeatures this_arg_conv;
24322 this_arg_conv.inner = (void*)(this_arg & (~1));
24323 this_arg_conv.is_owned = false;
24324 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
24328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
24329 LDKInvoiceFeatures this_arg_conv;
24330 this_arg_conv.inner = (void*)(this_arg & (~1));
24331 this_arg_conv.is_owned = false;
24332 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
24336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24337 LDKInitFeatures obj_conv;
24338 obj_conv.inner = (void*)(obj & (~1));
24339 obj_conv.is_owned = false;
24340 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
24341 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24342 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24343 CVec_u8Z_free(ret_var);
24347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24348 LDKNodeFeatures obj_conv;
24349 obj_conv.inner = (void*)(obj & (~1));
24350 obj_conv.is_owned = false;
24351 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
24352 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24353 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24354 CVec_u8Z_free(ret_var);
24358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24359 LDKChannelFeatures obj_conv;
24360 obj_conv.inner = (void*)(obj & (~1));
24361 obj_conv.is_owned = false;
24362 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
24363 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24364 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24365 CVec_u8Z_free(ret_var);
24369 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
24370 LDKInvoiceFeatures obj_conv;
24371 obj_conv.inner = (void*)(obj & (~1));
24372 obj_conv.is_owned = false;
24373 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
24374 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24375 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24376 CVec_u8Z_free(ret_var);
24380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24381 LDKu8slice ser_ref;
24382 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24383 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24384 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
24385 *ret_conv = InitFeatures_read(ser_ref);
24386 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24387 return (uint64_t)ret_conv;
24390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24391 LDKu8slice ser_ref;
24392 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24393 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24394 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
24395 *ret_conv = NodeFeatures_read(ser_ref);
24396 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24397 return (uint64_t)ret_conv;
24400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24401 LDKu8slice ser_ref;
24402 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24403 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24404 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
24405 *ret_conv = ChannelFeatures_read(ser_ref);
24406 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24407 return (uint64_t)ret_conv;
24410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24411 LDKu8slice ser_ref;
24412 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24413 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24414 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
24415 *ret_conv = InvoiceFeatures_read(ser_ref);
24416 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24417 return (uint64_t)ret_conv;
24420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24421 LDKShutdownScript this_obj_conv;
24422 this_obj_conv.inner = (void*)(this_obj & (~1));
24423 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24424 ShutdownScript_free(this_obj_conv);
24427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24428 LDKShutdownScript orig_conv;
24429 orig_conv.inner = (void*)(orig & (~1));
24430 orig_conv.is_owned = false;
24431 LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
24432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24434 uint64_t ret_ref = (uint64_t)ret_var.inner;
24435 if (ret_var.is_owned) {
24441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24442 LDKInvalidShutdownScript this_obj_conv;
24443 this_obj_conv.inner = (void*)(this_obj & (~1));
24444 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24445 InvalidShutdownScript_free(this_obj_conv);
24448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
24449 LDKInvalidShutdownScript this_ptr_conv;
24450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24451 this_ptr_conv.is_owned = false;
24452 LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
24453 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24454 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24459 LDKInvalidShutdownScript this_ptr_conv;
24460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24461 this_ptr_conv.is_owned = false;
24462 LDKCVec_u8Z val_ref;
24463 val_ref.datalen = (*env)->GetArrayLength(env, val);
24464 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24465 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
24466 InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
24469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
24470 LDKCVec_u8Z script_arg_ref;
24471 script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
24472 script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24473 (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
24474 LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
24475 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24476 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24477 uint64_t ret_ref = (uint64_t)ret_var.inner;
24478 if (ret_var.is_owned) {
24484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
24485 LDKShutdownScript obj_conv;
24486 obj_conv.inner = (void*)(obj & (~1));
24487 obj_conv.is_owned = false;
24488 LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
24489 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24490 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24491 CVec_u8Z_free(ret_var);
24495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24496 LDKu8slice ser_ref;
24497 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24498 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24499 LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
24500 *ret_conv = ShutdownScript_read(ser_ref);
24501 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24502 return (uint64_t)ret_conv;
24505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
24506 unsigned char pubkey_hash_arr[20];
24507 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
24508 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
24509 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24510 LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
24511 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24512 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24513 uint64_t ret_ref = (uint64_t)ret_var.inner;
24514 if (ret_var.is_owned) {
24520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
24521 unsigned char script_hash_arr[20];
24522 CHECK((*env)->GetArrayLength(env, script_hash) == 20);
24523 (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
24524 unsigned char (*script_hash_ref)[20] = &script_hash_arr;
24525 LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
24526 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24527 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24528 uint64_t ret_ref = (uint64_t)ret_var.inner;
24529 if (ret_var.is_owned) {
24535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
24536 unsigned char pubkey_hash_arr[20];
24537 CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
24538 (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
24539 unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
24540 LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
24541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24543 uint64_t ret_ref = (uint64_t)ret_var.inner;
24544 if (ret_var.is_owned) {
24550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
24551 unsigned char script_hash_arr[32];
24552 CHECK((*env)->GetArrayLength(env, script_hash) == 32);
24553 (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
24554 unsigned char (*script_hash_ref)[32] = &script_hash_arr;
24555 LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
24556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24558 uint64_t ret_ref = (uint64_t)ret_var.inner;
24559 if (ret_var.is_owned) {
24565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
24566 LDKu8slice program_ref;
24567 program_ref.datalen = (*env)->GetArrayLength(env, program);
24568 program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
24569 LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
24570 *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
24571 (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
24572 return (uint64_t)ret_conv;
24575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
24576 LDKShutdownScript this_arg_conv;
24577 this_arg_conv.inner = (void*)(this_arg & (~1));
24578 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24579 this_arg_conv = ShutdownScript_clone(&this_arg_conv);
24580 LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
24581 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24582 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24583 CVec_u8Z_free(ret_var);
24587 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
24588 LDKShutdownScript this_arg_conv;
24589 this_arg_conv.inner = (void*)(this_arg & (~1));
24590 this_arg_conv.is_owned = false;
24591 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24592 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
24596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
24597 LDKShutdownScript this_arg_conv;
24598 this_arg_conv.inner = (void*)(this_arg & (~1));
24599 this_arg_conv.is_owned = false;
24600 LDKInitFeatures features_conv;
24601 features_conv.inner = (void*)(features & (~1));
24602 features_conv.is_owned = false;
24603 jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
24607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24608 LDKRouteHop this_obj_conv;
24609 this_obj_conv.inner = (void*)(this_obj & (~1));
24610 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24611 RouteHop_free(this_obj_conv);
24614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
24615 LDKRouteHop this_ptr_conv;
24616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24617 this_ptr_conv.is_owned = false;
24618 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
24623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24624 LDKRouteHop this_ptr_conv;
24625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24626 this_ptr_conv.is_owned = false;
24627 LDKPublicKey val_ref;
24628 CHECK((*env)->GetArrayLength(env, val) == 33);
24629 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24630 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
24633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24634 LDKRouteHop this_ptr_conv;
24635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24636 this_ptr_conv.is_owned = false;
24637 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
24638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24640 uint64_t ret_ref = (uint64_t)ret_var.inner;
24641 if (ret_var.is_owned) {
24647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24648 LDKRouteHop this_ptr_conv;
24649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24650 this_ptr_conv.is_owned = false;
24651 LDKNodeFeatures val_conv;
24652 val_conv.inner = (void*)(val & (~1));
24653 val_conv.is_owned = (val & 1) || (val == 0);
24654 val_conv = NodeFeatures_clone(&val_conv);
24655 RouteHop_set_node_features(&this_ptr_conv, val_conv);
24658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24659 LDKRouteHop this_ptr_conv;
24660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24661 this_ptr_conv.is_owned = false;
24662 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
24666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24667 LDKRouteHop this_ptr_conv;
24668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24669 this_ptr_conv.is_owned = false;
24670 RouteHop_set_short_channel_id(&this_ptr_conv, val);
24673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24674 LDKRouteHop this_ptr_conv;
24675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24676 this_ptr_conv.is_owned = false;
24677 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
24678 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24679 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24680 uint64_t ret_ref = (uint64_t)ret_var.inner;
24681 if (ret_var.is_owned) {
24687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24688 LDKRouteHop this_ptr_conv;
24689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24690 this_ptr_conv.is_owned = false;
24691 LDKChannelFeatures val_conv;
24692 val_conv.inner = (void*)(val & (~1));
24693 val_conv.is_owned = (val & 1) || (val == 0);
24694 val_conv = ChannelFeatures_clone(&val_conv);
24695 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
24698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24699 LDKRouteHop this_ptr_conv;
24700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24701 this_ptr_conv.is_owned = false;
24702 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
24706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24707 LDKRouteHop this_ptr_conv;
24708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24709 this_ptr_conv.is_owned = false;
24710 RouteHop_set_fee_msat(&this_ptr_conv, val);
24713 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24714 LDKRouteHop this_ptr_conv;
24715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24716 this_ptr_conv.is_owned = false;
24717 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
24721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24722 LDKRouteHop this_ptr_conv;
24723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24724 this_ptr_conv.is_owned = false;
24725 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
24728 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) {
24729 LDKPublicKey pubkey_arg_ref;
24730 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
24731 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
24732 LDKNodeFeatures node_features_arg_conv;
24733 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
24734 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
24735 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
24736 LDKChannelFeatures channel_features_arg_conv;
24737 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
24738 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
24739 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
24740 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);
24741 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24742 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24743 uint64_t ret_ref = (uint64_t)ret_var.inner;
24744 if (ret_var.is_owned) {
24750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24751 LDKRouteHop orig_conv;
24752 orig_conv.inner = (void*)(orig & (~1));
24753 orig_conv.is_owned = false;
24754 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
24755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24757 uint64_t ret_ref = (uint64_t)ret_var.inner;
24758 if (ret_var.is_owned) {
24764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
24765 LDKRouteHop obj_conv;
24766 obj_conv.inner = (void*)(obj & (~1));
24767 obj_conv.is_owned = false;
24768 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
24769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24771 CVec_u8Z_free(ret_var);
24775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24776 LDKu8slice ser_ref;
24777 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24778 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24779 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
24780 *ret_conv = RouteHop_read(ser_ref);
24781 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24782 return (uint64_t)ret_conv;
24785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24786 LDKRoute this_obj_conv;
24787 this_obj_conv.inner = (void*)(this_obj & (~1));
24788 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24789 Route_free(this_obj_conv);
24792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
24793 LDKRoute this_ptr_conv;
24794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24795 this_ptr_conv.is_owned = false;
24796 LDKCVec_CVec_RouteHopZZ val_constr;
24797 val_constr.datalen = (*env)->GetArrayLength(env, val);
24798 if (val_constr.datalen > 0)
24799 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
24801 val_constr.data = NULL;
24802 for (size_t m = 0; m < val_constr.datalen; m++) {
24803 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
24804 LDKCVec_RouteHopZ val_conv_12_constr;
24805 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
24806 if (val_conv_12_constr.datalen > 0)
24807 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24809 val_conv_12_constr.data = NULL;
24810 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
24811 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
24812 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
24813 LDKRouteHop val_conv_12_conv_10_conv;
24814 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
24815 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
24816 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
24817 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
24819 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
24820 val_constr.data[m] = val_conv_12_constr;
24822 Route_set_paths(&this_ptr_conv, val_constr);
24825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
24826 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
24827 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
24828 if (paths_arg_constr.datalen > 0)
24829 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
24831 paths_arg_constr.data = NULL;
24832 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
24833 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
24834 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
24835 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
24836 if (paths_arg_conv_12_constr.datalen > 0)
24837 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
24839 paths_arg_conv_12_constr.data = NULL;
24840 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
24841 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
24842 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
24843 LDKRouteHop paths_arg_conv_12_conv_10_conv;
24844 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
24845 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
24846 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
24847 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
24849 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
24850 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
24852 LDKRoute ret_var = Route_new(paths_arg_constr);
24853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24855 uint64_t ret_ref = (uint64_t)ret_var.inner;
24856 if (ret_var.is_owned) {
24862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24863 LDKRoute orig_conv;
24864 orig_conv.inner = (void*)(orig & (~1));
24865 orig_conv.is_owned = false;
24866 LDKRoute ret_var = Route_clone(&orig_conv);
24867 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24868 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24869 uint64_t ret_ref = (uint64_t)ret_var.inner;
24870 if (ret_var.is_owned) {
24876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
24878 obj_conv.inner = (void*)(obj & (~1));
24879 obj_conv.is_owned = false;
24880 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
24881 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24882 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24883 CVec_u8Z_free(ret_var);
24887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24888 LDKu8slice ser_ref;
24889 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24890 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24891 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
24892 *ret_conv = Route_read(ser_ref);
24893 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24894 return (uint64_t)ret_conv;
24897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24898 LDKRouteHint this_obj_conv;
24899 this_obj_conv.inner = (void*)(this_obj & (~1));
24900 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24901 RouteHint_free(this_obj_conv);
24904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24905 LDKRouteHint a_conv;
24906 a_conv.inner = (void*)(a & (~1));
24907 a_conv.is_owned = false;
24908 LDKRouteHint b_conv;
24909 b_conv.inner = (void*)(b & (~1));
24910 b_conv.is_owned = false;
24911 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
24915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24916 LDKRouteHint orig_conv;
24917 orig_conv.inner = (void*)(orig & (~1));
24918 orig_conv.is_owned = false;
24919 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
24920 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24921 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24922 uint64_t ret_ref = (uint64_t)ret_var.inner;
24923 if (ret_var.is_owned) {
24929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24930 LDKRouteHintHop this_obj_conv;
24931 this_obj_conv.inner = (void*)(this_obj & (~1));
24932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24933 RouteHintHop_free(this_obj_conv);
24936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24937 LDKRouteHintHop this_ptr_conv;
24938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24939 this_ptr_conv.is_owned = false;
24940 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24941 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
24945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24946 LDKRouteHintHop this_ptr_conv;
24947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24948 this_ptr_conv.is_owned = false;
24949 LDKPublicKey val_ref;
24950 CHECK((*env)->GetArrayLength(env, val) == 33);
24951 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24952 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
24955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
24956 LDKRouteHintHop this_ptr_conv;
24957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24958 this_ptr_conv.is_owned = false;
24959 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
24963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24964 LDKRouteHintHop this_ptr_conv;
24965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24966 this_ptr_conv.is_owned = false;
24967 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
24970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24971 LDKRouteHintHop this_ptr_conv;
24972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24973 this_ptr_conv.is_owned = false;
24974 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
24975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24977 uint64_t ret_ref = (uint64_t)ret_var.inner;
24978 if (ret_var.is_owned) {
24984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24985 LDKRouteHintHop this_ptr_conv;
24986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24987 this_ptr_conv.is_owned = false;
24988 LDKRoutingFees val_conv;
24989 val_conv.inner = (void*)(val & (~1));
24990 val_conv.is_owned = (val & 1) || (val == 0);
24991 val_conv = RoutingFees_clone(&val_conv);
24992 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
24995 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24996 LDKRouteHintHop this_ptr_conv;
24997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24998 this_ptr_conv.is_owned = false;
24999 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
25003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25004 LDKRouteHintHop this_ptr_conv;
25005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25006 this_ptr_conv.is_owned = false;
25007 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
25010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25011 LDKRouteHintHop this_ptr_conv;
25012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25013 this_ptr_conv.is_owned = false;
25014 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25015 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
25016 uint64_t ret_ref = (uint64_t)ret_copy;
25020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25021 LDKRouteHintHop this_ptr_conv;
25022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25023 this_ptr_conv.is_owned = false;
25024 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25025 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
25028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25029 LDKRouteHintHop this_ptr_conv;
25030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25031 this_ptr_conv.is_owned = false;
25032 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25033 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
25034 uint64_t ret_ref = (uint64_t)ret_copy;
25038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25039 LDKRouteHintHop this_ptr_conv;
25040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25041 this_ptr_conv.is_owned = false;
25042 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25043 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
25046 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) {
25047 LDKPublicKey src_node_id_arg_ref;
25048 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
25049 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
25050 LDKRoutingFees fees_arg_conv;
25051 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25052 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25053 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25054 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
25055 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25056 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);
25057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25059 uint64_t ret_ref = (uint64_t)ret_var.inner;
25060 if (ret_var.is_owned) {
25066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25067 LDKRouteHintHop a_conv;
25068 a_conv.inner = (void*)(a & (~1));
25069 a_conv.is_owned = false;
25070 LDKRouteHintHop b_conv;
25071 b_conv.inner = (void*)(b & (~1));
25072 b_conv.is_owned = false;
25073 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
25077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25078 LDKRouteHintHop orig_conv;
25079 orig_conv.inner = (void*)(orig & (~1));
25080 orig_conv.is_owned = false;
25081 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
25082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25084 uint64_t ret_ref = (uint64_t)ret_var.inner;
25085 if (ret_var.is_owned) {
25091 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) {
25092 LDKPublicKey our_node_id_ref;
25093 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
25094 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
25095 LDKNetworkGraph network_conv;
25096 network_conv.inner = (void*)(network & (~1));
25097 network_conv.is_owned = false;
25098 LDKPublicKey payee_ref;
25099 CHECK((*env)->GetArrayLength(env, payee) == 33);
25100 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
25101 LDKCVec_ChannelDetailsZ first_hops_constr;
25102 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25103 if (first_hops != NULL) {
25104 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
25105 if (first_hops_constr.datalen > 0)
25106 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25108 first_hops_constr.data = NULL;
25109 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
25110 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25111 int64_t first_hops_conv_16 = first_hops_vals[q];
25112 LDKChannelDetails first_hops_conv_16_conv;
25113 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25114 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25115 first_hops_constr.data[q] = first_hops_conv_16_conv;
25117 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
25118 first_hops_ptr = &first_hops_constr;
25120 LDKCVec_RouteHintZ last_hops_constr;
25121 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
25122 if (last_hops_constr.datalen > 0)
25123 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25125 last_hops_constr.data = NULL;
25126 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
25127 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25128 int64_t last_hops_conv_11 = last_hops_vals[l];
25129 LDKRouteHint last_hops_conv_11_conv;
25130 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25131 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25132 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25133 last_hops_constr.data[l] = last_hops_conv_11_conv;
25135 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
25136 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25137 if (logger_conv.free == LDKLogger_JCalls_free) {
25138 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25139 LDKLogger_JCalls_cloned(&logger_conv);
25141 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25142 *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);
25143 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25144 return (uint64_t)ret_conv;
25147 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) {
25148 LDKPublicKey our_node_id_ref;
25149 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
25150 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
25151 LDKNetworkGraph network_conv;
25152 network_conv.inner = (void*)(network & (~1));
25153 network_conv.is_owned = false;
25154 LDKPublicKey payee_ref;
25155 CHECK((*env)->GetArrayLength(env, payee) == 33);
25156 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
25157 LDKInvoiceFeatures payee_features_conv;
25158 payee_features_conv.inner = (void*)(payee_features & (~1));
25159 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
25160 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
25161 LDKCVec_ChannelDetailsZ first_hops_constr;
25162 LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
25163 if (first_hops != NULL) {
25164 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
25165 if (first_hops_constr.datalen > 0)
25166 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
25168 first_hops_constr.data = NULL;
25169 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
25170 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
25171 int64_t first_hops_conv_16 = first_hops_vals[q];
25172 LDKChannelDetails first_hops_conv_16_conv;
25173 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
25174 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
25175 first_hops_constr.data[q] = first_hops_conv_16_conv;
25177 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
25178 first_hops_ptr = &first_hops_constr;
25180 LDKCVec_RouteHintZ last_hops_constr;
25181 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
25182 if (last_hops_constr.datalen > 0)
25183 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
25185 last_hops_constr.data = NULL;
25186 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
25187 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
25188 int64_t last_hops_conv_11 = last_hops_vals[l];
25189 LDKRouteHint last_hops_conv_11_conv;
25190 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
25191 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
25192 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
25193 last_hops_constr.data[l] = last_hops_conv_11_conv;
25195 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
25196 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25197 if (logger_conv.free == LDKLogger_JCalls_free) {
25198 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25199 LDKLogger_JCalls_cloned(&logger_conv);
25201 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
25202 *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);
25203 if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
25204 return (uint64_t)ret_conv;
25207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25208 LDKNetworkGraph this_obj_conv;
25209 this_obj_conv.inner = (void*)(this_obj & (~1));
25210 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25211 NetworkGraph_free(this_obj_conv);
25214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25215 LDKNetworkGraph orig_conv;
25216 orig_conv.inner = (void*)(orig & (~1));
25217 orig_conv.is_owned = false;
25218 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
25219 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25220 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25221 uint64_t ret_ref = (uint64_t)ret_var.inner;
25222 if (ret_var.is_owned) {
25228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25229 LDKLockedNetworkGraph this_obj_conv;
25230 this_obj_conv.inner = (void*)(this_obj & (~1));
25231 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25232 LockedNetworkGraph_free(this_obj_conv);
25235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25236 LDKNetGraphMsgHandler this_obj_conv;
25237 this_obj_conv.inner = (void*)(this_obj & (~1));
25238 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25239 NetGraphMsgHandler_free(this_obj_conv);
25242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
25243 LDKThirtyTwoBytes genesis_hash_ref;
25244 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
25245 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
25246 LDKAccess *chain_access_conv_ptr = NULL;
25247 if (chain_access != 0) {
25248 LDKAccess chain_access_conv;
25249 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25250 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25251 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25252 LDKAccess_JCalls_cloned(&chain_access_conv);
25254 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25255 *chain_access_conv_ptr = chain_access_conv;
25257 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25258 if (logger_conv.free == LDKLogger_JCalls_free) {
25259 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25260 LDKLogger_JCalls_cloned(&logger_conv);
25262 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
25263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25265 uint64_t ret_ref = (uint64_t)ret_var.inner;
25266 if (ret_var.is_owned) {
25272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
25273 LDKAccess *chain_access_conv_ptr = NULL;
25274 if (chain_access != 0) {
25275 LDKAccess chain_access_conv;
25276 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25277 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25278 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25279 LDKAccess_JCalls_cloned(&chain_access_conv);
25281 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25282 *chain_access_conv_ptr = chain_access_conv;
25284 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25285 if (logger_conv.free == LDKLogger_JCalls_free) {
25286 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25287 LDKLogger_JCalls_cloned(&logger_conv);
25289 LDKNetworkGraph network_graph_conv;
25290 network_graph_conv.inner = (void*)(network_graph & (~1));
25291 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
25292 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
25293 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
25294 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25295 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25296 uint64_t ret_ref = (uint64_t)ret_var.inner;
25297 if (ret_var.is_owned) {
25303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
25304 LDKNetGraphMsgHandler this_arg_conv;
25305 this_arg_conv.inner = (void*)(this_arg & (~1));
25306 this_arg_conv.is_owned = false;
25307 LDKAccess *chain_access_conv_ptr = NULL;
25308 if (chain_access != 0) {
25309 LDKAccess chain_access_conv;
25310 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25311 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25312 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25313 LDKAccess_JCalls_cloned(&chain_access_conv);
25315 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25316 *chain_access_conv_ptr = chain_access_conv;
25318 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
25321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
25322 LDKNetGraphMsgHandler this_arg_conv;
25323 this_arg_conv.inner = (void*)(this_arg & (~1));
25324 this_arg_conv.is_owned = false;
25325 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
25326 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25327 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25328 uint64_t ret_ref = (uint64_t)ret_var.inner;
25329 if (ret_var.is_owned) {
25335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
25336 LDKLockedNetworkGraph this_arg_conv;
25337 this_arg_conv.inner = (void*)(this_arg & (~1));
25338 this_arg_conv.is_owned = false;
25339 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
25340 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25341 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25342 uint64_t ret_ref = (uint64_t)ret_var.inner;
25343 if (ret_var.is_owned) {
25349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
25350 LDKNetGraphMsgHandler this_arg_conv;
25351 this_arg_conv.inner = (void*)(this_arg & (~1));
25352 this_arg_conv.is_owned = false;
25353 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
25354 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
25355 return (uint64_t)ret;
25358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
25359 LDKNetGraphMsgHandler this_arg_conv;
25360 this_arg_conv.inner = (void*)(this_arg & (~1));
25361 this_arg_conv.is_owned = false;
25362 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
25363 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
25364 return (uint64_t)ret;
25367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25368 LDKDirectionalChannelInfo this_obj_conv;
25369 this_obj_conv.inner = (void*)(this_obj & (~1));
25370 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25371 DirectionalChannelInfo_free(this_obj_conv);
25374 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
25375 LDKDirectionalChannelInfo this_ptr_conv;
25376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25377 this_ptr_conv.is_owned = false;
25378 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
25382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25383 LDKDirectionalChannelInfo this_ptr_conv;
25384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25385 this_ptr_conv.is_owned = false;
25386 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
25389 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
25390 LDKDirectionalChannelInfo this_ptr_conv;
25391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25392 this_ptr_conv.is_owned = false;
25393 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
25397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
25398 LDKDirectionalChannelInfo this_ptr_conv;
25399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25400 this_ptr_conv.is_owned = false;
25401 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
25404 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
25405 LDKDirectionalChannelInfo this_ptr_conv;
25406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25407 this_ptr_conv.is_owned = false;
25408 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
25412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
25413 LDKDirectionalChannelInfo this_ptr_conv;
25414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25415 this_ptr_conv.is_owned = false;
25416 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
25419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25420 LDKDirectionalChannelInfo this_ptr_conv;
25421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25422 this_ptr_conv.is_owned = false;
25423 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
25427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25428 LDKDirectionalChannelInfo this_ptr_conv;
25429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25430 this_ptr_conv.is_owned = false;
25431 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
25434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25435 LDKDirectionalChannelInfo this_ptr_conv;
25436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25437 this_ptr_conv.is_owned = false;
25438 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25439 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
25440 uint64_t ret_ref = (uint64_t)ret_copy;
25444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25445 LDKDirectionalChannelInfo this_ptr_conv;
25446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25447 this_ptr_conv.is_owned = false;
25448 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25449 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
25452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
25453 LDKDirectionalChannelInfo this_ptr_conv;
25454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25455 this_ptr_conv.is_owned = false;
25456 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
25457 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25458 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25459 uint64_t ret_ref = (uint64_t)ret_var.inner;
25460 if (ret_var.is_owned) {
25466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25467 LDKDirectionalChannelInfo this_ptr_conv;
25468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25469 this_ptr_conv.is_owned = false;
25470 LDKRoutingFees val_conv;
25471 val_conv.inner = (void*)(val & (~1));
25472 val_conv.is_owned = (val & 1) || (val == 0);
25473 val_conv = RoutingFees_clone(&val_conv);
25474 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
25477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25478 LDKDirectionalChannelInfo this_ptr_conv;
25479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25480 this_ptr_conv.is_owned = false;
25481 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
25482 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25483 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25484 uint64_t ret_ref = (uint64_t)ret_var.inner;
25485 if (ret_var.is_owned) {
25491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25492 LDKDirectionalChannelInfo this_ptr_conv;
25493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25494 this_ptr_conv.is_owned = false;
25495 LDKChannelUpdate val_conv;
25496 val_conv.inner = (void*)(val & (~1));
25497 val_conv.is_owned = (val & 1) || (val == 0);
25498 val_conv = ChannelUpdate_clone(&val_conv);
25499 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
25502 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) {
25503 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
25504 LDKRoutingFees fees_arg_conv;
25505 fees_arg_conv.inner = (void*)(fees_arg & (~1));
25506 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
25507 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
25508 LDKChannelUpdate last_update_message_arg_conv;
25509 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
25510 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
25511 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
25512 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);
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_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25523 LDKDirectionalChannelInfo orig_conv;
25524 orig_conv.inner = (void*)(orig & (~1));
25525 orig_conv.is_owned = false;
25526 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
25527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25529 uint64_t ret_ref = (uint64_t)ret_var.inner;
25530 if (ret_var.is_owned) {
25536 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
25537 LDKDirectionalChannelInfo obj_conv;
25538 obj_conv.inner = (void*)(obj & (~1));
25539 obj_conv.is_owned = false;
25540 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
25541 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25542 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25543 CVec_u8Z_free(ret_var);
25547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25548 LDKu8slice ser_ref;
25549 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25550 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25551 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
25552 *ret_conv = DirectionalChannelInfo_read(ser_ref);
25553 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25554 return (uint64_t)ret_conv;
25557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25558 LDKChannelInfo this_obj_conv;
25559 this_obj_conv.inner = (void*)(this_obj & (~1));
25560 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25561 ChannelInfo_free(this_obj_conv);
25564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
25565 LDKChannelInfo this_ptr_conv;
25566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25567 this_ptr_conv.is_owned = false;
25568 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
25569 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25570 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25571 uint64_t ret_ref = (uint64_t)ret_var.inner;
25572 if (ret_var.is_owned) {
25578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25579 LDKChannelInfo this_ptr_conv;
25580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25581 this_ptr_conv.is_owned = false;
25582 LDKChannelFeatures val_conv;
25583 val_conv.inner = (void*)(val & (~1));
25584 val_conv.is_owned = (val & 1) || (val == 0);
25585 val_conv = ChannelFeatures_clone(&val_conv);
25586 ChannelInfo_set_features(&this_ptr_conv, val_conv);
25589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
25590 LDKChannelInfo this_ptr_conv;
25591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25592 this_ptr_conv.is_owned = false;
25593 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25594 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
25598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25599 LDKChannelInfo this_ptr_conv;
25600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25601 this_ptr_conv.is_owned = false;
25602 LDKPublicKey val_ref;
25603 CHECK((*env)->GetArrayLength(env, val) == 33);
25604 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25605 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
25608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
25609 LDKChannelInfo this_ptr_conv;
25610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25611 this_ptr_conv.is_owned = false;
25612 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
25613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25615 uint64_t ret_ref = (uint64_t)ret_var.inner;
25616 if (ret_var.is_owned) {
25622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25623 LDKChannelInfo this_ptr_conv;
25624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25625 this_ptr_conv.is_owned = false;
25626 LDKDirectionalChannelInfo val_conv;
25627 val_conv.inner = (void*)(val & (~1));
25628 val_conv.is_owned = (val & 1) || (val == 0);
25629 val_conv = DirectionalChannelInfo_clone(&val_conv);
25630 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
25633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
25634 LDKChannelInfo this_ptr_conv;
25635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25636 this_ptr_conv.is_owned = false;
25637 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25638 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
25642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25643 LDKChannelInfo this_ptr_conv;
25644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25645 this_ptr_conv.is_owned = false;
25646 LDKPublicKey val_ref;
25647 CHECK((*env)->GetArrayLength(env, val) == 33);
25648 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
25649 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
25652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
25653 LDKChannelInfo this_ptr_conv;
25654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25655 this_ptr_conv.is_owned = false;
25656 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
25657 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25658 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25659 uint64_t ret_ref = (uint64_t)ret_var.inner;
25660 if (ret_var.is_owned) {
25666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25667 LDKChannelInfo this_ptr_conv;
25668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25669 this_ptr_conv.is_owned = false;
25670 LDKDirectionalChannelInfo val_conv;
25671 val_conv.inner = (void*)(val & (~1));
25672 val_conv.is_owned = (val & 1) || (val == 0);
25673 val_conv = DirectionalChannelInfo_clone(&val_conv);
25674 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
25677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
25678 LDKChannelInfo this_ptr_conv;
25679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25680 this_ptr_conv.is_owned = false;
25681 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25682 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
25683 uint64_t ret_ref = (uint64_t)ret_copy;
25687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25688 LDKChannelInfo this_ptr_conv;
25689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25690 this_ptr_conv.is_owned = false;
25691 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
25692 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
25695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25696 LDKChannelInfo this_ptr_conv;
25697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25698 this_ptr_conv.is_owned = false;
25699 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
25700 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25701 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25702 uint64_t ret_ref = (uint64_t)ret_var.inner;
25703 if (ret_var.is_owned) {
25709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25710 LDKChannelInfo this_ptr_conv;
25711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25712 this_ptr_conv.is_owned = false;
25713 LDKChannelAnnouncement val_conv;
25714 val_conv.inner = (void*)(val & (~1));
25715 val_conv.is_owned = (val & 1) || (val == 0);
25716 val_conv = ChannelAnnouncement_clone(&val_conv);
25717 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
25720 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) {
25721 LDKChannelFeatures features_arg_conv;
25722 features_arg_conv.inner = (void*)(features_arg & (~1));
25723 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
25724 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
25725 LDKPublicKey node_one_arg_ref;
25726 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
25727 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
25728 LDKDirectionalChannelInfo one_to_two_arg_conv;
25729 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
25730 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
25731 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
25732 LDKPublicKey node_two_arg_ref;
25733 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
25734 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
25735 LDKDirectionalChannelInfo two_to_one_arg_conv;
25736 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
25737 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
25738 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
25739 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
25740 LDKChannelAnnouncement announcement_message_arg_conv;
25741 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
25742 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
25743 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
25744 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);
25745 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25746 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25747 uint64_t ret_ref = (uint64_t)ret_var.inner;
25748 if (ret_var.is_owned) {
25754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25755 LDKChannelInfo orig_conv;
25756 orig_conv.inner = (void*)(orig & (~1));
25757 orig_conv.is_owned = false;
25758 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
25759 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25760 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25761 uint64_t ret_ref = (uint64_t)ret_var.inner;
25762 if (ret_var.is_owned) {
25768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
25769 LDKChannelInfo obj_conv;
25770 obj_conv.inner = (void*)(obj & (~1));
25771 obj_conv.is_owned = false;
25772 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
25773 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25774 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25775 CVec_u8Z_free(ret_var);
25779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25780 LDKu8slice ser_ref;
25781 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25782 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25783 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
25784 *ret_conv = ChannelInfo_read(ser_ref);
25785 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25786 return (uint64_t)ret_conv;
25789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25790 LDKRoutingFees this_obj_conv;
25791 this_obj_conv.inner = (void*)(this_obj & (~1));
25792 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25793 RoutingFees_free(this_obj_conv);
25796 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
25797 LDKRoutingFees this_ptr_conv;
25798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25799 this_ptr_conv.is_owned = false;
25800 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
25804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25805 LDKRoutingFees this_ptr_conv;
25806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25807 this_ptr_conv.is_owned = false;
25808 RoutingFees_set_base_msat(&this_ptr_conv, val);
25811 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
25812 LDKRoutingFees this_ptr_conv;
25813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25814 this_ptr_conv.is_owned = false;
25815 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
25819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25820 LDKRoutingFees this_ptr_conv;
25821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25822 this_ptr_conv.is_owned = false;
25823 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
25826 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) {
25827 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
25828 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25829 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25830 uint64_t ret_ref = (uint64_t)ret_var.inner;
25831 if (ret_var.is_owned) {
25837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25838 LDKRoutingFees a_conv;
25839 a_conv.inner = (void*)(a & (~1));
25840 a_conv.is_owned = false;
25841 LDKRoutingFees b_conv;
25842 b_conv.inner = (void*)(b & (~1));
25843 b_conv.is_owned = false;
25844 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
25848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25849 LDKRoutingFees orig_conv;
25850 orig_conv.inner = (void*)(orig & (~1));
25851 orig_conv.is_owned = false;
25852 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
25853 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25854 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25855 uint64_t ret_ref = (uint64_t)ret_var.inner;
25856 if (ret_var.is_owned) {
25862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
25863 LDKRoutingFees obj_conv;
25864 obj_conv.inner = (void*)(obj & (~1));
25865 obj_conv.is_owned = false;
25866 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
25867 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25868 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25869 CVec_u8Z_free(ret_var);
25873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25874 LDKu8slice ser_ref;
25875 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25876 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25877 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
25878 *ret_conv = RoutingFees_read(ser_ref);
25879 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25880 return (uint64_t)ret_conv;
25883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25884 LDKNodeAnnouncementInfo this_obj_conv;
25885 this_obj_conv.inner = (void*)(this_obj & (~1));
25886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25887 NodeAnnouncementInfo_free(this_obj_conv);
25890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
25891 LDKNodeAnnouncementInfo this_ptr_conv;
25892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25893 this_ptr_conv.is_owned = false;
25894 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
25895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25897 uint64_t ret_ref = (uint64_t)ret_var.inner;
25898 if (ret_var.is_owned) {
25904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25905 LDKNodeAnnouncementInfo this_ptr_conv;
25906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25907 this_ptr_conv.is_owned = false;
25908 LDKNodeFeatures val_conv;
25909 val_conv.inner = (void*)(val & (~1));
25910 val_conv.is_owned = (val & 1) || (val == 0);
25911 val_conv = NodeFeatures_clone(&val_conv);
25912 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
25915 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
25916 LDKNodeAnnouncementInfo this_ptr_conv;
25917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25918 this_ptr_conv.is_owned = false;
25919 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
25923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
25924 LDKNodeAnnouncementInfo this_ptr_conv;
25925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25926 this_ptr_conv.is_owned = false;
25927 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
25930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
25931 LDKNodeAnnouncementInfo this_ptr_conv;
25932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25933 this_ptr_conv.is_owned = false;
25934 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
25935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
25939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25940 LDKNodeAnnouncementInfo this_ptr_conv;
25941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25942 this_ptr_conv.is_owned = false;
25943 LDKThreeBytes val_ref;
25944 CHECK((*env)->GetArrayLength(env, val) == 3);
25945 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
25946 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
25949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
25950 LDKNodeAnnouncementInfo this_ptr_conv;
25951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25952 this_ptr_conv.is_owned = false;
25953 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25954 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
25958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
25959 LDKNodeAnnouncementInfo this_ptr_conv;
25960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25961 this_ptr_conv.is_owned = false;
25962 LDKThirtyTwoBytes val_ref;
25963 CHECK((*env)->GetArrayLength(env, val) == 32);
25964 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
25965 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
25968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
25969 LDKNodeAnnouncementInfo this_ptr_conv;
25970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25971 this_ptr_conv.is_owned = false;
25972 LDKCVec_NetAddressZ val_constr;
25973 val_constr.datalen = (*env)->GetArrayLength(env, val);
25974 if (val_constr.datalen > 0)
25975 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
25977 val_constr.data = NULL;
25978 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
25979 for (size_t m = 0; m < val_constr.datalen; m++) {
25980 int64_t val_conv_12 = val_vals[m];
25981 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
25982 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
25983 val_constr.data[m] = val_conv_12_conv;
25985 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
25986 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
25989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
25990 LDKNodeAnnouncementInfo this_ptr_conv;
25991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25992 this_ptr_conv.is_owned = false;
25993 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
25994 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25995 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25996 uint64_t ret_ref = (uint64_t)ret_var.inner;
25997 if (ret_var.is_owned) {
26003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26004 LDKNodeAnnouncementInfo this_ptr_conv;
26005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26006 this_ptr_conv.is_owned = false;
26007 LDKNodeAnnouncement val_conv;
26008 val_conv.inner = (void*)(val & (~1));
26009 val_conv.is_owned = (val & 1) || (val == 0);
26010 val_conv = NodeAnnouncement_clone(&val_conv);
26011 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
26014 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) {
26015 LDKNodeFeatures features_arg_conv;
26016 features_arg_conv.inner = (void*)(features_arg & (~1));
26017 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
26018 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
26019 LDKThreeBytes rgb_arg_ref;
26020 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
26021 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
26022 LDKThirtyTwoBytes alias_arg_ref;
26023 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
26024 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
26025 LDKCVec_NetAddressZ addresses_arg_constr;
26026 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
26027 if (addresses_arg_constr.datalen > 0)
26028 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
26030 addresses_arg_constr.data = NULL;
26031 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
26032 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
26033 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
26034 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
26035 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
26037 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
26038 LDKNodeAnnouncement announcement_message_arg_conv;
26039 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
26040 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
26041 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
26042 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
26043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26045 uint64_t ret_ref = (uint64_t)ret_var.inner;
26046 if (ret_var.is_owned) {
26052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26053 LDKNodeAnnouncementInfo orig_conv;
26054 orig_conv.inner = (void*)(orig & (~1));
26055 orig_conv.is_owned = false;
26056 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
26057 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26058 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26059 uint64_t ret_ref = (uint64_t)ret_var.inner;
26060 if (ret_var.is_owned) {
26066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
26067 LDKNodeAnnouncementInfo obj_conv;
26068 obj_conv.inner = (void*)(obj & (~1));
26069 obj_conv.is_owned = false;
26070 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
26071 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26072 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26073 CVec_u8Z_free(ret_var);
26077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26078 LDKu8slice ser_ref;
26079 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26080 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26081 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
26082 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
26083 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26084 return (uint64_t)ret_conv;
26087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26088 LDKNodeInfo this_obj_conv;
26089 this_obj_conv.inner = (void*)(this_obj & (~1));
26090 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26091 NodeInfo_free(this_obj_conv);
26094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
26095 LDKNodeInfo this_ptr_conv;
26096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26097 this_ptr_conv.is_owned = false;
26098 LDKCVec_u64Z val_constr;
26099 val_constr.datalen = (*env)->GetArrayLength(env, val);
26100 if (val_constr.datalen > 0)
26101 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26103 val_constr.data = NULL;
26104 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
26105 for (size_t g = 0; g < val_constr.datalen; g++) {
26106 int64_t val_conv_6 = val_vals[g];
26107 val_constr.data[g] = val_conv_6;
26109 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
26110 NodeInfo_set_channels(&this_ptr_conv, val_constr);
26113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
26114 LDKNodeInfo this_ptr_conv;
26115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26116 this_ptr_conv.is_owned = false;
26117 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
26118 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26119 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26120 uint64_t ret_ref = (uint64_t)ret_var.inner;
26121 if (ret_var.is_owned) {
26127 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) {
26128 LDKNodeInfo this_ptr_conv;
26129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26130 this_ptr_conv.is_owned = false;
26131 LDKRoutingFees val_conv;
26132 val_conv.inner = (void*)(val & (~1));
26133 val_conv.is_owned = (val & 1) || (val == 0);
26134 val_conv = RoutingFees_clone(&val_conv);
26135 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
26138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
26139 LDKNodeInfo this_ptr_conv;
26140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26141 this_ptr_conv.is_owned = false;
26142 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
26143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26145 uint64_t ret_ref = (uint64_t)ret_var.inner;
26146 if (ret_var.is_owned) {
26152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26153 LDKNodeInfo this_ptr_conv;
26154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26155 this_ptr_conv.is_owned = false;
26156 LDKNodeAnnouncementInfo val_conv;
26157 val_conv.inner = (void*)(val & (~1));
26158 val_conv.is_owned = (val & 1) || (val == 0);
26159 val_conv = NodeAnnouncementInfo_clone(&val_conv);
26160 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
26163 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) {
26164 LDKCVec_u64Z channels_arg_constr;
26165 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
26166 if (channels_arg_constr.datalen > 0)
26167 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26169 channels_arg_constr.data = NULL;
26170 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
26171 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
26172 int64_t channels_arg_conv_6 = channels_arg_vals[g];
26173 channels_arg_constr.data[g] = channels_arg_conv_6;
26175 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
26176 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
26177 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
26178 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
26179 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
26180 LDKNodeAnnouncementInfo announcement_info_arg_conv;
26181 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
26182 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
26183 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
26184 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
26185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26187 uint64_t ret_ref = (uint64_t)ret_var.inner;
26188 if (ret_var.is_owned) {
26194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26195 LDKNodeInfo orig_conv;
26196 orig_conv.inner = (void*)(orig & (~1));
26197 orig_conv.is_owned = false;
26198 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
26199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26201 uint64_t ret_ref = (uint64_t)ret_var.inner;
26202 if (ret_var.is_owned) {
26208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
26209 LDKNodeInfo obj_conv;
26210 obj_conv.inner = (void*)(obj & (~1));
26211 obj_conv.is_owned = false;
26212 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
26213 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26214 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26215 CVec_u8Z_free(ret_var);
26219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26220 LDKu8slice ser_ref;
26221 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26222 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26223 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
26224 *ret_conv = NodeInfo_read(ser_ref);
26225 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26226 return (uint64_t)ret_conv;
26229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
26230 LDKNetworkGraph obj_conv;
26231 obj_conv.inner = (void*)(obj & (~1));
26232 obj_conv.is_owned = false;
26233 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
26234 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
26235 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
26236 CVec_u8Z_free(ret_var);
26240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
26241 LDKu8slice ser_ref;
26242 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
26243 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
26244 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
26245 *ret_conv = NetworkGraph_read(ser_ref);
26246 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
26247 return (uint64_t)ret_conv;
26250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
26251 LDKThirtyTwoBytes genesis_hash_ref;
26252 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
26253 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
26254 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
26255 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26256 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26257 uint64_t ret_ref = (uint64_t)ret_var.inner;
26258 if (ret_var.is_owned) {
26264 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) {
26265 LDKNetworkGraph this_arg_conv;
26266 this_arg_conv.inner = (void*)(this_arg & (~1));
26267 this_arg_conv.is_owned = false;
26268 LDKNodeAnnouncement msg_conv;
26269 msg_conv.inner = (void*)(msg & (~1));
26270 msg_conv.is_owned = false;
26271 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26272 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
26273 return (uint64_t)ret_conv;
26276 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) {
26277 LDKNetworkGraph this_arg_conv;
26278 this_arg_conv.inner = (void*)(this_arg & (~1));
26279 this_arg_conv.is_owned = false;
26280 LDKUnsignedNodeAnnouncement msg_conv;
26281 msg_conv.inner = (void*)(msg & (~1));
26282 msg_conv.is_owned = false;
26283 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26284 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
26285 return (uint64_t)ret_conv;
26288 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) {
26289 LDKNetworkGraph this_arg_conv;
26290 this_arg_conv.inner = (void*)(this_arg & (~1));
26291 this_arg_conv.is_owned = false;
26292 LDKChannelAnnouncement msg_conv;
26293 msg_conv.inner = (void*)(msg & (~1));
26294 msg_conv.is_owned = false;
26295 LDKAccess *chain_access_conv_ptr = NULL;
26296 if (chain_access != 0) {
26297 LDKAccess chain_access_conv;
26298 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
26299 if (chain_access_conv.free == LDKAccess_JCalls_free) {
26300 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26301 LDKAccess_JCalls_cloned(&chain_access_conv);
26303 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
26304 *chain_access_conv_ptr = chain_access_conv;
26306 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26307 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
26308 return (uint64_t)ret_conv;
26311 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) {
26312 LDKNetworkGraph this_arg_conv;
26313 this_arg_conv.inner = (void*)(this_arg & (~1));
26314 this_arg_conv.is_owned = false;
26315 LDKUnsignedChannelAnnouncement msg_conv;
26316 msg_conv.inner = (void*)(msg & (~1));
26317 msg_conv.is_owned = false;
26318 LDKAccess *chain_access_conv_ptr = NULL;
26319 if (chain_access != 0) {
26320 LDKAccess chain_access_conv;
26321 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
26322 if (chain_access_conv.free == LDKAccess_JCalls_free) {
26323 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26324 LDKAccess_JCalls_cloned(&chain_access_conv);
26326 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
26327 *chain_access_conv_ptr = chain_access_conv;
26329 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26330 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
26331 return (uint64_t)ret_conv;
26334 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) {
26335 LDKNetworkGraph this_arg_conv;
26336 this_arg_conv.inner = (void*)(this_arg & (~1));
26337 this_arg_conv.is_owned = false;
26338 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
26341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
26342 LDKNetworkGraph this_arg_conv;
26343 this_arg_conv.inner = (void*)(this_arg & (~1));
26344 this_arg_conv.is_owned = false;
26345 LDKChannelUpdate msg_conv;
26346 msg_conv.inner = (void*)(msg & (~1));
26347 msg_conv.is_owned = false;
26348 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26349 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
26350 return (uint64_t)ret_conv;
26353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
26354 LDKNetworkGraph this_arg_conv;
26355 this_arg_conv.inner = (void*)(this_arg & (~1));
26356 this_arg_conv.is_owned = false;
26357 LDKUnsignedChannelUpdate msg_conv;
26358 msg_conv.inner = (void*)(msg & (~1));
26359 msg_conv.is_owned = false;
26360 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
26361 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
26362 return (uint64_t)ret_conv;
26365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26366 LDKFilesystemPersister this_obj_conv;
26367 this_obj_conv.inner = (void*)(this_obj & (~1));
26368 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26369 FilesystemPersister_free(this_obj_conv);
26372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
26373 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
26374 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
26375 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26376 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26377 uint64_t ret_ref = (uint64_t)ret_var.inner;
26378 if (ret_var.is_owned) {
26384 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
26385 LDKFilesystemPersister this_arg_conv;
26386 this_arg_conv.inner = (void*)(this_arg & (~1));
26387 this_arg_conv.is_owned = false;
26388 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
26389 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
26395 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
26396 LDKChannelManager manager_conv;
26397 manager_conv.inner = (void*)(manager & (~1));
26398 manager_conv.is_owned = false;
26399 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26400 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
26401 return (uint64_t)ret_conv;
26404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
26405 LDKFilesystemPersister this_arg_conv;
26406 this_arg_conv.inner = (void*)(this_arg & (~1));
26407 this_arg_conv.is_owned = false;
26408 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26409 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26411 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26413 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
26414 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
26415 return (uint64_t)ret_conv;
26418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
26419 LDKFilesystemPersister this_arg_conv;
26420 this_arg_conv.inner = (void*)(this_arg & (~1));
26421 this_arg_conv.is_owned = false;
26422 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
26423 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
26424 return (uint64_t)ret;
26427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26428 LDKBackgroundProcessor this_obj_conv;
26429 this_obj_conv.inner = (void*)(this_obj & (~1));
26430 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26431 BackgroundProcessor_free(this_obj_conv);
26434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26435 if ((this_ptr & 1) != 0) return;
26436 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
26437 FREE((void*)this_ptr);
26438 ChannelManagerPersister_free(this_ptr_conv);
26441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
26442 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
26443 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
26444 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26445 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
26447 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
26448 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
26449 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26450 LDKEventHandler_JCalls_cloned(&event_handler_conv);
26452 LDKChainMonitor chain_monitor_conv;
26453 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
26454 chain_monitor_conv.is_owned = false;
26455 LDKChannelManager channel_manager_conv;
26456 channel_manager_conv.inner = (void*)(channel_manager & (~1));
26457 channel_manager_conv.is_owned = false;
26458 LDKPeerManager peer_manager_conv;
26459 peer_manager_conv.inner = (void*)(peer_manager & (~1));
26460 peer_manager_conv.is_owned = false;
26461 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
26462 if (logger_conv.free == LDKLogger_JCalls_free) {
26463 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26464 LDKLogger_JCalls_cloned(&logger_conv);
26466 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
26467 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26468 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26469 uint64_t ret_ref = (uint64_t)ret_var.inner;
26470 if (ret_var.is_owned) {
26476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
26477 LDKBackgroundProcessor this_arg_conv;
26478 this_arg_conv.inner = (void*)(this_arg & (~1));
26479 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26480 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26481 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26482 *ret_conv = BackgroundProcessor_join(this_arg_conv);
26483 return (uint64_t)ret_conv;
26486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
26487 LDKBackgroundProcessor this_arg_conv;
26488 this_arg_conv.inner = (void*)(this_arg & (~1));
26489 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26490 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
26491 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
26492 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
26493 return (uint64_t)ret_conv;
26496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
26500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26501 LDKInvoice this_obj_conv;
26502 this_obj_conv.inner = (void*)(this_obj & (~1));
26503 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26504 Invoice_free(this_obj_conv);
26507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26509 a_conv.inner = (void*)(a & (~1));
26510 a_conv.is_owned = false;
26512 b_conv.inner = (void*)(b & (~1));
26513 b_conv.is_owned = false;
26514 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
26518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26519 LDKInvoice orig_conv;
26520 orig_conv.inner = (void*)(orig & (~1));
26521 orig_conv.is_owned = false;
26522 LDKInvoice ret_var = Invoice_clone(&orig_conv);
26523 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26524 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26525 uint64_t ret_ref = (uint64_t)ret_var.inner;
26526 if (ret_var.is_owned) {
26532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26533 LDKSignedRawInvoice this_obj_conv;
26534 this_obj_conv.inner = (void*)(this_obj & (~1));
26535 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26536 SignedRawInvoice_free(this_obj_conv);
26539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26540 LDKSignedRawInvoice a_conv;
26541 a_conv.inner = (void*)(a & (~1));
26542 a_conv.is_owned = false;
26543 LDKSignedRawInvoice b_conv;
26544 b_conv.inner = (void*)(b & (~1));
26545 b_conv.is_owned = false;
26546 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
26550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26551 LDKSignedRawInvoice orig_conv;
26552 orig_conv.inner = (void*)(orig & (~1));
26553 orig_conv.is_owned = false;
26554 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
26555 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26556 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26557 uint64_t ret_ref = (uint64_t)ret_var.inner;
26558 if (ret_var.is_owned) {
26564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26565 LDKRawInvoice this_obj_conv;
26566 this_obj_conv.inner = (void*)(this_obj & (~1));
26567 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26568 RawInvoice_free(this_obj_conv);
26571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
26572 LDKRawInvoice this_ptr_conv;
26573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26574 this_ptr_conv.is_owned = false;
26575 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
26576 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26577 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26578 uint64_t ret_ref = (uint64_t)ret_var.inner;
26579 if (ret_var.is_owned) {
26585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26586 LDKRawInvoice this_ptr_conv;
26587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26588 this_ptr_conv.is_owned = false;
26589 LDKRawDataPart val_conv;
26590 val_conv.inner = (void*)(val & (~1));
26591 val_conv.is_owned = (val & 1) || (val == 0);
26592 val_conv = RawDataPart_clone(&val_conv);
26593 RawInvoice_set_data(&this_ptr_conv, val_conv);
26596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26597 LDKRawInvoice a_conv;
26598 a_conv.inner = (void*)(a & (~1));
26599 a_conv.is_owned = false;
26600 LDKRawInvoice b_conv;
26601 b_conv.inner = (void*)(b & (~1));
26602 b_conv.is_owned = false;
26603 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
26607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26608 LDKRawInvoice orig_conv;
26609 orig_conv.inner = (void*)(orig & (~1));
26610 orig_conv.is_owned = false;
26611 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
26612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26614 uint64_t ret_ref = (uint64_t)ret_var.inner;
26615 if (ret_var.is_owned) {
26621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26622 LDKRawDataPart this_obj_conv;
26623 this_obj_conv.inner = (void*)(this_obj & (~1));
26624 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26625 RawDataPart_free(this_obj_conv);
26628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
26629 LDKRawDataPart this_ptr_conv;
26630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26631 this_ptr_conv.is_owned = false;
26632 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
26633 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26634 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26635 uint64_t ret_ref = (uint64_t)ret_var.inner;
26636 if (ret_var.is_owned) {
26642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
26643 LDKRawDataPart this_ptr_conv;
26644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
26645 this_ptr_conv.is_owned = false;
26646 LDKPositiveTimestamp val_conv;
26647 val_conv.inner = (void*)(val & (~1));
26648 val_conv.is_owned = (val & 1) || (val == 0);
26649 val_conv = PositiveTimestamp_clone(&val_conv);
26650 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
26653 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26654 LDKRawDataPart a_conv;
26655 a_conv.inner = (void*)(a & (~1));
26656 a_conv.is_owned = false;
26657 LDKRawDataPart b_conv;
26658 b_conv.inner = (void*)(b & (~1));
26659 b_conv.is_owned = false;
26660 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
26664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26665 LDKRawDataPart orig_conv;
26666 orig_conv.inner = (void*)(orig & (~1));
26667 orig_conv.is_owned = false;
26668 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
26669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26671 uint64_t ret_ref = (uint64_t)ret_var.inner;
26672 if (ret_var.is_owned) {
26678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26679 LDKPositiveTimestamp this_obj_conv;
26680 this_obj_conv.inner = (void*)(this_obj & (~1));
26681 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26682 PositiveTimestamp_free(this_obj_conv);
26685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26686 LDKPositiveTimestamp a_conv;
26687 a_conv.inner = (void*)(a & (~1));
26688 a_conv.is_owned = false;
26689 LDKPositiveTimestamp b_conv;
26690 b_conv.inner = (void*)(b & (~1));
26691 b_conv.is_owned = false;
26692 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
26696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26697 LDKPositiveTimestamp orig_conv;
26698 orig_conv.inner = (void*)(orig & (~1));
26699 orig_conv.is_owned = false;
26700 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
26701 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26702 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26703 uint64_t ret_ref = (uint64_t)ret_var.inner;
26704 if (ret_var.is_owned) {
26710 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26711 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
26712 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
26716 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
26717 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
26721 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
26722 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
26726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
26727 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
26731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
26732 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
26736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26737 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
26738 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
26739 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
26743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
26744 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
26745 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
26749 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26750 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
26751 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
26755 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
26756 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
26760 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
26761 jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
26765 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
26766 jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
26770 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
26771 jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
26775 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
26776 jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
26780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26781 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
26782 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
26783 jboolean ret_val = Currency_eq(a_conv, b_conv);
26787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26788 LDKSha256 this_obj_conv;
26789 this_obj_conv.inner = (void*)(this_obj & (~1));
26790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26791 Sha256_free(this_obj_conv);
26794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26796 a_conv.inner = (void*)(a & (~1));
26797 a_conv.is_owned = false;
26799 b_conv.inner = (void*)(b & (~1));
26800 b_conv.is_owned = false;
26801 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
26805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26806 LDKSha256 orig_conv;
26807 orig_conv.inner = (void*)(orig & (~1));
26808 orig_conv.is_owned = false;
26809 LDKSha256 ret_var = Sha256_clone(&orig_conv);
26810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26812 uint64_t ret_ref = (uint64_t)ret_var.inner;
26813 if (ret_var.is_owned) {
26819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26820 LDKDescription this_obj_conv;
26821 this_obj_conv.inner = (void*)(this_obj & (~1));
26822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26823 Description_free(this_obj_conv);
26826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26827 LDKDescription a_conv;
26828 a_conv.inner = (void*)(a & (~1));
26829 a_conv.is_owned = false;
26830 LDKDescription b_conv;
26831 b_conv.inner = (void*)(b & (~1));
26832 b_conv.is_owned = false;
26833 jboolean ret_val = Description_eq(&a_conv, &b_conv);
26837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26838 LDKDescription orig_conv;
26839 orig_conv.inner = (void*)(orig & (~1));
26840 orig_conv.is_owned = false;
26841 LDKDescription ret_var = Description_clone(&orig_conv);
26842 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26843 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26844 uint64_t ret_ref = (uint64_t)ret_var.inner;
26845 if (ret_var.is_owned) {
26851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26852 LDKPayeePubKey this_obj_conv;
26853 this_obj_conv.inner = (void*)(this_obj & (~1));
26854 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26855 PayeePubKey_free(this_obj_conv);
26858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26859 LDKPayeePubKey a_conv;
26860 a_conv.inner = (void*)(a & (~1));
26861 a_conv.is_owned = false;
26862 LDKPayeePubKey b_conv;
26863 b_conv.inner = (void*)(b & (~1));
26864 b_conv.is_owned = false;
26865 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
26869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26870 LDKPayeePubKey orig_conv;
26871 orig_conv.inner = (void*)(orig & (~1));
26872 orig_conv.is_owned = false;
26873 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
26874 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26875 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26876 uint64_t ret_ref = (uint64_t)ret_var.inner;
26877 if (ret_var.is_owned) {
26883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26884 LDKExpiryTime this_obj_conv;
26885 this_obj_conv.inner = (void*)(this_obj & (~1));
26886 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26887 ExpiryTime_free(this_obj_conv);
26890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26891 LDKExpiryTime a_conv;
26892 a_conv.inner = (void*)(a & (~1));
26893 a_conv.is_owned = false;
26894 LDKExpiryTime b_conv;
26895 b_conv.inner = (void*)(b & (~1));
26896 b_conv.is_owned = false;
26897 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
26901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26902 LDKExpiryTime orig_conv;
26903 orig_conv.inner = (void*)(orig & (~1));
26904 orig_conv.is_owned = false;
26905 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
26906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26908 uint64_t ret_ref = (uint64_t)ret_var.inner;
26909 if (ret_var.is_owned) {
26915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
26916 LDKMinFinalCltvExpiry this_obj_conv;
26917 this_obj_conv.inner = (void*)(this_obj & (~1));
26918 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
26919 MinFinalCltvExpiry_free(this_obj_conv);
26922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26923 LDKMinFinalCltvExpiry a_conv;
26924 a_conv.inner = (void*)(a & (~1));
26925 a_conv.is_owned = false;
26926 LDKMinFinalCltvExpiry b_conv;
26927 b_conv.inner = (void*)(b & (~1));
26928 b_conv.is_owned = false;
26929 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
26933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26934 LDKMinFinalCltvExpiry orig_conv;
26935 orig_conv.inner = (void*)(orig & (~1));
26936 orig_conv.is_owned = false;
26937 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
26938 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26939 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26940 uint64_t ret_ref = (uint64_t)ret_var.inner;
26941 if (ret_var.is_owned) {
26947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26948 if ((this_ptr & 1) != 0) return;
26949 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
26950 FREE((void*)this_ptr);
26951 Fallback_free(this_ptr_conv);
26954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26955 LDKFallback* orig_conv = (LDKFallback*)orig;
26956 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26957 *ret_copy = Fallback_clone(orig_conv);
26958 uint64_t ret_ref = (uint64_t)ret_copy;
26962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
26964 LDKCVec_u8Z program_ref;
26965 program_ref.datalen = (*env)->GetArrayLength(env, program);
26966 program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
26967 (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
26968 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26969 *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
26970 uint64_t ret_ref = (uint64_t)ret_copy;
26974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
26975 LDKTwentyBytes a_ref;
26976 CHECK((*env)->GetArrayLength(env, a) == 20);
26977 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
26978 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26979 *ret_copy = Fallback_pub_key_hash(a_ref);
26980 uint64_t ret_ref = (uint64_t)ret_copy;
26984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
26985 LDKTwentyBytes a_ref;
26986 CHECK((*env)->GetArrayLength(env, a) == 20);
26987 (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
26988 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
26989 *ret_copy = Fallback_script_hash(a_ref);
26990 uint64_t ret_ref = (uint64_t)ret_copy;
26994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26995 LDKFallback* a_conv = (LDKFallback*)a;
26996 LDKFallback* b_conv = (LDKFallback*)b;
26997 jboolean ret_val = Fallback_eq(a_conv, b_conv);
27001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27002 LDKInvoiceSignature this_obj_conv;
27003 this_obj_conv.inner = (void*)(this_obj & (~1));
27004 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27005 InvoiceSignature_free(this_obj_conv);
27008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27009 LDKInvoiceSignature a_conv;
27010 a_conv.inner = (void*)(a & (~1));
27011 a_conv.is_owned = false;
27012 LDKInvoiceSignature b_conv;
27013 b_conv.inner = (void*)(b & (~1));
27014 b_conv.is_owned = false;
27015 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
27019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27020 LDKInvoiceSignature orig_conv;
27021 orig_conv.inner = (void*)(orig & (~1));
27022 orig_conv.is_owned = false;
27023 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
27024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27026 uint64_t ret_ref = (uint64_t)ret_var.inner;
27027 if (ret_var.is_owned) {
27033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
27034 LDKPrivateRoute this_obj_conv;
27035 this_obj_conv.inner = (void*)(this_obj & (~1));
27036 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
27037 PrivateRoute_free(this_obj_conv);
27040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27041 LDKPrivateRoute a_conv;
27042 a_conv.inner = (void*)(a & (~1));
27043 a_conv.is_owned = false;
27044 LDKPrivateRoute b_conv;
27045 b_conv.inner = (void*)(b & (~1));
27046 b_conv.is_owned = false;
27047 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
27051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27052 LDKPrivateRoute orig_conv;
27053 orig_conv.inner = (void*)(orig & (~1));
27054 orig_conv.is_owned = false;
27055 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
27056 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27057 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27058 uint64_t ret_ref = (uint64_t)ret_var.inner;
27059 if (ret_var.is_owned) {
27065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
27066 LDKSignedRawInvoice this_arg_conv;
27067 this_arg_conv.inner = (void*)(this_arg & (~1));
27068 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27069 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
27070 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
27071 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
27072 return (uint64_t)ret_ref;
27075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
27076 LDKSignedRawInvoice this_arg_conv;
27077 this_arg_conv.inner = (void*)(this_arg & (~1));
27078 this_arg_conv.is_owned = false;
27079 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
27080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27082 uint64_t ret_ref = (uint64_t)ret_var.inner;
27083 if (ret_var.is_owned) {
27089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27090 LDKSignedRawInvoice this_arg_conv;
27091 this_arg_conv.inner = (void*)(this_arg & (~1));
27092 this_arg_conv.is_owned = false;
27093 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27094 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
27098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27099 LDKSignedRawInvoice this_arg_conv;
27100 this_arg_conv.inner = (void*)(this_arg & (~1));
27101 this_arg_conv.is_owned = false;
27102 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
27103 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27104 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27105 uint64_t ret_ref = (uint64_t)ret_var.inner;
27106 if (ret_var.is_owned) {
27112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27113 LDKSignedRawInvoice this_arg_conv;
27114 this_arg_conv.inner = (void*)(this_arg & (~1));
27115 this_arg_conv.is_owned = false;
27116 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27117 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
27118 return (uint64_t)ret_conv;
27121 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27122 LDKSignedRawInvoice this_arg_conv;
27123 this_arg_conv.inner = (void*)(this_arg & (~1));
27124 this_arg_conv.is_owned = false;
27125 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
27129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27130 LDKRawInvoice this_arg_conv;
27131 this_arg_conv.inner = (void*)(this_arg & (~1));
27132 this_arg_conv.is_owned = false;
27133 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27134 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
27138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27139 LDKRawInvoice this_arg_conv;
27140 this_arg_conv.inner = (void*)(this_arg & (~1));
27141 this_arg_conv.is_owned = false;
27142 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
27143 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27144 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27145 uint64_t ret_ref = (uint64_t)ret_var.inner;
27146 if (ret_var.is_owned) {
27152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
27153 LDKRawInvoice this_arg_conv;
27154 this_arg_conv.inner = (void*)(this_arg & (~1));
27155 this_arg_conv.is_owned = false;
27156 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
27157 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27158 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27159 uint64_t ret_ref = (uint64_t)ret_var.inner;
27160 if (ret_var.is_owned) {
27166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27167 LDKRawInvoice this_arg_conv;
27168 this_arg_conv.inner = (void*)(this_arg & (~1));
27169 this_arg_conv.is_owned = false;
27170 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
27171 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27172 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27173 uint64_t ret_ref = (uint64_t)ret_var.inner;
27174 if (ret_var.is_owned) {
27180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27181 LDKRawInvoice this_arg_conv;
27182 this_arg_conv.inner = (void*)(this_arg & (~1));
27183 this_arg_conv.is_owned = false;
27184 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
27185 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27186 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27187 uint64_t ret_ref = (uint64_t)ret_var.inner;
27188 if (ret_var.is_owned) {
27194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27195 LDKRawInvoice this_arg_conv;
27196 this_arg_conv.inner = (void*)(this_arg & (~1));
27197 this_arg_conv.is_owned = false;
27198 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
27199 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27200 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27201 uint64_t ret_ref = (uint64_t)ret_var.inner;
27202 if (ret_var.is_owned) {
27208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
27209 LDKRawInvoice this_arg_conv;
27210 this_arg_conv.inner = (void*)(this_arg & (~1));
27211 this_arg_conv.is_owned = false;
27212 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
27213 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27214 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27215 uint64_t ret_ref = (uint64_t)ret_var.inner;
27216 if (ret_var.is_owned) {
27222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27223 LDKRawInvoice this_arg_conv;
27224 this_arg_conv.inner = (void*)(this_arg & (~1));
27225 this_arg_conv.is_owned = false;
27226 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27227 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
27231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
27232 LDKRawInvoice this_arg_conv;
27233 this_arg_conv.inner = (void*)(this_arg & (~1));
27234 this_arg_conv.is_owned = false;
27235 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
27236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27238 uint64_t ret_ref = (uint64_t)ret_var.inner;
27239 if (ret_var.is_owned) {
27245 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
27246 LDKRawInvoice this_arg_conv;
27247 this_arg_conv.inner = (void*)(this_arg & (~1));
27248 this_arg_conv.is_owned = false;
27249 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
27250 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27251 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27252 for (size_t o = 0; o < ret_var.datalen; o++) {
27253 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27254 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27255 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27256 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27257 if (ret_conv_14_var.is_owned) {
27258 ret_conv_14_ref |= 1;
27260 ret_arr_ptr[o] = ret_conv_14_ref;
27262 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27263 FREE(ret_var.data);
27267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
27268 LDKRawInvoice this_arg_conv;
27269 this_arg_conv.inner = (void*)(this_arg & (~1));
27270 this_arg_conv.is_owned = false;
27271 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27272 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
27273 uint64_t ret_ref = (uint64_t)ret_copy;
27277 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
27278 LDKRawInvoice this_arg_conv;
27279 this_arg_conv.inner = (void*)(this_arg & (~1));
27280 this_arg_conv.is_owned = false;
27281 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
27285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
27286 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27287 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
27288 return (uint64_t)ret_conv;
27291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
27292 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27293 *ret_conv = PositiveTimestamp_from_system_time(time);
27294 return (uint64_t)ret_conv;
27297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
27298 LDKPositiveTimestamp this_arg_conv;
27299 this_arg_conv.inner = (void*)(this_arg & (~1));
27300 this_arg_conv.is_owned = false;
27301 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
27305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27306 LDKPositiveTimestamp this_arg_conv;
27307 this_arg_conv.inner = (void*)(this_arg & (~1));
27308 this_arg_conv.is_owned = false;
27309 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
27313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
27314 LDKInvoice this_arg_conv;
27315 this_arg_conv.inner = (void*)(this_arg & (~1));
27316 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27317 this_arg_conv = Invoice_clone(&this_arg_conv);
27318 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
27319 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27320 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27321 uint64_t ret_ref = (uint64_t)ret_var.inner;
27322 if (ret_var.is_owned) {
27328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
27329 LDKInvoice this_arg_conv;
27330 this_arg_conv.inner = (void*)(this_arg & (~1));
27331 this_arg_conv.is_owned = false;
27332 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
27333 *ret_conv = Invoice_check_signature(&this_arg_conv);
27334 return (uint64_t)ret_conv;
27337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
27338 LDKSignedRawInvoice signed_invoice_conv;
27339 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
27340 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
27341 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
27342 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
27343 *ret_conv = Invoice_from_signed(signed_invoice_conv);
27344 return (uint64_t)ret_conv;
27347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
27348 LDKInvoice this_arg_conv;
27349 this_arg_conv.inner = (void*)(this_arg & (~1));
27350 this_arg_conv.is_owned = false;
27351 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
27355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
27356 LDKInvoice this_arg_conv;
27357 this_arg_conv.inner = (void*)(this_arg & (~1));
27358 this_arg_conv.is_owned = false;
27359 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27360 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
27364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27365 LDKInvoice this_arg_conv;
27366 this_arg_conv.inner = (void*)(this_arg & (~1));
27367 this_arg_conv.is_owned = false;
27368 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27369 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
27373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
27374 LDKInvoice this_arg_conv;
27375 this_arg_conv.inner = (void*)(this_arg & (~1));
27376 this_arg_conv.is_owned = false;
27377 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
27378 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
27382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
27383 LDKInvoice this_arg_conv;
27384 this_arg_conv.inner = (void*)(this_arg & (~1));
27385 this_arg_conv.is_owned = false;
27386 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
27387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27389 uint64_t ret_ref = (uint64_t)ret_var.inner;
27390 if (ret_var.is_owned) {
27396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
27397 LDKInvoice this_arg_conv;
27398 this_arg_conv.inner = (void*)(this_arg & (~1));
27399 this_arg_conv.is_owned = false;
27400 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
27401 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
27405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
27406 LDKInvoice this_arg_conv;
27407 this_arg_conv.inner = (void*)(this_arg & (~1));
27408 this_arg_conv.is_owned = false;
27409 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
27413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
27414 LDKInvoice this_arg_conv;
27415 this_arg_conv.inner = (void*)(this_arg & (~1));
27416 this_arg_conv.is_owned = false;
27417 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
27421 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
27422 LDKInvoice this_arg_conv;
27423 this_arg_conv.inner = (void*)(this_arg & (~1));
27424 this_arg_conv.is_owned = false;
27425 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
27426 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27427 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27428 for (size_t o = 0; o < ret_var.datalen; o++) {
27429 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
27430 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27431 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27432 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
27433 if (ret_conv_14_var.is_owned) {
27434 ret_conv_14_ref |= 1;
27436 ret_arr_ptr[o] = ret_conv_14_ref;
27438 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27439 FREE(ret_var.data);
27443 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
27444 LDKInvoice this_arg_conv;
27445 this_arg_conv.inner = (void*)(this_arg & (~1));
27446 this_arg_conv.is_owned = false;
27447 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
27448 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
27449 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
27450 for (size_t l = 0; l < ret_var.datalen; l++) {
27451 LDKRouteHint ret_conv_11_var = ret_var.data[l];
27452 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27453 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27454 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
27455 if (ret_conv_11_var.is_owned) {
27456 ret_conv_11_ref |= 1;
27458 ret_arr_ptr[l] = ret_conv_11_ref;
27460 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
27461 FREE(ret_var.data);
27465 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
27466 LDKInvoice this_arg_conv;
27467 this_arg_conv.inner = (void*)(this_arg & (~1));
27468 this_arg_conv.is_owned = false;
27469 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
27473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
27474 LDKInvoice this_arg_conv;
27475 this_arg_conv.inner = (void*)(this_arg & (~1));
27476 this_arg_conv.is_owned = false;
27477 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27478 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
27479 uint64_t ret_ref = (uint64_t)ret_copy;
27483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
27484 LDKStr description_conv = java_to_owned_str(env, description);
27485 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27486 *ret_conv = Description_new(description_conv);
27487 return (uint64_t)ret_conv;
27490 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27491 LDKDescription this_arg_conv;
27492 this_arg_conv.inner = (void*)(this_arg & (~1));
27493 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27494 this_arg_conv = Description_clone(&this_arg_conv);
27495 LDKStr ret_str = Description_into_inner(this_arg_conv);
27496 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
27502 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27503 *ret_conv = ExpiryTime_from_seconds(seconds);
27504 return (uint64_t)ret_conv;
27507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
27508 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
27509 *ret_conv = ExpiryTime_from_duration(duration);
27510 return (uint64_t)ret_conv;
27513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
27514 LDKExpiryTime this_arg_conv;
27515 this_arg_conv.inner = (void*)(this_arg & (~1));
27516 this_arg_conv.is_owned = false;
27517 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
27521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
27522 LDKExpiryTime this_arg_conv;
27523 this_arg_conv.inner = (void*)(this_arg & (~1));
27524 this_arg_conv.is_owned = false;
27525 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
27529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
27530 LDKRouteHint hops_conv;
27531 hops_conv.inner = (void*)(hops & (~1));
27532 hops_conv.is_owned = (hops & 1) || (hops == 0);
27533 hops_conv = RouteHint_clone(&hops_conv);
27534 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27535 *ret_conv = PrivateRoute_new(hops_conv);
27536 return (uint64_t)ret_conv;
27539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
27540 LDKPrivateRoute this_arg_conv;
27541 this_arg_conv.inner = (void*)(this_arg & (~1));
27542 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
27543 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
27544 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
27545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
27546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
27547 uint64_t ret_ref = (uint64_t)ret_var.inner;
27548 if (ret_var.is_owned) {
27554 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27555 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
27556 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
27560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
27561 jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
27565 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
27566 jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
27570 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
27571 jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
27575 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds(JNIEnv *env, jclass clz) {
27576 jclass ret_conv = LDKCreationError_to_java(env, CreationError_expiry_time_out_of_bounds());
27580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27581 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
27582 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
27583 jboolean ret_val = CreationError_eq(a_conv, b_conv);
27587 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27588 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
27589 LDKStr ret_str = CreationError_to_str(o_conv);
27590 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27595 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27596 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
27597 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
27601 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
27602 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_hash());
27606 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
27607 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_hashes());
27611 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1description(JNIEnv *env, jclass clz) {
27612 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_description());
27616 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
27617 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_descriptions());
27621 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
27622 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
27626 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
27627 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_features());
27631 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
27632 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_recovery_id());
27636 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
27637 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_invalid_signature());
27641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27642 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
27643 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
27644 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
27648 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27649 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
27650 LDKStr ret_str = SemanticError_to_str(o_conv);
27651 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
27657 if ((this_ptr & 1) != 0) return;
27658 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
27659 FREE((void*)this_ptr);
27660 SignOrCreationError_free(this_ptr_conv);
27663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27664 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
27665 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27666 *ret_copy = SignOrCreationError_clone(orig_conv);
27667 uint64_t ret_ref = (uint64_t)ret_copy;
27671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
27672 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27673 *ret_copy = SignOrCreationError_sign_error();
27674 uint64_t ret_ref = (uint64_t)ret_copy;
27678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
27679 LDKCreationError a_conv = LDKCreationError_from_java(env, a);
27680 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
27681 *ret_copy = SignOrCreationError_creation_error(a_conv);
27682 uint64_t ret_ref = (uint64_t)ret_copy;
27686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27687 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
27688 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
27689 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
27693 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27694 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
27695 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
27696 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27701 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) {
27702 LDKChannelManager channelmanager_conv;
27703 channelmanager_conv.inner = (void*)(channelmanager & (~1));
27704 channelmanager_conv.is_owned = false;
27705 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
27706 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27707 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27708 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27710 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
27711 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
27712 LDKStr description_conv = java_to_owned_str(env, description);
27713 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
27714 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
27715 return (uint64_t)ret_conv;
27718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27719 LDKStr s_conv = java_to_owned_str(env, s);
27720 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
27721 *ret_conv = SiPrefix_from_str(s_conv);
27722 return (uint64_t)ret_conv;
27725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27726 LDKStr s_conv = java_to_owned_str(env, s);
27727 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
27728 *ret_conv = Invoice_from_str(s_conv);
27729 return (uint64_t)ret_conv;
27732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
27733 LDKStr s_conv = java_to_owned_str(env, s);
27734 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
27735 *ret_conv = SignedRawInvoice_from_str(s_conv);
27736 return (uint64_t)ret_conv;
27739 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27741 o_conv.inner = (void*)(o & (~1));
27742 o_conv.is_owned = false;
27743 LDKStr ret_str = Invoice_to_str(&o_conv);
27744 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27749 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27750 LDKSignedRawInvoice o_conv;
27751 o_conv.inner = (void*)(o & (~1));
27752 o_conv.is_owned = false;
27753 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
27754 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27759 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27760 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
27761 LDKStr ret_str = Currency_to_str(o_conv);
27762 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
27767 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
27768 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
27769 LDKStr ret_str = SiPrefix_to_str(o_conv);
27770 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);