1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
4 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
6 #include "org_ldk_impl_bindings.h"
12 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
13 #define MALLOC(a, _) malloc(a)
14 #define FREE(p) if ((uint64_t)(p) > 1024) { free(p); }
15 #define DO_ASSERT(a) (void)(a)
18 static jmethodID ordinal_meth = NULL;
19 static jmethodID slicedef_meth = NULL;
20 static jclass slicedef_cls = NULL;
21 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
22 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
23 CHECK(ordinal_meth != NULL);
24 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
25 CHECK(slicedef_meth != NULL);
26 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
27 CHECK(slicedef_cls != NULL);
30 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
33 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
36 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
39 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
40 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
41 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
44 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
45 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
46 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
47 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
50 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
51 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
52 vec->datalen = (*env)->GetArrayLength(env, bytes);
53 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
54 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
57 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
58 LDKTransaction *txdata = (LDKTransaction*)ptr;
60 slice.data = txdata->data;
61 slice.datalen = txdata->datalen;
62 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
64 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
65 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
66 txdata->datalen = (*env)->GetArrayLength(env, bytes);
67 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
68 txdata->data_is_owned = false;
69 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
70 return (uint64_t)txdata;
72 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
73 LDKTransaction *tx = (LDKTransaction*)ptr;
74 tx->data_is_owned = true;
75 Transaction_free(*tx);
78 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
79 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
80 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
81 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
82 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
83 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
84 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
85 return (uint64_t)vec->datalen;
87 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
88 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
89 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
90 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
91 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
92 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
93 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
99 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
100 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
101 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
102 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
104 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
105 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
106 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
108 typedef jlongArray int64_tArray;
109 typedef jbyteArray int8_tArray;
111 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
112 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
113 char* conv_buf = MALLOC(len + 1, "str conv buf");
114 memcpy(conv_buf, chars, len);
116 jstring ret = (*env)->NewStringUTF(env, conv_buf);
120 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
121 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
122 char* newchars = MALLOC(str_len + 1, "String chars");
123 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
124 memcpy(newchars, jchars, str_len);
125 newchars[str_len] = 0;
126 (*env)->ReleaseStringUTFChars(env, str, jchars);
130 .chars_is_owned = true
135 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
136 return str_ref_to_java(env, "v0.0.98.2", strlen("v0.0.98.2"));
138 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
139 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
141 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
142 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
144 static jclass arr_of_B_clz = NULL;
145 static jclass arr_of_J_clz = NULL;
146 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
147 arr_of_B_clz = (*env)->FindClass(env, "[B");
148 CHECK(arr_of_B_clz != NULL);
149 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
150 arr_of_J_clz = (*env)->FindClass(env, "[J");
151 CHECK(arr_of_J_clz != NULL);
152 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
154 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
155 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
156 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
157 case 0: return LDKAccessError_UnknownChain;
158 case 1: return LDKAccessError_UnknownTx;
162 static jclass AccessError_class = NULL;
163 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
164 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
165 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
166 AccessError_class = (*env)->NewGlobalRef(env, clz);
167 CHECK(AccessError_class != NULL);
168 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
169 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
170 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
171 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
173 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
175 case LDKAccessError_UnknownChain:
176 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
177 case LDKAccessError_UnknownTx:
178 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
183 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
184 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
185 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
186 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
190 static jclass ChannelMonitorUpdateErr_class = NULL;
191 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
192 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
193 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
194 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
195 CHECK(ChannelMonitorUpdateErr_class != NULL);
196 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
197 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
198 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
199 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
201 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
203 case LDKChannelMonitorUpdateErr_TemporaryFailure:
204 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
205 case LDKChannelMonitorUpdateErr_PermanentFailure:
206 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
211 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
212 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
213 case 0: return LDKConfirmationTarget_Background;
214 case 1: return LDKConfirmationTarget_Normal;
215 case 2: return LDKConfirmationTarget_HighPriority;
219 static jclass ConfirmationTarget_class = NULL;
220 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
221 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
222 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
223 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
224 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
225 CHECK(ConfirmationTarget_class != NULL);
226 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
227 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
228 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
229 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
230 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
231 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
233 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
235 case LDKConfirmationTarget_Background:
236 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
237 case LDKConfirmationTarget_Normal:
238 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
239 case LDKConfirmationTarget_HighPriority:
240 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
245 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
246 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
247 case 0: return LDKCreationError_DescriptionTooLong;
248 case 1: return LDKCreationError_RouteTooLong;
249 case 2: return LDKCreationError_TimestampOutOfBounds;
250 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
254 static jclass CreationError_class = NULL;
255 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
256 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
257 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
258 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
259 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
260 CreationError_class = (*env)->NewGlobalRef(env, clz);
261 CHECK(CreationError_class != NULL);
262 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
263 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
264 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
265 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
266 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
267 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
268 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
269 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
271 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
273 case LDKCreationError_DescriptionTooLong:
274 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
275 case LDKCreationError_RouteTooLong:
276 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
277 case LDKCreationError_TimestampOutOfBounds:
278 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
279 case LDKCreationError_ExpiryTimeOutOfBounds:
280 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
285 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
286 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
287 case 0: return LDKCurrency_Bitcoin;
288 case 1: return LDKCurrency_BitcoinTestnet;
289 case 2: return LDKCurrency_Regtest;
290 case 3: return LDKCurrency_Simnet;
291 case 4: return LDKCurrency_Signet;
295 static jclass Currency_class = NULL;
296 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
297 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
298 static jfieldID Currency_LDKCurrency_Regtest = NULL;
299 static jfieldID Currency_LDKCurrency_Simnet = NULL;
300 static jfieldID Currency_LDKCurrency_Signet = NULL;
301 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
302 Currency_class = (*env)->NewGlobalRef(env, clz);
303 CHECK(Currency_class != NULL);
304 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
305 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
306 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
307 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
308 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
309 CHECK(Currency_LDKCurrency_Regtest != NULL);
310 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
311 CHECK(Currency_LDKCurrency_Simnet != NULL);
312 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
313 CHECK(Currency_LDKCurrency_Signet != NULL);
315 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
317 case LDKCurrency_Bitcoin:
318 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
319 case LDKCurrency_BitcoinTestnet:
320 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
321 case LDKCurrency_Regtest:
322 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
323 case LDKCurrency_Simnet:
324 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
325 case LDKCurrency_Signet:
326 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
331 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
332 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
333 case 0: return LDKIOError_NotFound;
334 case 1: return LDKIOError_PermissionDenied;
335 case 2: return LDKIOError_ConnectionRefused;
336 case 3: return LDKIOError_ConnectionReset;
337 case 4: return LDKIOError_ConnectionAborted;
338 case 5: return LDKIOError_NotConnected;
339 case 6: return LDKIOError_AddrInUse;
340 case 7: return LDKIOError_AddrNotAvailable;
341 case 8: return LDKIOError_BrokenPipe;
342 case 9: return LDKIOError_AlreadyExists;
343 case 10: return LDKIOError_WouldBlock;
344 case 11: return LDKIOError_InvalidInput;
345 case 12: return LDKIOError_InvalidData;
346 case 13: return LDKIOError_TimedOut;
347 case 14: return LDKIOError_WriteZero;
348 case 15: return LDKIOError_Interrupted;
349 case 16: return LDKIOError_Other;
350 case 17: return LDKIOError_UnexpectedEof;
354 static jclass IOError_class = NULL;
355 static jfieldID IOError_LDKIOError_NotFound = NULL;
356 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
357 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
358 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
359 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
360 static jfieldID IOError_LDKIOError_NotConnected = NULL;
361 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
362 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
363 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
364 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
365 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
366 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
367 static jfieldID IOError_LDKIOError_InvalidData = NULL;
368 static jfieldID IOError_LDKIOError_TimedOut = NULL;
369 static jfieldID IOError_LDKIOError_WriteZero = NULL;
370 static jfieldID IOError_LDKIOError_Interrupted = NULL;
371 static jfieldID IOError_LDKIOError_Other = NULL;
372 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
373 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
374 IOError_class = (*env)->NewGlobalRef(env, clz);
375 CHECK(IOError_class != NULL);
376 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
377 CHECK(IOError_LDKIOError_NotFound != NULL);
378 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
379 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
380 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
381 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
382 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
383 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
384 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
385 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
386 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
387 CHECK(IOError_LDKIOError_NotConnected != NULL);
388 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
389 CHECK(IOError_LDKIOError_AddrInUse != NULL);
390 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
391 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
392 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
393 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
394 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
395 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
396 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
397 CHECK(IOError_LDKIOError_WouldBlock != NULL);
398 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
399 CHECK(IOError_LDKIOError_InvalidInput != NULL);
400 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
401 CHECK(IOError_LDKIOError_InvalidData != NULL);
402 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
403 CHECK(IOError_LDKIOError_TimedOut != NULL);
404 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
405 CHECK(IOError_LDKIOError_WriteZero != NULL);
406 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
407 CHECK(IOError_LDKIOError_Interrupted != NULL);
408 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
409 CHECK(IOError_LDKIOError_Other != NULL);
410 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
411 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
413 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
415 case LDKIOError_NotFound:
416 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
417 case LDKIOError_PermissionDenied:
418 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
419 case LDKIOError_ConnectionRefused:
420 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
421 case LDKIOError_ConnectionReset:
422 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
423 case LDKIOError_ConnectionAborted:
424 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
425 case LDKIOError_NotConnected:
426 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
427 case LDKIOError_AddrInUse:
428 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
429 case LDKIOError_AddrNotAvailable:
430 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
431 case LDKIOError_BrokenPipe:
432 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
433 case LDKIOError_AlreadyExists:
434 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
435 case LDKIOError_WouldBlock:
436 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
437 case LDKIOError_InvalidInput:
438 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
439 case LDKIOError_InvalidData:
440 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
441 case LDKIOError_TimedOut:
442 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
443 case LDKIOError_WriteZero:
444 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
445 case LDKIOError_Interrupted:
446 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
447 case LDKIOError_Other:
448 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
449 case LDKIOError_UnexpectedEof:
450 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
455 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
456 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
457 case 0: return LDKLevel_Off;
458 case 1: return LDKLevel_Error;
459 case 2: return LDKLevel_Warn;
460 case 3: return LDKLevel_Info;
461 case 4: return LDKLevel_Debug;
462 case 5: return LDKLevel_Trace;
466 static jclass Level_class = NULL;
467 static jfieldID Level_LDKLevel_Off = NULL;
468 static jfieldID Level_LDKLevel_Error = NULL;
469 static jfieldID Level_LDKLevel_Warn = NULL;
470 static jfieldID Level_LDKLevel_Info = NULL;
471 static jfieldID Level_LDKLevel_Debug = NULL;
472 static jfieldID Level_LDKLevel_Trace = NULL;
473 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
474 Level_class = (*env)->NewGlobalRef(env, clz);
475 CHECK(Level_class != NULL);
476 Level_LDKLevel_Off = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Off", "Lorg/ldk/enums/Level;");
477 CHECK(Level_LDKLevel_Off != NULL);
478 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
479 CHECK(Level_LDKLevel_Error != NULL);
480 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
481 CHECK(Level_LDKLevel_Warn != NULL);
482 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
483 CHECK(Level_LDKLevel_Info != NULL);
484 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
485 CHECK(Level_LDKLevel_Debug != NULL);
486 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
487 CHECK(Level_LDKLevel_Trace != NULL);
489 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
492 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Off);
494 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
496 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
498 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
500 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
502 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
507 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
508 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
509 case 0: return LDKNetwork_Bitcoin;
510 case 1: return LDKNetwork_Testnet;
511 case 2: return LDKNetwork_Regtest;
512 case 3: return LDKNetwork_Signet;
516 static jclass Network_class = NULL;
517 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
518 static jfieldID Network_LDKNetwork_Testnet = NULL;
519 static jfieldID Network_LDKNetwork_Regtest = NULL;
520 static jfieldID Network_LDKNetwork_Signet = NULL;
521 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
522 Network_class = (*env)->NewGlobalRef(env, clz);
523 CHECK(Network_class != NULL);
524 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
525 CHECK(Network_LDKNetwork_Bitcoin != NULL);
526 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
527 CHECK(Network_LDKNetwork_Testnet != NULL);
528 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
529 CHECK(Network_LDKNetwork_Regtest != NULL);
530 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
531 CHECK(Network_LDKNetwork_Signet != NULL);
533 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
535 case LDKNetwork_Bitcoin:
536 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
537 case LDKNetwork_Testnet:
538 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
539 case LDKNetwork_Regtest:
540 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
541 case LDKNetwork_Signet:
542 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
547 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
548 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
549 case 0: return LDKSecp256k1Error_IncorrectSignature;
550 case 1: return LDKSecp256k1Error_InvalidMessage;
551 case 2: return LDKSecp256k1Error_InvalidPublicKey;
552 case 3: return LDKSecp256k1Error_InvalidSignature;
553 case 4: return LDKSecp256k1Error_InvalidSecretKey;
554 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
555 case 6: return LDKSecp256k1Error_InvalidTweak;
556 case 7: return LDKSecp256k1Error_TweakCheckFailed;
557 case 8: return LDKSecp256k1Error_NotEnoughMemory;
561 static jclass Secp256k1Error_class = NULL;
562 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
563 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
564 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
565 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
566 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
567 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
568 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
569 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
570 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
571 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
572 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
573 CHECK(Secp256k1Error_class != NULL);
574 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
575 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
576 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
577 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
578 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
579 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
580 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
581 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
582 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
583 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
584 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
585 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
586 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
587 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
588 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
589 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
590 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
591 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
593 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
595 case LDKSecp256k1Error_IncorrectSignature:
596 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
597 case LDKSecp256k1Error_InvalidMessage:
598 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
599 case LDKSecp256k1Error_InvalidPublicKey:
600 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
601 case LDKSecp256k1Error_InvalidSignature:
602 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
603 case LDKSecp256k1Error_InvalidSecretKey:
604 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
605 case LDKSecp256k1Error_InvalidRecoveryId:
606 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
607 case LDKSecp256k1Error_InvalidTweak:
608 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
609 case LDKSecp256k1Error_TweakCheckFailed:
610 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
611 case LDKSecp256k1Error_NotEnoughMemory:
612 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
617 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
618 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
619 case 0: return LDKSemanticError_NoPaymentHash;
620 case 1: return LDKSemanticError_MultiplePaymentHashes;
621 case 2: return LDKSemanticError_NoDescription;
622 case 3: return LDKSemanticError_MultipleDescriptions;
623 case 4: return LDKSemanticError_MultiplePaymentSecrets;
624 case 5: return LDKSemanticError_InvalidFeatures;
625 case 6: return LDKSemanticError_InvalidRecoveryId;
626 case 7: return LDKSemanticError_InvalidSignature;
630 static jclass SemanticError_class = NULL;
631 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
632 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
633 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
634 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
635 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
636 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
637 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
638 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
639 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
640 SemanticError_class = (*env)->NewGlobalRef(env, clz);
641 CHECK(SemanticError_class != NULL);
642 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
643 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
644 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
645 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
646 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
647 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
648 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
649 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
650 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
651 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
652 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
653 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
654 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
655 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
656 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
657 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
659 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
661 case LDKSemanticError_NoPaymentHash:
662 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
663 case LDKSemanticError_MultiplePaymentHashes:
664 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
665 case LDKSemanticError_NoDescription:
666 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
667 case LDKSemanticError_MultipleDescriptions:
668 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
669 case LDKSemanticError_MultiplePaymentSecrets:
670 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
671 case LDKSemanticError_InvalidFeatures:
672 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
673 case LDKSemanticError_InvalidRecoveryId:
674 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
675 case LDKSemanticError_InvalidSignature:
676 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
681 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
682 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
683 case 0: return LDKSiPrefix_Milli;
684 case 1: return LDKSiPrefix_Micro;
685 case 2: return LDKSiPrefix_Nano;
686 case 3: return LDKSiPrefix_Pico;
690 static jclass SiPrefix_class = NULL;
691 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
692 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
693 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
694 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
695 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
696 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
697 CHECK(SiPrefix_class != NULL);
698 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
699 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
700 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
701 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
702 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
703 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
704 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
705 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
707 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
709 case LDKSiPrefix_Milli:
710 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
711 case LDKSiPrefix_Micro:
712 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
713 case LDKSiPrefix_Nano:
714 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
715 case LDKSiPrefix_Pico:
716 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
722 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
723 ret->datalen = (*env)->GetArrayLength(env, elems);
724 if (ret->datalen == 0) {
727 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
728 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
729 for (size_t i = 0; i < ret->datalen; i++) {
730 ret->data[i] = java_elems[i];
732 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
734 return (uint64_t)ret;
736 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
737 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
738 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
742 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
745 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
746 CHECK(val->result_ok);
747 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
748 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
751 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
752 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
753 CHECK(!val->result_ok);
754 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
758 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
760 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
761 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
762 CHECK(val->result_ok);
763 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
764 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
767 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
768 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
769 CHECK(!val->result_ok);
770 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
774 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
777 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
778 CHECK(val->result_ok);
779 LDKTxCreationKeys res_var = (*val->contents.result);
780 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
781 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
782 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
786 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
787 CHECK(!val->result_ok);
788 LDKDecodeError err_var = (*val->contents.err);
789 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
790 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
791 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
795 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
798 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
799 CHECK(val->result_ok);
800 LDKChannelPublicKeys res_var = (*val->contents.result);
801 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
802 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
803 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
807 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
808 CHECK(!val->result_ok);
809 LDKDecodeError err_var = (*val->contents.err);
810 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
811 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
812 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
816 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
819 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
820 CHECK(val->result_ok);
821 LDKTxCreationKeys res_var = (*val->contents.result);
822 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
823 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
824 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
827 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
828 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
829 CHECK(!val->result_ok);
830 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
833 static jclass LDKCOption_u32Z_Some_class = NULL;
834 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
835 static jclass LDKCOption_u32Z_None_class = NULL;
836 static jmethodID LDKCOption_u32Z_None_meth = NULL;
837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
838 LDKCOption_u32Z_Some_class =
839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
840 CHECK(LDKCOption_u32Z_Some_class != NULL);
841 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
842 CHECK(LDKCOption_u32Z_Some_meth != NULL);
843 LDKCOption_u32Z_None_class =
844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
845 CHECK(LDKCOption_u32Z_None_class != NULL);
846 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
847 CHECK(LDKCOption_u32Z_None_meth != NULL);
849 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
850 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
852 case LDKCOption_u32Z_Some: {
853 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
855 case LDKCOption_u32Z_None: {
856 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
862 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
865 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
866 CHECK(val->result_ok);
867 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
868 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
869 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
870 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
874 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
875 CHECK(!val->result_ok);
876 LDKDecodeError err_var = (*val->contents.err);
877 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
878 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
879 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
882 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
883 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
886 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
887 CHECK(val->result_ok);
888 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
889 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
890 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
891 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
895 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
896 CHECK(!val->result_ok);
897 LDKDecodeError err_var = (*val->contents.err);
898 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
899 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
900 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
903 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
904 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
907 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
908 CHECK(val->result_ok);
909 LDKChannelTransactionParameters res_var = (*val->contents.result);
910 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
916 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
917 CHECK(!val->result_ok);
918 LDKDecodeError err_var = (*val->contents.err);
919 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
920 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
921 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
924 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
925 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
928 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
929 CHECK(val->result_ok);
930 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
931 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
932 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
933 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
937 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
938 CHECK(!val->result_ok);
939 LDKDecodeError err_var = (*val->contents.err);
940 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
946 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
949 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
950 CHECK(val->result_ok);
951 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
952 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
953 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
954 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
958 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
959 CHECK(!val->result_ok);
960 LDKDecodeError err_var = (*val->contents.err);
961 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
962 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
963 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
967 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
970 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
971 CHECK(val->result_ok);
972 LDKCommitmentTransaction res_var = (*val->contents.result);
973 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
974 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
975 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
979 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
980 CHECK(!val->result_ok);
981 LDKDecodeError err_var = (*val->contents.err);
982 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
984 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
988 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
991 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
992 CHECK(val->result_ok);
993 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
994 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
996 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1000 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1001 CHECK(!val->result_ok);
1002 return *val->contents.err;
1004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1005 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1007 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1008 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1009 CHECK(val->result_ok);
1010 LDKCVec_SignatureZ res_var = (*val->contents.result);
1011 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1013 for (size_t i = 0; i < res_var.datalen; i++) {
1014 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1015 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1016 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1021 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1022 CHECK(!val->result_ok);
1023 return *val->contents.err;
1025 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1026 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1029 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1030 CHECK(val->result_ok);
1031 return *val->contents.result;
1033 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1034 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1035 CHECK(!val->result_ok);
1036 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1039 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1040 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1044 CHECK(val->result_ok);
1045 LDKRouteHop res_var = (*val->contents.result);
1046 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1047 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1048 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1052 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1053 CHECK(!val->result_ok);
1054 LDKDecodeError err_var = (*val->contents.err);
1055 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1056 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1057 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1061 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1062 ret->datalen = (*env)->GetArrayLength(env, elems);
1063 if (ret->datalen == 0) {
1066 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1067 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1068 for (size_t i = 0; i < ret->datalen; i++) {
1069 int64_t arr_elem = java_elems[i];
1070 LDKRouteHop arr_elem_conv;
1071 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1072 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1073 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1074 ret->data[i] = arr_elem_conv;
1076 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1078 return (uint64_t)ret;
1080 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1081 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1082 for (size_t i = 0; i < ret.datalen; i++) {
1083 ret.data[i] = RouteHop_clone(&orig->data[i]);
1087 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1088 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1089 for (size_t i = 0; i < ret.datalen; i++) {
1090 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1095 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1098 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1099 CHECK(val->result_ok);
1100 LDKRoute res_var = (*val->contents.result);
1101 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1102 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1103 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1107 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1108 CHECK(!val->result_ok);
1109 LDKDecodeError err_var = (*val->contents.err);
1110 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1111 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1112 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1115 static jclass LDKCOption_u64Z_Some_class = NULL;
1116 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1117 static jclass LDKCOption_u64Z_None_class = NULL;
1118 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1120 LDKCOption_u64Z_Some_class =
1121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1122 CHECK(LDKCOption_u64Z_Some_class != NULL);
1123 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1124 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1125 LDKCOption_u64Z_None_class =
1126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1127 CHECK(LDKCOption_u64Z_None_class != NULL);
1128 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1129 CHECK(LDKCOption_u64Z_None_meth != NULL);
1131 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1132 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1134 case LDKCOption_u64Z_Some: {
1135 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1137 case LDKCOption_u64Z_None: {
1138 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1144 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1145 ret->datalen = (*env)->GetArrayLength(env, elems);
1146 if (ret->datalen == 0) {
1149 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1150 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1151 for (size_t i = 0; i < ret->datalen; i++) {
1152 int64_t arr_elem = java_elems[i];
1153 LDKChannelDetails arr_elem_conv;
1154 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1155 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1156 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1157 ret->data[i] = arr_elem_conv;
1159 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1161 return (uint64_t)ret;
1163 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1164 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1165 for (size_t i = 0; i < ret.datalen; i++) {
1166 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1171 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1172 ret->datalen = (*env)->GetArrayLength(env, elems);
1173 if (ret->datalen == 0) {
1176 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1177 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1178 for (size_t i = 0; i < ret->datalen; i++) {
1179 int64_t arr_elem = java_elems[i];
1180 LDKRouteHint arr_elem_conv;
1181 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1182 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1183 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1184 ret->data[i] = arr_elem_conv;
1186 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1188 return (uint64_t)ret;
1190 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1191 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1192 for (size_t i = 0; i < ret.datalen; i++) {
1193 ret.data[i] = RouteHint_clone(&orig->data[i]);
1197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1198 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1201 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1202 CHECK(val->result_ok);
1203 LDKRoute res_var = (*val->contents.result);
1204 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1210 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1211 CHECK(!val->result_ok);
1212 LDKLightningError err_var = (*val->contents.err);
1213 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1214 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1215 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1219 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1222 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1223 CHECK(val->result_ok);
1224 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1225 return (uint64_t)res_ref;
1227 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1228 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1229 CHECK(!val->result_ok);
1230 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1234 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1236 LDKTransaction b_ref;
1237 b_ref.datalen = (*env)->GetArrayLength(env, b);
1238 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1239 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1240 b_ref.data_is_owned = false;
1242 return (uint64_t)ret;
1244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1245 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1249 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1250 LDKTransaction b_var = tuple->b;
1251 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1252 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1256 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1257 ret->datalen = (*env)->GetArrayLength(env, elems);
1258 if (ret->datalen == 0) {
1261 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1262 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1263 for (size_t i = 0; i < ret->datalen; i++) {
1264 int64_t arr_elem = java_elems[i];
1265 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1266 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1267 ret->data[i] = arr_elem_conv;
1269 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1271 return (uint64_t)ret;
1273 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1274 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1275 for (size_t i = 0; i < ret.datalen; i++) {
1276 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1280 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1281 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1282 for (size_t i = 0; i < ret.datalen; i++) {
1283 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1288 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1291 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1292 CHECK(val->result_ok);
1293 return *val->contents.result;
1295 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1296 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1297 CHECK(!val->result_ok);
1298 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1301 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1302 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1303 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1304 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1306 LDKMonitorEvent_HTLCEvent_class =
1307 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1308 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1309 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1310 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1311 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1312 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1313 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1314 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1315 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1317 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1318 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1320 case LDKMonitorEvent_HTLCEvent: {
1321 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1322 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1323 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1324 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1325 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1327 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1328 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1329 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1332 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1338 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1339 ret->datalen = (*env)->GetArrayLength(env, elems);
1340 if (ret->datalen == 0) {
1343 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1344 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1345 for (size_t i = 0; i < ret->datalen; i++) {
1346 int64_t arr_elem = java_elems[i];
1347 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1348 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1349 ret->data[i] = arr_elem_conv;
1351 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1353 return (uint64_t)ret;
1355 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1356 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1357 for (size_t i = 0; i < ret.datalen; i++) {
1358 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1362 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1363 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1364 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1365 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1367 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1368 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1369 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1370 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1371 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1372 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1373 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1374 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1375 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1376 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1378 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1379 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1381 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1382 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1383 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1385 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1386 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1391 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1392 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1393 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1394 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1395 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1396 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1398 LDKSpendableOutputDescriptor_StaticOutput_class =
1399 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1400 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1401 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1402 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1403 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1404 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1405 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1406 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1407 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1408 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1409 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1410 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1411 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1412 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1414 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1415 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1417 case LDKSpendableOutputDescriptor_StaticOutput: {
1418 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1419 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1422 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1423 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1425 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1426 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1427 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1428 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1429 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1430 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1432 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1433 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1434 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1435 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1436 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1437 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1443 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1444 ret->datalen = (*env)->GetArrayLength(env, elems);
1445 if (ret->datalen == 0) {
1448 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1449 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1450 for (size_t i = 0; i < ret->datalen; i++) {
1451 int64_t arr_elem = java_elems[i];
1452 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1453 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1454 ret->data[i] = arr_elem_conv;
1456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1458 return (uint64_t)ret;
1460 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1461 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1462 for (size_t i = 0; i < ret.datalen; i++) {
1463 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1467 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1468 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1469 static jclass LDKErrorAction_IgnoreError_class = NULL;
1470 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1471 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1472 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1474 LDKErrorAction_DisconnectPeer_class =
1475 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1476 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1477 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1478 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1479 LDKErrorAction_IgnoreError_class =
1480 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1481 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1482 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1483 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1484 LDKErrorAction_SendErrorMessage_class =
1485 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1486 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1487 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1488 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1490 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1491 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1493 case LDKErrorAction_DisconnectPeer: {
1494 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1495 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1496 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1497 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1498 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1500 case LDKErrorAction_IgnoreError: {
1501 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1503 case LDKErrorAction_SendErrorMessage: {
1504 LDKErrorMessage msg_var = obj->send_error_message.msg;
1505 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1506 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1507 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1508 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1513 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1514 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1515 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1516 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1517 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1518 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1520 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1522 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1523 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1524 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1525 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1527 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1528 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1529 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1530 LDKHTLCFailChannelUpdate_NodeFailure_class =
1531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1532 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1533 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1534 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1537 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1539 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1540 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1541 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1542 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1543 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1544 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1546 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1547 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1549 case LDKHTLCFailChannelUpdate_NodeFailure: {
1550 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1551 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1552 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1557 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1558 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1559 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1560 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1561 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1562 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1563 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1564 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1565 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1566 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1567 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1568 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1569 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1570 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1571 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1572 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1573 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1574 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1575 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1576 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1577 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1578 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1579 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1580 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1581 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1582 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1583 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1584 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1585 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1586 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1587 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1588 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1589 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1590 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1591 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1592 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1593 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1594 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1596 LDKMessageSendEvent_SendAcceptChannel_class =
1597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1598 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1599 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1600 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1601 LDKMessageSendEvent_SendOpenChannel_class =
1602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1603 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1604 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1605 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1606 LDKMessageSendEvent_SendFundingCreated_class =
1607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1608 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1609 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1610 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1611 LDKMessageSendEvent_SendFundingSigned_class =
1612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1613 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1614 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1615 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1616 LDKMessageSendEvent_SendFundingLocked_class =
1617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1618 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1619 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1620 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1621 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1623 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1624 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1625 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1626 LDKMessageSendEvent_UpdateHTLCs_class =
1627 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1628 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1629 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1630 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1631 LDKMessageSendEvent_SendRevokeAndACK_class =
1632 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1633 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1634 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1635 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1636 LDKMessageSendEvent_SendClosingSigned_class =
1637 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1638 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1639 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1640 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1641 LDKMessageSendEvent_SendShutdown_class =
1642 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1643 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1644 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1645 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1646 LDKMessageSendEvent_SendChannelReestablish_class =
1647 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1648 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1649 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1650 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1651 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1652 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1653 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1654 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1655 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1656 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1658 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1659 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1660 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1661 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1663 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1664 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1665 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1666 LDKMessageSendEvent_HandleError_class =
1667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1668 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1669 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1670 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1671 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1672 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1673 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1674 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1675 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1676 LDKMessageSendEvent_SendChannelRangeQuery_class =
1677 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1678 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1679 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1680 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1681 LDKMessageSendEvent_SendShortIdsQuery_class =
1682 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1683 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1684 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1685 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1686 LDKMessageSendEvent_SendReplyChannelRange_class =
1687 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1688 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1689 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1690 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1692 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1693 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1695 case LDKMessageSendEvent_SendAcceptChannel: {
1696 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1697 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1698 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1699 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1700 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1701 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1702 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1704 case LDKMessageSendEvent_SendOpenChannel: {
1705 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1706 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1707 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1708 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1709 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1710 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1711 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1713 case LDKMessageSendEvent_SendFundingCreated: {
1714 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1715 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1716 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1717 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1718 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1719 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1720 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1722 case LDKMessageSendEvent_SendFundingSigned: {
1723 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1724 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1725 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1726 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1727 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1728 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1729 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1731 case LDKMessageSendEvent_SendFundingLocked: {
1732 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1733 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1734 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1735 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1736 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1737 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1738 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1740 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1741 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1742 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1743 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1744 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1745 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1746 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1747 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1749 case LDKMessageSendEvent_UpdateHTLCs: {
1750 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1751 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1752 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1753 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1754 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1755 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1756 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1758 case LDKMessageSendEvent_SendRevokeAndACK: {
1759 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1760 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1761 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1762 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1763 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1764 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1765 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1767 case LDKMessageSendEvent_SendClosingSigned: {
1768 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1769 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1770 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1771 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1772 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1773 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1774 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1776 case LDKMessageSendEvent_SendShutdown: {
1777 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1778 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1779 LDKShutdown msg_var = obj->send_shutdown.msg;
1780 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1781 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1782 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1783 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1785 case LDKMessageSendEvent_SendChannelReestablish: {
1786 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1787 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1788 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1789 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1790 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1791 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1792 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1794 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1795 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1796 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1797 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1798 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1799 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1800 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1801 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1802 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1803 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1805 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1806 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1807 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1808 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1809 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1810 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1812 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1813 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1814 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1815 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1816 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1817 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1819 case LDKMessageSendEvent_HandleError: {
1820 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1821 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1822 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1823 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1825 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1826 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1827 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1829 case LDKMessageSendEvent_SendChannelRangeQuery: {
1830 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1831 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1832 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1833 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1834 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1835 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1836 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1838 case LDKMessageSendEvent_SendShortIdsQuery: {
1839 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1840 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1841 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1842 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1843 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1844 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1845 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1847 case LDKMessageSendEvent_SendReplyChannelRange: {
1848 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1849 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1850 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1851 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1854 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
1859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1860 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1861 ret->datalen = (*env)->GetArrayLength(env, elems);
1862 if (ret->datalen == 0) {
1865 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
1866 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1867 for (size_t i = 0; i < ret->datalen; i++) {
1868 int64_t arr_elem = java_elems[i];
1869 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
1870 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
1871 ret->data[i] = arr_elem_conv;
1873 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1875 return (uint64_t)ret;
1877 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
1878 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
1879 for (size_t i = 0; i < ret.datalen; i++) {
1880 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1884 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1885 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
1887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1888 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1889 CHECK(val->result_ok);
1890 LDKInitFeatures res_var = (*val->contents.result);
1891 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1892 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1893 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1897 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
1898 CHECK(!val->result_ok);
1899 LDKDecodeError err_var = (*val->contents.err);
1900 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1901 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1902 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1906 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
1908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1909 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1910 CHECK(val->result_ok);
1911 LDKNodeFeatures res_var = (*val->contents.result);
1912 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1913 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1914 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1918 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
1919 CHECK(!val->result_ok);
1920 LDKDecodeError err_var = (*val->contents.err);
1921 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1922 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1923 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1927 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
1929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1930 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1931 CHECK(val->result_ok);
1932 LDKChannelFeatures res_var = (*val->contents.result);
1933 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1934 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1935 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1939 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
1940 CHECK(!val->result_ok);
1941 LDKDecodeError err_var = (*val->contents.err);
1942 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1943 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1944 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1947 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1948 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
1950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1951 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1952 CHECK(val->result_ok);
1953 LDKInvoiceFeatures res_var = (*val->contents.result);
1954 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1960 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
1961 CHECK(!val->result_ok);
1962 LDKDecodeError err_var = (*val->contents.err);
1963 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1964 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1965 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1969 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1972 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1973 CHECK(val->result_ok);
1974 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
1975 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1981 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1982 CHECK(!val->result_ok);
1983 LDKDecodeError err_var = (*val->contents.err);
1984 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1985 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1986 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1990 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1993 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
1994 CHECK(val->result_ok);
1995 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
1996 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1997 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1998 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2002 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2003 CHECK(!val->result_ok);
2004 LDKDecodeError err_var = (*val->contents.err);
2005 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2006 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2007 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2010 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2011 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2014 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2015 CHECK(val->result_ok);
2016 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2020 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2021 CHECK(!val->result_ok);
2022 LDKDecodeError err_var = (*val->contents.err);
2023 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2024 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2025 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2029 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2031 CHECK((*env)->GetArrayLength(env, a) == 64);
2032 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2034 LDKCVec_SignatureZ b_constr;
2035 b_constr.datalen = (*env)->GetArrayLength(env, b);
2036 if (b_constr.datalen > 0)
2037 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2039 b_constr.data = NULL;
2040 for (size_t i = 0; i < b_constr.datalen; i++) {
2041 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2042 LDKSignature b_conv_8_ref;
2043 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2044 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2045 b_constr.data[i] = b_conv_8_ref;
2048 return (uint64_t)ret;
2050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2051 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2052 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2053 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2056 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2057 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2058 LDKCVec_SignatureZ b_var = tuple->b;
2059 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2061 for (size_t i = 0; i < b_var.datalen; i++) {
2062 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2063 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2064 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2069 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2072 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2073 CHECK(val->result_ok);
2074 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2078 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2079 CHECK(!val->result_ok);
2080 return *val->contents.err;
2082 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2083 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2086 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2087 CHECK(val->result_ok);
2088 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2089 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2093 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2094 CHECK(!val->result_ok);
2095 return *val->contents.err;
2097 typedef struct LDKBaseSign_JCalls {
2098 atomic_size_t refcnt;
2101 jmethodID get_per_commitment_point_meth;
2102 jmethodID release_commitment_secret_meth;
2103 jmethodID channel_keys_id_meth;
2104 jmethodID sign_counterparty_commitment_meth;
2105 jmethodID sign_holder_commitment_and_htlcs_meth;
2106 jmethodID sign_justice_revoked_output_meth;
2107 jmethodID sign_justice_revoked_htlc_meth;
2108 jmethodID sign_counterparty_htlc_transaction_meth;
2109 jmethodID sign_closing_transaction_meth;
2110 jmethodID sign_channel_announcement_meth;
2111 jmethodID ready_channel_meth;
2112 } LDKBaseSign_JCalls;
2113 static void LDKBaseSign_JCalls_free(void* this_arg) {
2114 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2115 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2117 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2118 if (get_jenv_res == JNI_EDETACHED) {
2119 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2121 DO_ASSERT(get_jenv_res == JNI_OK);
2123 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2124 if (get_jenv_res == JNI_EDETACHED) {
2125 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2130 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2131 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2133 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2134 if (get_jenv_res == JNI_EDETACHED) {
2135 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2137 DO_ASSERT(get_jenv_res == JNI_OK);
2139 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2141 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2142 LDKPublicKey ret_ref;
2143 CHECK((*env)->GetArrayLength(env, ret) == 33);
2144 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2145 if (get_jenv_res == JNI_EDETACHED) {
2146 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2150 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2151 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2153 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2154 if (get_jenv_res == JNI_EDETACHED) {
2155 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2157 DO_ASSERT(get_jenv_res == JNI_OK);
2159 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2161 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2162 LDKThirtyTwoBytes ret_ref;
2163 CHECK((*env)->GetArrayLength(env, ret) == 32);
2164 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2165 if (get_jenv_res == JNI_EDETACHED) {
2166 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2170 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2171 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2173 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2174 if (get_jenv_res == JNI_EDETACHED) {
2175 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2177 DO_ASSERT(get_jenv_res == JNI_OK);
2179 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2181 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2182 LDKThirtyTwoBytes ret_ref;
2183 CHECK((*env)->GetArrayLength(env, ret) == 32);
2184 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2185 if (get_jenv_res == JNI_EDETACHED) {
2186 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2190 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2191 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2193 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2194 if (get_jenv_res == JNI_EDETACHED) {
2195 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2197 DO_ASSERT(get_jenv_res == JNI_OK);
2199 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2200 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2201 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2202 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2203 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2204 if (commitment_tx_var.is_owned) {
2205 commitment_tx_ref |= 1;
2207 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2209 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2210 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2211 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2212 if (get_jenv_res == JNI_EDETACHED) {
2213 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2217 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2218 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2220 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2221 if (get_jenv_res == JNI_EDETACHED) {
2222 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2224 DO_ASSERT(get_jenv_res == JNI_OK);
2226 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2227 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2228 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2229 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2230 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2231 if (commitment_tx_var.is_owned) {
2232 commitment_tx_ref |= 1;
2234 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2236 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2237 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2238 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2239 if (get_jenv_res == JNI_EDETACHED) {
2240 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2244 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]) {
2245 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2247 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2248 if (get_jenv_res == JNI_EDETACHED) {
2249 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2251 DO_ASSERT(get_jenv_res == JNI_OK);
2253 LDKTransaction justice_tx_var = justice_tx;
2254 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2255 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2256 Transaction_free(justice_tx_var);
2257 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2258 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2259 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2261 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2262 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2263 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2264 if (get_jenv_res == JNI_EDETACHED) {
2265 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2269 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) {
2270 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2272 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2273 if (get_jenv_res == JNI_EDETACHED) {
2274 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2276 DO_ASSERT(get_jenv_res == JNI_OK);
2278 LDKTransaction justice_tx_var = justice_tx;
2279 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2280 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2281 Transaction_free(justice_tx_var);
2282 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2283 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2284 LDKHTLCOutputInCommitment htlc_var = *htlc;
2285 htlc_var = HTLCOutputInCommitment_clone(htlc);
2286 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2287 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2288 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2289 if (htlc_var.is_owned) {
2292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2294 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2295 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2296 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2297 if (get_jenv_res == JNI_EDETACHED) {
2298 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2302 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) {
2303 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2305 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2306 if (get_jenv_res == JNI_EDETACHED) {
2307 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2309 DO_ASSERT(get_jenv_res == JNI_OK);
2311 LDKTransaction htlc_tx_var = htlc_tx;
2312 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2313 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2314 Transaction_free(htlc_tx_var);
2315 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2316 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2317 LDKHTLCOutputInCommitment htlc_var = *htlc;
2318 htlc_var = HTLCOutputInCommitment_clone(htlc);
2319 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2320 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2321 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2322 if (htlc_var.is_owned) {
2325 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2327 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2328 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2329 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2330 if (get_jenv_res == JNI_EDETACHED) {
2331 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2335 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2336 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2338 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2339 if (get_jenv_res == JNI_EDETACHED) {
2340 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2342 DO_ASSERT(get_jenv_res == JNI_OK);
2344 LDKTransaction closing_tx_var = closing_tx;
2345 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2346 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2347 Transaction_free(closing_tx_var);
2348 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2350 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2351 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2352 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2353 if (get_jenv_res == JNI_EDETACHED) {
2354 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2358 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2359 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2361 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2362 if (get_jenv_res == JNI_EDETACHED) {
2363 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2365 DO_ASSERT(get_jenv_res == JNI_OK);
2367 LDKUnsignedChannelAnnouncement msg_var = *msg;
2368 msg_var = UnsignedChannelAnnouncement_clone(msg);
2369 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2370 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2371 uint64_t msg_ref = (uint64_t)msg_var.inner;
2372 if (msg_var.is_owned) {
2375 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2377 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2378 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2379 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2380 if (get_jenv_res == JNI_EDETACHED) {
2381 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2385 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2386 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2389 if (get_jenv_res == JNI_EDETACHED) {
2390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2392 DO_ASSERT(get_jenv_res == JNI_OK);
2394 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2395 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2396 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2397 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2398 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2399 if (channel_parameters_var.is_owned) {
2400 channel_parameters_ref |= 1;
2402 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2404 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2405 if (get_jenv_res == JNI_EDETACHED) {
2406 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2409 static void* LDKBaseSign_JCalls_clone(const void* this_arg) {
2410 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2411 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2412 return (void*) this_arg;
2414 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2415 jclass c = (*env)->GetObjectClass(env, o);
2417 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2418 atomic_init(&calls->refcnt, 1);
2419 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2420 calls->o = (*env)->NewWeakGlobalRef(env, o);
2421 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2422 CHECK(calls->get_per_commitment_point_meth != NULL);
2423 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2424 CHECK(calls->release_commitment_secret_meth != NULL);
2425 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2426 CHECK(calls->channel_keys_id_meth != NULL);
2427 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2428 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2429 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2430 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2431 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2432 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2433 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2434 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2435 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2436 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2437 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2438 CHECK(calls->sign_closing_transaction_meth != NULL);
2439 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2440 CHECK(calls->sign_channel_announcement_meth != NULL);
2441 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2442 CHECK(calls->ready_channel_meth != NULL);
2444 LDKChannelPublicKeys pubkeys_conv;
2445 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2446 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2447 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2450 .this_arg = (void*) calls,
2451 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2452 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2453 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2454 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2455 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2456 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2457 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2458 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2459 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2460 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2461 .ready_channel = ready_channel_LDKBaseSign_jcall,
2462 .free = LDKBaseSign_JCalls_free,
2463 .pubkeys = pubkeys_conv,
2464 .set_pubkeys = NULL,
2468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2469 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2470 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2471 return (uint64_t)res_ptr;
2473 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) {
2474 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2475 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2476 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2480 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2481 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2482 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2483 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2488 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2489 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2490 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2494 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) {
2495 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2496 LDKCommitmentTransaction commitment_tx_conv;
2497 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2498 commitment_tx_conv.is_owned = false;
2499 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2500 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2501 return (uint64_t)ret_conv;
2504 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) {
2505 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2506 LDKHolderCommitmentTransaction commitment_tx_conv;
2507 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2508 commitment_tx_conv.is_owned = false;
2509 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2510 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2511 return (uint64_t)ret_conv;
2514 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) {
2515 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2516 LDKTransaction justice_tx_ref;
2517 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2518 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2519 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2520 justice_tx_ref.data_is_owned = true;
2521 unsigned char per_commitment_key_arr[32];
2522 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2523 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2524 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2525 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2526 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2527 return (uint64_t)ret_conv;
2530 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) {
2531 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2532 LDKTransaction justice_tx_ref;
2533 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2534 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2535 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2536 justice_tx_ref.data_is_owned = true;
2537 unsigned char per_commitment_key_arr[32];
2538 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2539 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2540 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2541 LDKHTLCOutputInCommitment htlc_conv;
2542 htlc_conv.inner = (void*)(htlc & (~1));
2543 htlc_conv.is_owned = false;
2544 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2545 *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);
2546 return (uint64_t)ret_conv;
2549 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) {
2550 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2551 LDKTransaction htlc_tx_ref;
2552 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2553 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2554 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2555 htlc_tx_ref.data_is_owned = true;
2556 LDKPublicKey per_commitment_point_ref;
2557 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2558 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2559 LDKHTLCOutputInCommitment htlc_conv;
2560 htlc_conv.inner = (void*)(htlc & (~1));
2561 htlc_conv.is_owned = false;
2562 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2563 *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);
2564 return (uint64_t)ret_conv;
2567 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) {
2568 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2569 LDKTransaction closing_tx_ref;
2570 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2571 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2572 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2573 closing_tx_ref.data_is_owned = true;
2574 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2575 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2576 return (uint64_t)ret_conv;
2579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2580 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2581 LDKUnsignedChannelAnnouncement msg_conv;
2582 msg_conv.inner = (void*)(msg & (~1));
2583 msg_conv.is_owned = false;
2584 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2585 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2586 return (uint64_t)ret_conv;
2589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2590 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2591 LDKChannelTransactionParameters channel_parameters_conv;
2592 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2593 channel_parameters_conv.is_owned = false;
2594 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2597 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2598 if (this_arg->set_pubkeys != NULL)
2599 this_arg->set_pubkeys(this_arg);
2600 return this_arg->pubkeys;
2602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2603 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2604 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2605 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2606 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2607 uint64_t ret_ref = (uint64_t)ret_var.inner;
2608 if (ret_var.is_owned) {
2614 typedef struct LDKSign_JCalls {
2615 atomic_size_t refcnt;
2618 LDKBaseSign_JCalls* BaseSign;
2619 jmethodID write_meth;
2621 static void LDKSign_JCalls_free(void* this_arg) {
2622 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2623 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2625 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2626 if (get_jenv_res == JNI_EDETACHED) {
2627 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2629 DO_ASSERT(get_jenv_res == JNI_OK);
2631 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2632 if (get_jenv_res == JNI_EDETACHED) {
2633 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2638 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2639 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2641 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2642 if (get_jenv_res == JNI_EDETACHED) {
2643 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2645 DO_ASSERT(get_jenv_res == JNI_OK);
2647 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2649 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2650 LDKCVec_u8Z ret_ref;
2651 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2652 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2653 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2654 if (get_jenv_res == JNI_EDETACHED) {
2655 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2659 static void* LDKSign_JCalls_clone(const void* this_arg) {
2660 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2661 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2662 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2663 return (void*) this_arg;
2665 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2666 jclass c = (*env)->GetObjectClass(env, o);
2668 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2669 atomic_init(&calls->refcnt, 1);
2670 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2671 calls->o = (*env)->NewWeakGlobalRef(env, o);
2672 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2673 CHECK(calls->write_meth != NULL);
2675 LDKChannelPublicKeys pubkeys_conv;
2676 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2677 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2678 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2681 .this_arg = (void*) calls,
2682 .write = write_LDKSign_jcall,
2683 .clone = LDKSign_JCalls_clone,
2684 .free = LDKSign_JCalls_free,
2685 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2687 calls->BaseSign = ret.BaseSign.this_arg;
2690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2691 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2692 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2693 return (uint64_t)res_ptr;
2695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2696 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2697 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2698 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2699 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2700 CVec_u8Z_free(ret_var);
2704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2705 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2708 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2709 CHECK(val->result_ok);
2710 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2711 *ret = Sign_clone(&(*val->contents.result));
2712 return (uint64_t)ret;
2714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2715 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2716 CHECK(!val->result_ok);
2717 LDKDecodeError err_var = (*val->contents.err);
2718 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2719 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2720 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2724 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2727 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2728 CHECK(val->result_ok);
2729 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2730 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2734 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2735 CHECK(!val->result_ok);
2736 return *val->contents.err;
2738 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2739 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2740 for (size_t i = 0; i < ret.datalen; i++) {
2741 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2745 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2746 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2748 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2749 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2750 CHECK(val->result_ok);
2751 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2752 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2754 for (size_t i = 0; i < res_var.datalen; i++) {
2755 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2756 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2757 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2758 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2763 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2764 CHECK(!val->result_ok);
2765 return *val->contents.err;
2767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2768 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2771 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2772 CHECK(val->result_ok);
2773 LDKInMemorySigner res_var = (*val->contents.result);
2774 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2775 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2776 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2780 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2781 CHECK(!val->result_ok);
2782 LDKDecodeError err_var = (*val->contents.err);
2783 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2784 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2785 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2789 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2790 ret->datalen = (*env)->GetArrayLength(env, elems);
2791 if (ret->datalen == 0) {
2794 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2795 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2796 for (size_t i = 0; i < ret->datalen; i++) {
2797 int64_t arr_elem = java_elems[i];
2798 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2799 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2800 ret->data[i] = arr_elem_conv;
2802 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2804 return (uint64_t)ret;
2806 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2807 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2808 for (size_t i = 0; i < ret.datalen; i++) {
2809 ret.data[i] = TxOut_clone(&orig->data[i]);
2813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2814 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
2816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2817 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2818 CHECK(val->result_ok);
2819 LDKTransaction res_var = (*val->contents.result);
2820 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
2821 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
2824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2825 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
2826 CHECK(!val->result_ok);
2827 return *val->contents.err;
2829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2830 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
2831 LDKThirtyTwoBytes a_ref;
2832 CHECK((*env)->GetArrayLength(env, a) == 32);
2833 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2835 LDKChannelMonitor b_conv;
2836 b_conv.inner = (void*)(b & (~1));
2837 b_conv.is_owned = (b & 1) || (b == 0);
2838 b_conv = ChannelMonitor_clone(&b_conv);
2840 return (uint64_t)ret;
2842 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2843 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2844 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2845 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2849 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
2850 LDKChannelMonitor b_var = tuple->b;
2851 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2852 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2853 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
2856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2857 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
2858 ret->datalen = (*env)->GetArrayLength(env, elems);
2859 if (ret->datalen == 0) {
2862 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
2863 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2864 for (size_t i = 0; i < ret->datalen; i++) {
2865 int64_t arr_elem = java_elems[i];
2866 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
2867 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
2868 ret->data[i] = arr_elem_conv;
2870 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2872 return (uint64_t)ret;
2874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2875 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
2877 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2878 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2879 CHECK(val->result_ok);
2880 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
2881 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
2882 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
2883 for (size_t i = 0; i < res_var.datalen; i++) {
2884 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
2885 res_arr_ptr[i] = res_conv_34_ref;
2887 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
2890 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2891 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
2892 CHECK(!val->result_ok);
2893 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
2896 static jclass LDKAPIError_APIMisuseError_class = NULL;
2897 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2898 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2899 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2900 static jclass LDKAPIError_RouteError_class = NULL;
2901 static jmethodID LDKAPIError_RouteError_meth = NULL;
2902 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2903 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2904 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2905 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2907 LDKAPIError_APIMisuseError_class =
2908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2909 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2910 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
2911 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2912 LDKAPIError_FeeRateTooHigh_class =
2913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2914 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2915 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
2916 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2917 LDKAPIError_RouteError_class =
2918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2919 CHECK(LDKAPIError_RouteError_class != NULL);
2920 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2921 CHECK(LDKAPIError_RouteError_meth != NULL);
2922 LDKAPIError_ChannelUnavailable_class =
2923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2924 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2925 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
2926 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2927 LDKAPIError_MonitorUpdateFailed_class =
2928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2929 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2930 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2931 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2933 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2934 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
2936 case LDKAPIError_APIMisuseError: {
2937 LDKStr err_str = obj->api_misuse_error.err;
2938 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2939 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
2941 case LDKAPIError_FeeRateTooHigh: {
2942 LDKStr err_str = obj->fee_rate_too_high.err;
2943 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2944 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
2946 case LDKAPIError_RouteError: {
2947 LDKStr err_str = obj->route_error.err;
2948 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2949 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2951 case LDKAPIError_ChannelUnavailable: {
2952 LDKStr err_str = obj->channel_unavailable.err;
2953 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2954 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
2956 case LDKAPIError_MonitorUpdateFailed: {
2957 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2963 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2966 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2967 CHECK(val->result_ok);
2968 return *val->contents.result;
2970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2971 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2972 CHECK(!val->result_ok);
2973 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
2976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2977 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
2978 ret->datalen = (*env)->GetArrayLength(env, elems);
2979 if (ret->datalen == 0) {
2982 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
2983 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2984 for (size_t i = 0; i < ret->datalen; i++) {
2985 int64_t arr_elem = java_elems[i];
2986 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
2987 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
2988 ret->data[i] = arr_elem_conv;
2990 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2992 return (uint64_t)ret;
2994 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2995 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2996 for (size_t i = 0; i < ret.datalen; i++) {
2997 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3002 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3003 ret->datalen = (*env)->GetArrayLength(env, elems);
3004 if (ret->datalen == 0) {
3007 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3008 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3009 for (size_t i = 0; i < ret->datalen; i++) {
3010 int64_t arr_elem = java_elems[i];
3011 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3012 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3013 ret->data[i] = arr_elem_conv;
3015 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3017 return (uint64_t)ret;
3019 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3020 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3021 for (size_t i = 0; i < ret.datalen; i++) {
3022 ret.data[i] = APIError_clone(&orig->data[i]);
3026 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3027 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3028 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3029 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3030 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3031 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3032 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3033 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3035 LDKPaymentSendFailure_ParameterError_class =
3036 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3037 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3038 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3039 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3040 LDKPaymentSendFailure_PathParameterError_class =
3041 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3042 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3043 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3044 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3045 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3046 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3047 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3048 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3049 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3050 LDKPaymentSendFailure_PartialFailure_class =
3051 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3052 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3053 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3054 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3056 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3057 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3059 case LDKPaymentSendFailure_ParameterError: {
3060 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3061 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3063 case LDKPaymentSendFailure_PathParameterError: {
3064 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3065 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3066 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3067 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3068 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3069 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3070 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3071 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3073 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3074 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3076 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3077 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3078 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3079 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3080 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3081 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3082 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3084 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3085 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3087 case LDKPaymentSendFailure_PartialFailure: {
3088 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3089 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3090 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3091 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3092 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3093 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3094 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3095 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3097 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3098 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3103 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3104 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3107 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3108 CHECK(val->result_ok);
3109 return *val->contents.result;
3111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3112 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3113 CHECK(!val->result_ok);
3114 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3117 static jclass LDKNetAddress_IPv4_class = NULL;
3118 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3119 static jclass LDKNetAddress_IPv6_class = NULL;
3120 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3121 static jclass LDKNetAddress_OnionV2_class = NULL;
3122 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3123 static jclass LDKNetAddress_OnionV3_class = NULL;
3124 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3126 LDKNetAddress_IPv4_class =
3127 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3128 CHECK(LDKNetAddress_IPv4_class != NULL);
3129 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3130 CHECK(LDKNetAddress_IPv4_meth != NULL);
3131 LDKNetAddress_IPv6_class =
3132 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3133 CHECK(LDKNetAddress_IPv6_class != NULL);
3134 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3135 CHECK(LDKNetAddress_IPv6_meth != NULL);
3136 LDKNetAddress_OnionV2_class =
3137 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3138 CHECK(LDKNetAddress_OnionV2_class != NULL);
3139 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3140 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3141 LDKNetAddress_OnionV3_class =
3142 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3143 CHECK(LDKNetAddress_OnionV3_class != NULL);
3144 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3145 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3147 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3148 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3150 case LDKNetAddress_IPv4: {
3151 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3152 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3153 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3155 case LDKNetAddress_IPv6: {
3156 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3157 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3158 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3160 case LDKNetAddress_OnionV2: {
3161 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3162 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3163 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3165 case LDKNetAddress_OnionV3: {
3166 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3167 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3168 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);
3173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3174 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3175 ret->datalen = (*env)->GetArrayLength(env, elems);
3176 if (ret->datalen == 0) {
3179 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3180 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3181 for (size_t i = 0; i < ret->datalen; i++) {
3182 int64_t arr_elem = java_elems[i];
3183 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3184 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3185 ret->data[i] = arr_elem_conv;
3187 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3189 return (uint64_t)ret;
3191 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3192 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3193 for (size_t i = 0; i < ret.datalen; i++) {
3194 ret.data[i] = NetAddress_clone(&orig->data[i]);
3198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3199 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3200 LDKThirtyTwoBytes a_ref;
3201 CHECK((*env)->GetArrayLength(env, a) == 32);
3202 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3204 LDKThirtyTwoBytes b_ref;
3205 CHECK((*env)->GetArrayLength(env, b) == 32);
3206 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3208 return (uint64_t)ret;
3210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3211 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3212 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3213 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3216 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3217 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3218 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3219 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3223 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3225 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3226 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3227 CHECK(val->result_ok);
3228 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3229 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3233 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3234 CHECK(!val->result_ok);
3235 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3239 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3240 ret->datalen = (*env)->GetArrayLength(env, elems);
3241 if (ret->datalen == 0) {
3244 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3245 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3246 for (size_t i = 0; i < ret->datalen; i++) {
3247 int64_t arr_elem = java_elems[i];
3248 LDKChannelMonitor arr_elem_conv;
3249 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3250 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3251 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3252 ret->data[i] = arr_elem_conv;
3254 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3256 return (uint64_t)ret;
3258 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3259 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3260 for (size_t i = 0; i < ret.datalen; i++) {
3261 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3265 typedef struct LDKWatch_JCalls {
3266 atomic_size_t refcnt;
3269 jmethodID watch_channel_meth;
3270 jmethodID update_channel_meth;
3271 jmethodID release_pending_monitor_events_meth;
3273 static void LDKWatch_JCalls_free(void* this_arg) {
3274 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3275 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3277 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3278 if (get_jenv_res == JNI_EDETACHED) {
3279 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3281 DO_ASSERT(get_jenv_res == JNI_OK);
3283 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3284 if (get_jenv_res == JNI_EDETACHED) {
3285 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3290 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3291 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3293 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3294 if (get_jenv_res == JNI_EDETACHED) {
3295 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3297 DO_ASSERT(get_jenv_res == JNI_OK);
3299 LDKOutPoint funding_txo_var = funding_txo;
3300 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3301 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3302 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3303 if (funding_txo_var.is_owned) {
3304 funding_txo_ref |= 1;
3306 LDKChannelMonitor monitor_var = monitor;
3307 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3308 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3309 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3310 if (monitor_var.is_owned) {
3313 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3315 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3316 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3317 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3318 if (get_jenv_res == JNI_EDETACHED) {
3319 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3323 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3324 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3326 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3327 if (get_jenv_res == JNI_EDETACHED) {
3328 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3330 DO_ASSERT(get_jenv_res == JNI_OK);
3332 LDKOutPoint funding_txo_var = funding_txo;
3333 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3334 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3335 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3336 if (funding_txo_var.is_owned) {
3337 funding_txo_ref |= 1;
3339 LDKChannelMonitorUpdate update_var = update;
3340 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3341 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3342 uint64_t update_ref = (uint64_t)update_var.inner;
3343 if (update_var.is_owned) {
3346 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3348 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3349 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3350 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3351 if (get_jenv_res == JNI_EDETACHED) {
3352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3356 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3357 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3359 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3360 if (get_jenv_res == JNI_EDETACHED) {
3361 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3363 DO_ASSERT(get_jenv_res == JNI_OK);
3365 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3367 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3368 LDKCVec_MonitorEventZ ret_constr;
3369 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3370 if (ret_constr.datalen > 0)
3371 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3373 ret_constr.data = NULL;
3374 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3375 for (size_t o = 0; o < ret_constr.datalen; o++) {
3376 int64_t ret_conv_14 = ret_vals[o];
3377 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3378 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3379 ret_constr.data[o] = ret_conv_14_conv;
3381 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3382 if (get_jenv_res == JNI_EDETACHED) {
3383 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3387 static void* LDKWatch_JCalls_clone(const void* this_arg) {
3388 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3389 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3390 return (void*) this_arg;
3392 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3393 jclass c = (*env)->GetObjectClass(env, o);
3395 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3396 atomic_init(&calls->refcnt, 1);
3397 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3398 calls->o = (*env)->NewWeakGlobalRef(env, o);
3399 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3400 CHECK(calls->watch_channel_meth != NULL);
3401 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3402 CHECK(calls->update_channel_meth != NULL);
3403 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3404 CHECK(calls->release_pending_monitor_events_meth != NULL);
3407 .this_arg = (void*) calls,
3408 .watch_channel = watch_channel_LDKWatch_jcall,
3409 .update_channel = update_channel_LDKWatch_jcall,
3410 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3411 .free = LDKWatch_JCalls_free,
3415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3416 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3417 *res_ptr = LDKWatch_init(env, clz, o);
3418 return (uint64_t)res_ptr;
3420 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) {
3421 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3422 LDKOutPoint funding_txo_conv;
3423 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3424 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3425 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3426 LDKChannelMonitor monitor_conv;
3427 monitor_conv.inner = (void*)(monitor & (~1));
3428 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3429 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3430 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3431 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3432 return (uint64_t)ret_conv;
3435 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) {
3436 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3437 LDKOutPoint funding_txo_conv;
3438 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3439 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3440 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3441 LDKChannelMonitorUpdate update_conv;
3442 update_conv.inner = (void*)(update & (~1));
3443 update_conv.is_owned = (update & 1) || (update == 0);
3444 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3445 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3446 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3447 return (uint64_t)ret_conv;
3450 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3451 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3452 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3453 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3454 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3455 for (size_t o = 0; o < ret_var.datalen; o++) {
3456 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3457 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3458 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3459 ret_arr_ptr[o] = ret_conv_14_ref;
3461 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3466 typedef struct LDKBroadcasterInterface_JCalls {
3467 atomic_size_t refcnt;
3470 jmethodID broadcast_transaction_meth;
3471 } LDKBroadcasterInterface_JCalls;
3472 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3473 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3474 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3476 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3477 if (get_jenv_res == JNI_EDETACHED) {
3478 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3480 DO_ASSERT(get_jenv_res == JNI_OK);
3482 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3483 if (get_jenv_res == JNI_EDETACHED) {
3484 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3489 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3490 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3492 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3493 if (get_jenv_res == JNI_EDETACHED) {
3494 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3496 DO_ASSERT(get_jenv_res == JNI_OK);
3498 LDKTransaction tx_var = tx;
3499 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3500 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3501 Transaction_free(tx_var);
3502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3504 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3505 if (get_jenv_res == JNI_EDETACHED) {
3506 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3509 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
3510 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3512 return (void*) this_arg;
3514 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3515 jclass c = (*env)->GetObjectClass(env, o);
3517 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3518 atomic_init(&calls->refcnt, 1);
3519 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3520 calls->o = (*env)->NewWeakGlobalRef(env, o);
3521 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3522 CHECK(calls->broadcast_transaction_meth != NULL);
3524 LDKBroadcasterInterface ret = {
3525 .this_arg = (void*) calls,
3526 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3527 .free = LDKBroadcasterInterface_JCalls_free,
3531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3532 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3533 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3534 return (uint64_t)res_ptr;
3536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3537 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3538 LDKTransaction tx_ref;
3539 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3540 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3541 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3542 tx_ref.data_is_owned = true;
3543 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3546 typedef struct LDKKeysInterface_JCalls {
3547 atomic_size_t refcnt;
3550 jmethodID get_node_secret_meth;
3551 jmethodID get_destination_script_meth;
3552 jmethodID get_shutdown_pubkey_meth;
3553 jmethodID get_channel_signer_meth;
3554 jmethodID get_secure_random_bytes_meth;
3555 jmethodID read_chan_signer_meth;
3556 jmethodID sign_invoice_meth;
3557 } LDKKeysInterface_JCalls;
3558 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3559 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3560 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3562 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3563 if (get_jenv_res == JNI_EDETACHED) {
3564 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3566 DO_ASSERT(get_jenv_res == JNI_OK);
3568 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3569 if (get_jenv_res == JNI_EDETACHED) {
3570 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3575 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3576 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3578 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3579 if (get_jenv_res == JNI_EDETACHED) {
3580 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3582 DO_ASSERT(get_jenv_res == JNI_OK);
3584 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3586 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3587 LDKSecretKey ret_ref;
3588 CHECK((*env)->GetArrayLength(env, ret) == 32);
3589 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3590 if (get_jenv_res == JNI_EDETACHED) {
3591 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3595 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3596 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3598 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3599 if (get_jenv_res == JNI_EDETACHED) {
3600 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3602 DO_ASSERT(get_jenv_res == JNI_OK);
3604 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3606 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3607 LDKCVec_u8Z ret_ref;
3608 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3609 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3610 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3611 if (get_jenv_res == JNI_EDETACHED) {
3612 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3616 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3617 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3619 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3620 if (get_jenv_res == JNI_EDETACHED) {
3621 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3623 DO_ASSERT(get_jenv_res == JNI_OK);
3625 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3627 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3628 LDKPublicKey ret_ref;
3629 CHECK((*env)->GetArrayLength(env, ret) == 33);
3630 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3631 if (get_jenv_res == JNI_EDETACHED) {
3632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3636 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3637 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3639 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3640 if (get_jenv_res == JNI_EDETACHED) {
3641 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3643 DO_ASSERT(get_jenv_res == JNI_OK);
3645 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3647 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3648 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3649 ret_conv = Sign_clone(ret);
3650 if (get_jenv_res == JNI_EDETACHED) {
3651 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3655 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3656 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3658 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3659 if (get_jenv_res == JNI_EDETACHED) {
3660 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3662 DO_ASSERT(get_jenv_res == JNI_OK);
3664 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3666 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3667 LDKThirtyTwoBytes ret_ref;
3668 CHECK((*env)->GetArrayLength(env, ret) == 32);
3669 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3670 if (get_jenv_res == JNI_EDETACHED) {
3671 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3675 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3676 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3678 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3679 if (get_jenv_res == JNI_EDETACHED) {
3680 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3682 DO_ASSERT(get_jenv_res == JNI_OK);
3684 LDKu8slice reader_var = reader;
3685 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3686 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3687 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3689 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3690 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3691 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3692 if (get_jenv_res == JNI_EDETACHED) {
3693 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3697 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3698 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3700 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3701 if (get_jenv_res == JNI_EDETACHED) {
3702 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3704 DO_ASSERT(get_jenv_res == JNI_OK);
3706 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3707 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3708 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3709 CVec_u8Z_free(invoice_preimage_var);
3710 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3712 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3713 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3714 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3715 if (get_jenv_res == JNI_EDETACHED) {
3716 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3720 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
3721 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3722 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3723 return (void*) this_arg;
3725 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
3726 jclass c = (*env)->GetObjectClass(env, o);
3728 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
3729 atomic_init(&calls->refcnt, 1);
3730 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3731 calls->o = (*env)->NewWeakGlobalRef(env, o);
3732 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
3733 CHECK(calls->get_node_secret_meth != NULL);
3734 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
3735 CHECK(calls->get_destination_script_meth != NULL);
3736 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
3737 CHECK(calls->get_shutdown_pubkey_meth != NULL);
3738 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
3739 CHECK(calls->get_channel_signer_meth != NULL);
3740 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
3741 CHECK(calls->get_secure_random_bytes_meth != NULL);
3742 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
3743 CHECK(calls->read_chan_signer_meth != NULL);
3744 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
3745 CHECK(calls->sign_invoice_meth != NULL);
3747 LDKKeysInterface ret = {
3748 .this_arg = (void*) calls,
3749 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
3750 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
3751 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
3752 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
3753 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
3754 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
3755 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
3756 .free = LDKKeysInterface_JCalls_free,
3760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3761 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
3762 *res_ptr = LDKKeysInterface_init(env, clz, o);
3763 return (uint64_t)res_ptr;
3765 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
3766 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3767 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3768 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
3772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
3773 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3774 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
3775 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3776 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3777 CVec_u8Z_free(ret_var);
3781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
3782 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3783 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
3788 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) {
3789 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3790 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
3791 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
3792 return (uint64_t)ret;
3795 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
3796 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
3802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
3803 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3804 LDKu8slice reader_ref;
3805 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
3806 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
3807 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
3808 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
3809 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
3810 return (uint64_t)ret_conv;
3813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
3814 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
3815 LDKCVec_u8Z invoice_preimage_ref;
3816 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
3817 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
3818 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
3819 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
3820 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
3821 return (uint64_t)ret_conv;
3824 typedef struct LDKFeeEstimator_JCalls {
3825 atomic_size_t refcnt;
3828 jmethodID get_est_sat_per_1000_weight_meth;
3829 } LDKFeeEstimator_JCalls;
3830 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
3831 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3832 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3834 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3835 if (get_jenv_res == JNI_EDETACHED) {
3836 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3838 DO_ASSERT(get_jenv_res == JNI_OK);
3840 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3841 if (get_jenv_res == JNI_EDETACHED) {
3842 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3847 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
3848 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_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 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
3857 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3859 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
3860 if (get_jenv_res == JNI_EDETACHED) {
3861 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3865 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
3866 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
3867 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3868 return (void*) this_arg;
3870 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
3871 jclass c = (*env)->GetObjectClass(env, o);
3873 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
3874 atomic_init(&calls->refcnt, 1);
3875 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3876 calls->o = (*env)->NewWeakGlobalRef(env, o);
3877 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
3878 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
3880 LDKFeeEstimator ret = {
3881 .this_arg = (void*) calls,
3882 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
3883 .free = LDKFeeEstimator_JCalls_free,
3887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
3888 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
3889 *res_ptr = LDKFeeEstimator_init(env, clz, o);
3890 return (uint64_t)res_ptr;
3892 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) {
3893 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
3894 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
3895 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
3899 typedef struct LDKLogger_JCalls {
3900 atomic_size_t refcnt;
3905 static void LDKLogger_JCalls_free(void* this_arg) {
3906 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3907 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3909 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3910 if (get_jenv_res == JNI_EDETACHED) {
3911 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3913 DO_ASSERT(get_jenv_res == JNI_OK);
3915 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3916 if (get_jenv_res == JNI_EDETACHED) {
3917 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3922 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
3923 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3925 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3926 if (get_jenv_res == JNI_EDETACHED) {
3927 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3929 DO_ASSERT(get_jenv_res == JNI_OK);
3931 const char* record_str = record;
3932 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
3933 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3935 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
3936 if (get_jenv_res == JNI_EDETACHED) {
3937 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3940 static void* LDKLogger_JCalls_clone(const void* this_arg) {
3941 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3942 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3943 return (void*) this_arg;
3945 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
3946 jclass c = (*env)->GetObjectClass(env, o);
3948 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3949 atomic_init(&calls->refcnt, 1);
3950 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3951 calls->o = (*env)->NewWeakGlobalRef(env, o);
3952 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
3953 CHECK(calls->log_meth != NULL);
3956 .this_arg = (void*) calls,
3957 .log = log_LDKLogger_jcall,
3958 .free = LDKLogger_JCalls_free,
3962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
3963 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3964 *res_ptr = LDKLogger_init(env, clz, o);
3965 return (uint64_t)res_ptr;
3967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3968 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
3969 LDKThirtyTwoBytes a_ref;
3970 CHECK((*env)->GetArrayLength(env, a) == 32);
3971 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3973 LDKChannelManager b_conv;
3974 b_conv.inner = (void*)(b & (~1));
3975 b_conv.is_owned = (b & 1) || (b == 0);
3976 // Warning: we need a move here but no clone is available for LDKChannelManager
3978 return (uint64_t)ret;
3980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3981 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3982 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3983 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3987 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
3988 LDKChannelManager b_var = tuple->b;
3989 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3990 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3991 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3995 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
3997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3998 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
3999 CHECK(val->result_ok);
4000 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4004 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4005 CHECK(!val->result_ok);
4006 LDKDecodeError err_var = (*val->contents.err);
4007 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4008 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4009 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4013 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4016 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4017 CHECK(val->result_ok);
4018 LDKChannelConfig res_var = (*val->contents.result);
4019 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4020 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4021 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4025 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4026 CHECK(!val->result_ok);
4027 LDKDecodeError err_var = (*val->contents.err);
4028 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4029 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4030 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4033 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4034 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4037 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4038 CHECK(val->result_ok);
4039 LDKOutPoint res_var = (*val->contents.result);
4040 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4041 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4042 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4046 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4047 CHECK(!val->result_ok);
4048 LDKDecodeError err_var = (*val->contents.err);
4049 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4050 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4051 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4055 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4057 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4058 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4059 CHECK(val->result_ok);
4060 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4064 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4065 CHECK(!val->result_ok);
4066 return *val->contents.err;
4068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4069 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4072 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4073 CHECK(val->result_ok);
4074 LDKInvoice res_var = (*val->contents.result);
4075 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4076 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4077 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4081 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4082 CHECK(!val->result_ok);
4083 return *val->contents.err;
4085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4086 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4089 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4090 CHECK(val->result_ok);
4091 LDKSignedRawInvoice res_var = (*val->contents.result);
4092 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4093 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4094 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4098 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4099 CHECK(!val->result_ok);
4100 return *val->contents.err;
4102 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) {
4103 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4104 LDKRawInvoice a_conv;
4105 a_conv.inner = (void*)(a & (~1));
4106 a_conv.is_owned = (a & 1) || (a == 0);
4107 a_conv = RawInvoice_clone(&a_conv);
4109 LDKThirtyTwoBytes b_ref;
4110 CHECK((*env)->GetArrayLength(env, b) == 32);
4111 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4113 LDKInvoiceSignature c_conv;
4114 c_conv.inner = (void*)(c & (~1));
4115 c_conv.is_owned = (c & 1) || (c == 0);
4116 c_conv = InvoiceSignature_clone(&c_conv);
4118 return (uint64_t)ret;
4120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4121 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4122 LDKRawInvoice a_var = tuple->a;
4123 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4124 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4125 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4129 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4130 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4131 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4135 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4136 LDKInvoiceSignature c_var = tuple->c;
4137 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4138 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4139 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4143 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4146 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4147 CHECK(val->result_ok);
4148 LDKPayeePubKey res_var = (*val->contents.result);
4149 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4150 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4151 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4154 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4155 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4156 CHECK(!val->result_ok);
4157 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4161 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4162 ret->datalen = (*env)->GetArrayLength(env, elems);
4163 if (ret->datalen == 0) {
4166 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4167 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4168 for (size_t i = 0; i < ret->datalen; i++) {
4169 int64_t arr_elem = java_elems[i];
4170 LDKPrivateRoute arr_elem_conv;
4171 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4172 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4173 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4174 ret->data[i] = arr_elem_conv;
4176 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4178 return (uint64_t)ret;
4180 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4181 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4182 for (size_t i = 0; i < ret.datalen; i++) {
4183 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4188 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4191 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4192 CHECK(val->result_ok);
4193 LDKPositiveTimestamp res_var = (*val->contents.result);
4194 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4195 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4196 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4199 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4200 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4201 CHECK(!val->result_ok);
4202 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4205 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4206 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4209 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4210 CHECK(val->result_ok);
4211 return *val->contents.result;
4213 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4214 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4215 CHECK(!val->result_ok);
4216 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4220 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4223 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4224 CHECK(val->result_ok);
4225 LDKInvoice res_var = (*val->contents.result);
4226 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4227 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4228 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4231 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4232 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4233 CHECK(!val->result_ok);
4234 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4238 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4241 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4242 CHECK(val->result_ok);
4243 LDKDescription res_var = (*val->contents.result);
4244 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4245 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4246 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4249 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4250 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4251 CHECK(!val->result_ok);
4252 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4255 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4256 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4259 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4260 CHECK(val->result_ok);
4261 LDKExpiryTime res_var = (*val->contents.result);
4262 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4263 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4264 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4267 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4268 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4269 CHECK(!val->result_ok);
4270 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4274 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4277 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4278 CHECK(val->result_ok);
4279 LDKPrivateRoute res_var = (*val->contents.result);
4280 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4281 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4282 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4285 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4286 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4287 CHECK(!val->result_ok);
4288 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4291 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4292 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4294 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4295 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4296 CHECK(val->result_ok);
4297 LDKStr res_str = (*val->contents.result);
4298 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4301 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4302 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4303 CHECK(!val->result_ok);
4304 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4308 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4311 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4312 CHECK(val->result_ok);
4313 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4314 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4315 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4316 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4320 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4321 CHECK(!val->result_ok);
4322 LDKDecodeError err_var = (*val->contents.err);
4323 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4324 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4325 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4328 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4329 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4332 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4333 CHECK(val->result_ok);
4334 LDKHTLCUpdate res_var = (*val->contents.result);
4335 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4336 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4337 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4341 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4342 CHECK(!val->result_ok);
4343 LDKDecodeError err_var = (*val->contents.err);
4344 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4349 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4350 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4353 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4354 CHECK(val->result_ok);
4355 return *val->contents.result;
4357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4358 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4359 CHECK(!val->result_ok);
4360 LDKMonitorUpdateError err_var = (*val->contents.err);
4361 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4362 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4363 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4367 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4369 a_conv.inner = (void*)(a & (~1));
4370 a_conv.is_owned = (a & 1) || (a == 0);
4371 a_conv = OutPoint_clone(&a_conv);
4374 b_ref.datalen = (*env)->GetArrayLength(env, b);
4375 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4376 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4378 return (uint64_t)ret;
4380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4381 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4382 LDKOutPoint a_var = tuple->a;
4383 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4384 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4385 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4388 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4389 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4390 LDKCVec_u8Z b_var = tuple->b;
4391 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4392 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4396 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4399 b_ref.datalen = (*env)->GetArrayLength(env, b);
4400 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4401 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4403 return (uint64_t)ret;
4405 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4406 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4410 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4411 LDKCVec_u8Z b_var = tuple->b;
4412 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4413 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4417 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4418 ret->datalen = (*env)->GetArrayLength(env, elems);
4419 if (ret->datalen == 0) {
4422 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4423 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4424 for (size_t i = 0; i < ret->datalen; i++) {
4425 int64_t arr_elem = java_elems[i];
4426 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4427 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4428 ret->data[i] = arr_elem_conv;
4430 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4432 return (uint64_t)ret;
4434 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4435 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4436 for (size_t i = 0; i < ret.datalen; i++) {
4437 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4442 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4443 LDKThirtyTwoBytes a_ref;
4444 CHECK((*env)->GetArrayLength(env, a) == 32);
4445 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4447 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4448 b_constr.datalen = (*env)->GetArrayLength(env, b);
4449 if (b_constr.datalen > 0)
4450 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4452 b_constr.data = NULL;
4453 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4454 for (size_t b = 0; b < b_constr.datalen; b++) {
4455 int64_t b_conv_27 = b_vals[b];
4456 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4457 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4458 b_constr.data[b] = b_conv_27_conv;
4460 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4462 return (uint64_t)ret;
4464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4465 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4466 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4467 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4470 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4471 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4472 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4473 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4474 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4475 for (size_t b = 0; b < b_var.datalen; b++) {
4476 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4477 b_arr_ptr[b] = b_conv_27_ref;
4479 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4483 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4484 ret->datalen = (*env)->GetArrayLength(env, elems);
4485 if (ret->datalen == 0) {
4488 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4489 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4490 for (size_t i = 0; i < ret->datalen; i++) {
4491 int64_t arr_elem = java_elems[i];
4492 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4493 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4494 ret->data[i] = arr_elem_conv;
4496 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4498 return (uint64_t)ret;
4500 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4501 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 };
4502 for (size_t i = 0; i < ret.datalen; i++) {
4503 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4507 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4508 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4509 static jclass LDKEvent_PaymentReceived_class = NULL;
4510 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4511 static jclass LDKEvent_PaymentSent_class = NULL;
4512 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4513 static jclass LDKEvent_PaymentFailed_class = NULL;
4514 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4515 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4516 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4517 static jclass LDKEvent_SpendableOutputs_class = NULL;
4518 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4520 LDKEvent_FundingGenerationReady_class =
4521 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4522 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4523 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4524 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4525 LDKEvent_PaymentReceived_class =
4526 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4527 CHECK(LDKEvent_PaymentReceived_class != NULL);
4528 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
4529 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4530 LDKEvent_PaymentSent_class =
4531 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4532 CHECK(LDKEvent_PaymentSent_class != NULL);
4533 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4534 CHECK(LDKEvent_PaymentSent_meth != NULL);
4535 LDKEvent_PaymentFailed_class =
4536 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4537 CHECK(LDKEvent_PaymentFailed_class != NULL);
4538 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4539 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4540 LDKEvent_PendingHTLCsForwardable_class =
4541 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4542 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4543 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4544 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4545 LDKEvent_SpendableOutputs_class =
4546 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4547 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4548 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4549 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4551 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4552 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4554 case LDKEvent_FundingGenerationReady: {
4555 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4556 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4557 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4558 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4559 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4560 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);
4562 case LDKEvent_PaymentReceived: {
4563 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4564 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4565 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4566 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
4567 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4568 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
4569 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
4571 case LDKEvent_PaymentSent: {
4572 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4573 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4574 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4576 case LDKEvent_PaymentFailed: {
4577 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4578 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4579 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4581 case LDKEvent_PendingHTLCsForwardable: {
4582 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4584 case LDKEvent_SpendableOutputs: {
4585 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4586 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4587 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4588 for (size_t b = 0; b < outputs_var.datalen; b++) {
4589 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4590 outputs_arr_ptr[b] = outputs_conv_27_ref;
4592 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4593 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4599 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4600 ret->datalen = (*env)->GetArrayLength(env, elems);
4601 if (ret->datalen == 0) {
4604 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4605 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4606 for (size_t i = 0; i < ret->datalen; i++) {
4607 int64_t arr_elem = java_elems[i];
4608 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4609 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4610 ret->data[i] = arr_elem_conv;
4612 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4614 return (uint64_t)ret;
4616 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4617 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4618 for (size_t i = 0; i < ret.datalen; i++) {
4619 ret.data[i] = Event_clone(&orig->data[i]);
4623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4624 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4626 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4627 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4629 return (uint64_t)ret;
4631 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4632 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4636 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4637 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4638 return (uint64_t)b_ref;
4640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4641 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4642 ret->datalen = (*env)->GetArrayLength(env, elems);
4643 if (ret->datalen == 0) {
4646 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4647 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4648 for (size_t i = 0; i < ret->datalen; i++) {
4649 int64_t arr_elem = java_elems[i];
4650 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4651 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4652 ret->data[i] = arr_elem_conv;
4654 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4656 return (uint64_t)ret;
4658 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4659 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4660 for (size_t i = 0; i < ret.datalen; i++) {
4661 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4666 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4667 LDKThirtyTwoBytes a_ref;
4668 CHECK((*env)->GetArrayLength(env, a) == 32);
4669 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4671 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4672 b_constr.datalen = (*env)->GetArrayLength(env, b);
4673 if (b_constr.datalen > 0)
4674 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4676 b_constr.data = NULL;
4677 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4678 for (size_t a = 0; a < b_constr.datalen; a++) {
4679 int64_t b_conv_26 = b_vals[a];
4680 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4681 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4682 b_constr.data[a] = b_conv_26_conv;
4684 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4686 return (uint64_t)ret;
4688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4689 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4690 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4691 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4694 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4695 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
4696 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
4697 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4698 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4699 for (size_t a = 0; a < b_var.datalen; a++) {
4700 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
4701 b_arr_ptr[a] = b_conv_26_ref;
4703 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4707 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
4708 ret->datalen = (*env)->GetArrayLength(env, elems);
4709 if (ret->datalen == 0) {
4712 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
4713 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4714 for (size_t i = 0; i < ret->datalen; i++) {
4715 int64_t arr_elem = java_elems[i];
4716 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
4717 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
4718 ret->data[i] = arr_elem_conv;
4720 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4722 return (uint64_t)ret;
4724 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
4725 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 };
4726 for (size_t i = 0; i < ret.datalen; i++) {
4727 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
4731 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4732 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
4734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4735 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4736 CHECK(val->result_ok);
4737 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4741 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
4742 CHECK(!val->result_ok);
4743 LDKDecodeError err_var = (*val->contents.err);
4744 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4745 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4746 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4750 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
4752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4753 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4754 CHECK(val->result_ok);
4755 return *val->contents.result;
4757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4758 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
4759 CHECK(!val->result_ok);
4760 LDKLightningError err_var = (*val->contents.err);
4761 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4762 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4763 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4766 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) {
4767 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4768 LDKChannelAnnouncement a_conv;
4769 a_conv.inner = (void*)(a & (~1));
4770 a_conv.is_owned = (a & 1) || (a == 0);
4771 a_conv = ChannelAnnouncement_clone(&a_conv);
4773 LDKChannelUpdate b_conv;
4774 b_conv.inner = (void*)(b & (~1));
4775 b_conv.is_owned = (b & 1) || (b == 0);
4776 b_conv = ChannelUpdate_clone(&b_conv);
4778 LDKChannelUpdate c_conv;
4779 c_conv.inner = (void*)(c & (~1));
4780 c_conv.is_owned = (c & 1) || (c == 0);
4781 c_conv = ChannelUpdate_clone(&c_conv);
4783 return (uint64_t)ret;
4785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4786 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4787 LDKChannelAnnouncement a_var = tuple->a;
4788 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4789 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4790 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4794 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4795 LDKChannelUpdate b_var = tuple->b;
4796 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4797 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4798 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4802 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
4803 LDKChannelUpdate c_var = tuple->c;
4804 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4805 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4806 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4810 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
4811 ret->datalen = (*env)->GetArrayLength(env, elems);
4812 if (ret->datalen == 0) {
4815 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
4816 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4817 for (size_t i = 0; i < ret->datalen; i++) {
4818 int64_t arr_elem = java_elems[i];
4819 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
4820 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
4821 ret->data[i] = arr_elem_conv;
4823 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4825 return (uint64_t)ret;
4827 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
4828 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
4829 for (size_t i = 0; i < ret.datalen; i++) {
4830 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
4834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4835 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
4836 ret->datalen = (*env)->GetArrayLength(env, elems);
4837 if (ret->datalen == 0) {
4840 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
4841 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4842 for (size_t i = 0; i < ret->datalen; i++) {
4843 int64_t arr_elem = java_elems[i];
4844 LDKNodeAnnouncement arr_elem_conv;
4845 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4846 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4847 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4848 ret->data[i] = arr_elem_conv;
4850 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4852 return (uint64_t)ret;
4854 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
4855 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
4856 for (size_t i = 0; i < ret.datalen; i++) {
4857 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
4861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4862 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
4864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4865 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4866 CHECK(val->result_ok);
4867 return *val->contents.result;
4869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4870 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
4871 CHECK(!val->result_ok);
4872 LDKLightningError err_var = (*val->contents.err);
4873 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4874 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4875 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4879 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4881 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4882 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4883 CHECK(val->result_ok);
4884 LDKCVec_u8Z res_var = (*val->contents.result);
4885 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
4886 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
4889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4890 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
4891 CHECK(!val->result_ok);
4892 LDKPeerHandleError err_var = (*val->contents.err);
4893 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4894 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4895 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4899 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
4901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4902 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4903 CHECK(val->result_ok);
4904 return *val->contents.result;
4906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4907 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
4908 CHECK(!val->result_ok);
4909 LDKPeerHandleError err_var = (*val->contents.err);
4910 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4911 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4912 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4916 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4919 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4920 CHECK(val->result_ok);
4921 return *val->contents.result;
4923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4924 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
4925 CHECK(!val->result_ok);
4926 LDKPeerHandleError err_var = (*val->contents.err);
4927 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4928 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4929 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4933 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
4935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4936 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4937 CHECK(val->result_ok);
4938 LDKDirectionalChannelInfo res_var = (*val->contents.result);
4939 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4940 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4941 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4945 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
4946 CHECK(!val->result_ok);
4947 LDKDecodeError err_var = (*val->contents.err);
4948 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4949 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4950 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4954 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
4956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4957 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4958 CHECK(val->result_ok);
4959 LDKChannelInfo res_var = (*val->contents.result);
4960 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4961 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4962 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4966 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
4967 CHECK(!val->result_ok);
4968 LDKDecodeError err_var = (*val->contents.err);
4969 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4970 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4971 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4975 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
4977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4978 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4979 CHECK(val->result_ok);
4980 LDKRoutingFees res_var = (*val->contents.result);
4981 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4982 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4983 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4987 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
4988 CHECK(!val->result_ok);
4989 LDKDecodeError err_var = (*val->contents.err);
4990 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4991 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4992 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4995 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4996 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
4998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4999 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5000 CHECK(val->result_ok);
5001 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5002 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5003 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5004 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5008 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5009 CHECK(!val->result_ok);
5010 LDKDecodeError err_var = (*val->contents.err);
5011 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5012 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5013 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5017 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5018 ret->datalen = (*env)->GetArrayLength(env, elems);
5019 if (ret->datalen == 0) {
5022 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5023 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5024 for (size_t i = 0; i < ret->datalen; i++) {
5025 ret->data[i] = java_elems[i];
5027 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5029 return (uint64_t)ret;
5031 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5032 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5033 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5037 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5040 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5041 CHECK(val->result_ok);
5042 LDKNodeInfo res_var = (*val->contents.result);
5043 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5044 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5045 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5049 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5050 CHECK(!val->result_ok);
5051 LDKDecodeError err_var = (*val->contents.err);
5052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5058 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5061 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5062 CHECK(val->result_ok);
5063 LDKNetworkGraph res_var = (*val->contents.result);
5064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5070 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5071 CHECK(!val->result_ok);
5072 LDKDecodeError err_var = (*val->contents.err);
5073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5079 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5082 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5083 CHECK(val->result_ok);
5084 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5087 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5088 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5089 CHECK(!val->result_ok);
5090 return *val->contents.err;
5092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5093 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5096 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5097 CHECK(val->result_ok);
5098 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5099 *res_conv = (*val->contents.result);
5100 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5101 return (uint64_t)res_conv;
5103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5104 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5105 CHECK(!val->result_ok);
5106 LDKDecodeError err_var = (*val->contents.err);
5107 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5108 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5109 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5112 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5113 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5116 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5117 CHECK(val->result_ok);
5118 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5122 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5123 CHECK(!val->result_ok);
5124 LDKDecodeError err_var = (*val->contents.err);
5125 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5126 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5127 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5131 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5132 ret->datalen = (*env)->GetArrayLength(env, elems);
5133 if (ret->datalen == 0) {
5136 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5137 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5138 for (size_t i = 0; i < ret->datalen; i++) {
5139 int64_t arr_elem = java_elems[i];
5140 LDKUpdateAddHTLC arr_elem_conv;
5141 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5142 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5143 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5144 ret->data[i] = arr_elem_conv;
5146 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5148 return (uint64_t)ret;
5150 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5151 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5152 for (size_t i = 0; i < ret.datalen; i++) {
5153 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5158 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5159 ret->datalen = (*env)->GetArrayLength(env, elems);
5160 if (ret->datalen == 0) {
5163 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5164 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5165 for (size_t i = 0; i < ret->datalen; i++) {
5166 int64_t arr_elem = java_elems[i];
5167 LDKUpdateFulfillHTLC arr_elem_conv;
5168 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5169 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5170 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5171 ret->data[i] = arr_elem_conv;
5173 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5175 return (uint64_t)ret;
5177 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5178 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5179 for (size_t i = 0; i < ret.datalen; i++) {
5180 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5185 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5186 ret->datalen = (*env)->GetArrayLength(env, elems);
5187 if (ret->datalen == 0) {
5190 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5191 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5192 for (size_t i = 0; i < ret->datalen; i++) {
5193 int64_t arr_elem = java_elems[i];
5194 LDKUpdateFailHTLC arr_elem_conv;
5195 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5196 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5197 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5198 ret->data[i] = arr_elem_conv;
5200 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5202 return (uint64_t)ret;
5204 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5205 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5206 for (size_t i = 0; i < ret.datalen; i++) {
5207 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5212 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5213 ret->datalen = (*env)->GetArrayLength(env, elems);
5214 if (ret->datalen == 0) {
5217 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5218 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5219 for (size_t i = 0; i < ret->datalen; i++) {
5220 int64_t arr_elem = java_elems[i];
5221 LDKUpdateFailMalformedHTLC arr_elem_conv;
5222 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5223 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5224 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5225 ret->data[i] = arr_elem_conv;
5227 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5229 return (uint64_t)ret;
5231 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5232 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5233 for (size_t i = 0; i < ret.datalen; i++) {
5234 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5238 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5239 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5242 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5243 CHECK(val->result_ok);
5244 LDKAcceptChannel res_var = (*val->contents.result);
5245 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5246 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5247 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5251 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5252 CHECK(!val->result_ok);
5253 LDKDecodeError err_var = (*val->contents.err);
5254 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5255 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5256 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5260 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5263 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5264 CHECK(val->result_ok);
5265 LDKAnnouncementSignatures res_var = (*val->contents.result);
5266 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5267 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5268 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5272 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5273 CHECK(!val->result_ok);
5274 LDKDecodeError err_var = (*val->contents.err);
5275 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5276 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5277 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5280 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5281 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5284 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5285 CHECK(val->result_ok);
5286 LDKChannelReestablish res_var = (*val->contents.result);
5287 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5288 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5289 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5293 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5294 CHECK(!val->result_ok);
5295 LDKDecodeError err_var = (*val->contents.err);
5296 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5297 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5298 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5302 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5305 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5306 CHECK(val->result_ok);
5307 LDKClosingSigned res_var = (*val->contents.result);
5308 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5309 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5310 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5314 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5315 CHECK(!val->result_ok);
5316 LDKDecodeError err_var = (*val->contents.err);
5317 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5318 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5319 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5323 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5326 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5327 CHECK(val->result_ok);
5328 LDKCommitmentSigned res_var = (*val->contents.result);
5329 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5330 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5331 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5335 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5336 CHECK(!val->result_ok);
5337 LDKDecodeError err_var = (*val->contents.err);
5338 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5339 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5340 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5344 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5347 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5348 CHECK(val->result_ok);
5349 LDKFundingCreated res_var = (*val->contents.result);
5350 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5351 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5352 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5356 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5357 CHECK(!val->result_ok);
5358 LDKDecodeError err_var = (*val->contents.err);
5359 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5360 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5361 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5365 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5368 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5369 CHECK(val->result_ok);
5370 LDKFundingSigned res_var = (*val->contents.result);
5371 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5372 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5373 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5377 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5378 CHECK(!val->result_ok);
5379 LDKDecodeError err_var = (*val->contents.err);
5380 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5381 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5382 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5386 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5389 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5390 CHECK(val->result_ok);
5391 LDKFundingLocked res_var = (*val->contents.result);
5392 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5393 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5394 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5398 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5399 CHECK(!val->result_ok);
5400 LDKDecodeError err_var = (*val->contents.err);
5401 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5402 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5403 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5407 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5410 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5411 CHECK(val->result_ok);
5412 LDKInit res_var = (*val->contents.result);
5413 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5414 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5415 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5419 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5420 CHECK(!val->result_ok);
5421 LDKDecodeError err_var = (*val->contents.err);
5422 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5423 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5424 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5428 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5431 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5432 CHECK(val->result_ok);
5433 LDKOpenChannel res_var = (*val->contents.result);
5434 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5435 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5436 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5440 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5441 CHECK(!val->result_ok);
5442 LDKDecodeError err_var = (*val->contents.err);
5443 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5444 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5445 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5449 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5452 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5453 CHECK(val->result_ok);
5454 LDKRevokeAndACK res_var = (*val->contents.result);
5455 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5456 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5457 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5461 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5462 CHECK(!val->result_ok);
5463 LDKDecodeError err_var = (*val->contents.err);
5464 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5465 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5466 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5470 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5473 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5474 CHECK(val->result_ok);
5475 LDKShutdown res_var = (*val->contents.result);
5476 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5477 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5478 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5482 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5483 CHECK(!val->result_ok);
5484 LDKDecodeError err_var = (*val->contents.err);
5485 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5486 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5487 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5491 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5494 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5495 CHECK(val->result_ok);
5496 LDKUpdateFailHTLC res_var = (*val->contents.result);
5497 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5498 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5499 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5503 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5504 CHECK(!val->result_ok);
5505 LDKDecodeError err_var = (*val->contents.err);
5506 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5507 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5508 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5512 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5515 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5516 CHECK(val->result_ok);
5517 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5518 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5519 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5520 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5524 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5525 CHECK(!val->result_ok);
5526 LDKDecodeError err_var = (*val->contents.err);
5527 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5528 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5529 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5533 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5536 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5537 CHECK(val->result_ok);
5538 LDKUpdateFee res_var = (*val->contents.result);
5539 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5540 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5541 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5545 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5546 CHECK(!val->result_ok);
5547 LDKDecodeError err_var = (*val->contents.err);
5548 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5549 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5550 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5554 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5557 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5558 CHECK(val->result_ok);
5559 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5560 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5561 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5562 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5566 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5567 CHECK(!val->result_ok);
5568 LDKDecodeError err_var = (*val->contents.err);
5569 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5570 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5571 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5575 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5578 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5579 CHECK(val->result_ok);
5580 LDKUpdateAddHTLC res_var = (*val->contents.result);
5581 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5582 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5583 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5587 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5588 CHECK(!val->result_ok);
5589 LDKDecodeError err_var = (*val->contents.err);
5590 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5591 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5592 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5596 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5599 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5600 CHECK(val->result_ok);
5601 LDKPing res_var = (*val->contents.result);
5602 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5603 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5604 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5608 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5609 CHECK(!val->result_ok);
5610 LDKDecodeError err_var = (*val->contents.err);
5611 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5612 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5613 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5617 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5620 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5621 CHECK(val->result_ok);
5622 LDKPong res_var = (*val->contents.result);
5623 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5624 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5625 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5629 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5630 CHECK(!val->result_ok);
5631 LDKDecodeError err_var = (*val->contents.err);
5632 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5633 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5634 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5638 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5641 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5642 CHECK(val->result_ok);
5643 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5646 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5650 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5651 CHECK(!val->result_ok);
5652 LDKDecodeError err_var = (*val->contents.err);
5653 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5654 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5655 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5659 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5662 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5663 CHECK(val->result_ok);
5664 LDKChannelAnnouncement res_var = (*val->contents.result);
5665 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5666 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5667 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5671 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5672 CHECK(!val->result_ok);
5673 LDKDecodeError err_var = (*val->contents.err);
5674 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5675 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5676 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5680 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5683 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5684 CHECK(val->result_ok);
5685 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
5686 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5687 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5688 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5692 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5693 CHECK(!val->result_ok);
5694 LDKDecodeError err_var = (*val->contents.err);
5695 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5696 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5697 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5701 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
5703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5704 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5705 CHECK(val->result_ok);
5706 LDKChannelUpdate res_var = (*val->contents.result);
5707 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5708 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5709 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5713 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
5714 CHECK(!val->result_ok);
5715 LDKDecodeError err_var = (*val->contents.err);
5716 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5717 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5718 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5722 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5725 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5726 CHECK(val->result_ok);
5727 LDKErrorMessage res_var = (*val->contents.result);
5728 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5729 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5730 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5734 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
5735 CHECK(!val->result_ok);
5736 LDKDecodeError err_var = (*val->contents.err);
5737 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5738 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5739 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5743 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5746 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5747 CHECK(val->result_ok);
5748 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
5749 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5750 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5751 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5755 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
5756 CHECK(!val->result_ok);
5757 LDKDecodeError err_var = (*val->contents.err);
5758 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5759 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5760 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5764 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
5766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5767 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5768 CHECK(val->result_ok);
5769 LDKNodeAnnouncement res_var = (*val->contents.result);
5770 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5771 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5772 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5776 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
5777 CHECK(!val->result_ok);
5778 LDKDecodeError err_var = (*val->contents.err);
5779 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5780 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5781 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5785 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
5787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5788 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5789 CHECK(val->result_ok);
5790 LDKQueryShortChannelIds res_var = (*val->contents.result);
5791 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5792 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5793 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5797 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
5798 CHECK(!val->result_ok);
5799 LDKDecodeError err_var = (*val->contents.err);
5800 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5801 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5802 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5806 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
5808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5809 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5810 CHECK(val->result_ok);
5811 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
5812 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5813 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5814 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5818 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
5819 CHECK(!val->result_ok);
5820 LDKDecodeError err_var = (*val->contents.err);
5821 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5822 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5823 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5827 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
5829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5830 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5831 CHECK(val->result_ok);
5832 LDKQueryChannelRange res_var = (*val->contents.result);
5833 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5834 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5835 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5839 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
5840 CHECK(!val->result_ok);
5841 LDKDecodeError err_var = (*val->contents.err);
5842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5848 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
5850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5851 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5852 CHECK(val->result_ok);
5853 LDKReplyChannelRange res_var = (*val->contents.result);
5854 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5855 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5856 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5860 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
5861 CHECK(!val->result_ok);
5862 LDKDecodeError err_var = (*val->contents.err);
5863 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5864 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5865 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5869 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
5871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5872 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5873 CHECK(val->result_ok);
5874 LDKGossipTimestampFilter res_var = (*val->contents.result);
5875 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5876 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5877 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5881 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
5882 CHECK(!val->result_ok);
5883 LDKDecodeError err_var = (*val->contents.err);
5884 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5885 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5886 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5889 static jclass LDKSignOrCreationError_SignError_class = NULL;
5890 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
5891 static jclass LDKSignOrCreationError_CreationError_class = NULL;
5892 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
5893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
5894 LDKSignOrCreationError_SignError_class =
5895 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
5896 CHECK(LDKSignOrCreationError_SignError_class != NULL);
5897 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
5898 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
5899 LDKSignOrCreationError_CreationError_class =
5900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
5901 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
5902 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
5903 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
5905 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5906 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
5908 case LDKSignOrCreationError_SignError: {
5909 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
5911 case LDKSignOrCreationError_CreationError: {
5912 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
5913 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
5918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5919 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
5921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5922 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5923 CHECK(val->result_ok);
5924 LDKInvoice res_var = (*val->contents.result);
5925 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5926 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5927 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5931 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
5932 CHECK(!val->result_ok);
5933 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
5936 typedef struct LDKMessageSendEventsProvider_JCalls {
5937 atomic_size_t refcnt;
5940 jmethodID get_and_clear_pending_msg_events_meth;
5941 } LDKMessageSendEventsProvider_JCalls;
5942 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
5943 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5944 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5946 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5947 if (get_jenv_res == JNI_EDETACHED) {
5948 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5950 DO_ASSERT(get_jenv_res == JNI_OK);
5952 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5953 if (get_jenv_res == JNI_EDETACHED) {
5954 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5959 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
5960 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5962 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5963 if (get_jenv_res == JNI_EDETACHED) {
5964 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5966 DO_ASSERT(get_jenv_res == JNI_OK);
5968 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5970 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
5971 LDKCVec_MessageSendEventZ ret_constr;
5972 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
5973 if (ret_constr.datalen > 0)
5974 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5976 ret_constr.data = NULL;
5977 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
5978 for (size_t s = 0; s < ret_constr.datalen; s++) {
5979 int64_t ret_conv_18 = ret_vals[s];
5980 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
5981 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
5982 ret_constr.data[s] = ret_conv_18_conv;
5984 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
5985 if (get_jenv_res == JNI_EDETACHED) {
5986 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5990 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
5991 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
5992 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5993 return (void*) this_arg;
5995 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
5996 jclass c = (*env)->GetObjectClass(env, o);
5998 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
5999 atomic_init(&calls->refcnt, 1);
6000 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6001 calls->o = (*env)->NewWeakGlobalRef(env, o);
6002 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6003 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6005 LDKMessageSendEventsProvider ret = {
6006 .this_arg = (void*) calls,
6007 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6008 .free = LDKMessageSendEventsProvider_JCalls_free,
6012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6013 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6014 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6015 return (uint64_t)res_ptr;
6017 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6018 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6019 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6020 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6021 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6022 for (size_t s = 0; s < ret_var.datalen; s++) {
6023 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6024 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6025 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6026 ret_arr_ptr[s] = ret_conv_18_ref;
6028 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6033 typedef struct LDKEventHandler_JCalls {
6034 atomic_size_t refcnt;
6037 jmethodID handle_event_meth;
6038 } LDKEventHandler_JCalls;
6039 static void LDKEventHandler_JCalls_free(void* this_arg) {
6040 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6041 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6043 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6044 if (get_jenv_res == JNI_EDETACHED) {
6045 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6047 DO_ASSERT(get_jenv_res == JNI_OK);
6049 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6050 if (get_jenv_res == JNI_EDETACHED) {
6051 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6056 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6057 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6059 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6060 if (get_jenv_res == JNI_EDETACHED) {
6061 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6063 DO_ASSERT(get_jenv_res == JNI_OK);
6065 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6066 *event_copy = event;
6067 uint64_t event_ref = (uint64_t)event_copy;
6068 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6070 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6071 if (get_jenv_res == JNI_EDETACHED) {
6072 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6075 static void* LDKEventHandler_JCalls_clone(const void* this_arg) {
6076 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6078 return (void*) this_arg;
6080 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6081 jclass c = (*env)->GetObjectClass(env, o);
6083 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6084 atomic_init(&calls->refcnt, 1);
6085 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6086 calls->o = (*env)->NewWeakGlobalRef(env, o);
6087 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6088 CHECK(calls->handle_event_meth != NULL);
6090 LDKEventHandler ret = {
6091 .this_arg = (void*) calls,
6092 .handle_event = handle_event_LDKEventHandler_jcall,
6093 .free = LDKEventHandler_JCalls_free,
6097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6098 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6099 *res_ptr = LDKEventHandler_init(env, clz, o);
6100 return (uint64_t)res_ptr;
6102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6103 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6104 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6105 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6108 typedef struct LDKEventsProvider_JCalls {
6109 atomic_size_t refcnt;
6112 jmethodID process_pending_events_meth;
6113 } LDKEventsProvider_JCalls;
6114 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6115 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6118 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6119 if (get_jenv_res == JNI_EDETACHED) {
6120 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6122 DO_ASSERT(get_jenv_res == JNI_OK);
6124 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6125 if (get_jenv_res == JNI_EDETACHED) {
6126 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6131 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6132 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6134 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6135 if (get_jenv_res == JNI_EDETACHED) {
6136 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6138 DO_ASSERT(get_jenv_res == JNI_OK);
6140 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6142 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6144 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6145 if (get_jenv_res == JNI_EDETACHED) {
6146 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6149 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
6150 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6151 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6152 return (void*) this_arg;
6154 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6155 jclass c = (*env)->GetObjectClass(env, o);
6157 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6158 atomic_init(&calls->refcnt, 1);
6159 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6160 calls->o = (*env)->NewWeakGlobalRef(env, o);
6161 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6162 CHECK(calls->process_pending_events_meth != NULL);
6164 LDKEventsProvider ret = {
6165 .this_arg = (void*) calls,
6166 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6167 .free = LDKEventsProvider_JCalls_free,
6171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6172 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6173 *res_ptr = LDKEventsProvider_init(env, clz, o);
6174 return (uint64_t)res_ptr;
6176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6177 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6178 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6179 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6181 LDKEventHandler_JCalls_clone(handler_conv.this_arg);
6183 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6186 typedef struct LDKAccess_JCalls {
6187 atomic_size_t refcnt;
6190 jmethodID get_utxo_meth;
6192 static void LDKAccess_JCalls_free(void* this_arg) {
6193 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6194 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6196 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6197 if (get_jenv_res == JNI_EDETACHED) {
6198 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6200 DO_ASSERT(get_jenv_res == JNI_OK);
6202 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6203 if (get_jenv_res == JNI_EDETACHED) {
6204 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6209 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6210 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6212 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6213 if (get_jenv_res == JNI_EDETACHED) {
6214 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6216 DO_ASSERT(get_jenv_res == JNI_OK);
6218 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6219 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6220 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6222 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6223 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6224 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6225 if (get_jenv_res == JNI_EDETACHED) {
6226 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6230 static void* LDKAccess_JCalls_clone(const void* this_arg) {
6231 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6232 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6233 return (void*) this_arg;
6235 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6236 jclass c = (*env)->GetObjectClass(env, o);
6238 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6239 atomic_init(&calls->refcnt, 1);
6240 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6241 calls->o = (*env)->NewWeakGlobalRef(env, o);
6242 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6243 CHECK(calls->get_utxo_meth != NULL);
6246 .this_arg = (void*) calls,
6247 .get_utxo = get_utxo_LDKAccess_jcall,
6248 .free = LDKAccess_JCalls_free,
6252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6253 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6254 *res_ptr = LDKAccess_init(env, clz, o);
6255 return (uint64_t)res_ptr;
6257 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) {
6258 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6259 unsigned char genesis_hash_arr[32];
6260 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6261 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6262 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6263 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6264 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6265 return (uint64_t)ret_conv;
6268 typedef struct LDKListen_JCalls {
6269 atomic_size_t refcnt;
6272 jmethodID block_connected_meth;
6273 jmethodID block_disconnected_meth;
6275 static void LDKListen_JCalls_free(void* this_arg) {
6276 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6279 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6280 if (get_jenv_res == JNI_EDETACHED) {
6281 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6283 DO_ASSERT(get_jenv_res == JNI_OK);
6285 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6286 if (get_jenv_res == JNI_EDETACHED) {
6287 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6292 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6293 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6295 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6296 if (get_jenv_res == JNI_EDETACHED) {
6297 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6299 DO_ASSERT(get_jenv_res == JNI_OK);
6301 LDKu8slice block_var = block;
6302 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6303 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6304 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6306 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6307 if (get_jenv_res == JNI_EDETACHED) {
6308 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6311 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6312 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6315 if (get_jenv_res == JNI_EDETACHED) {
6316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6318 DO_ASSERT(get_jenv_res == JNI_OK);
6320 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6321 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6322 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6324 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6325 if (get_jenv_res == JNI_EDETACHED) {
6326 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6329 static void* LDKListen_JCalls_clone(const void* this_arg) {
6330 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6331 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6332 return (void*) this_arg;
6334 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6335 jclass c = (*env)->GetObjectClass(env, o);
6337 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6338 atomic_init(&calls->refcnt, 1);
6339 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6340 calls->o = (*env)->NewWeakGlobalRef(env, o);
6341 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6342 CHECK(calls->block_connected_meth != NULL);
6343 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6344 CHECK(calls->block_disconnected_meth != NULL);
6347 .this_arg = (void*) calls,
6348 .block_connected = block_connected_LDKListen_jcall,
6349 .block_disconnected = block_disconnected_LDKListen_jcall,
6350 .free = LDKListen_JCalls_free,
6354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6355 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6356 *res_ptr = LDKListen_init(env, clz, o);
6357 return (uint64_t)res_ptr;
6359 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) {
6360 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6361 LDKu8slice block_ref;
6362 block_ref.datalen = (*env)->GetArrayLength(env, block);
6363 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6364 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6365 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6368 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) {
6369 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6370 unsigned char header_arr[80];
6371 CHECK((*env)->GetArrayLength(env, header) == 80);
6372 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6373 unsigned char (*header_ref)[80] = &header_arr;
6374 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6377 typedef struct LDKConfirm_JCalls {
6378 atomic_size_t refcnt;
6381 jmethodID transactions_confirmed_meth;
6382 jmethodID transaction_unconfirmed_meth;
6383 jmethodID best_block_updated_meth;
6384 jmethodID get_relevant_txids_meth;
6385 } LDKConfirm_JCalls;
6386 static void LDKConfirm_JCalls_free(void* this_arg) {
6387 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6388 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6390 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6391 if (get_jenv_res == JNI_EDETACHED) {
6392 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6394 DO_ASSERT(get_jenv_res == JNI_OK);
6396 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6397 if (get_jenv_res == JNI_EDETACHED) {
6398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6403 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6404 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6406 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6407 if (get_jenv_res == JNI_EDETACHED) {
6408 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6410 DO_ASSERT(get_jenv_res == JNI_OK);
6412 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6413 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6414 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6415 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6416 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6417 for (size_t y = 0; y < txdata_var.datalen; y++) {
6418 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6419 *txdata_conv_24_ref = txdata_var.data[y];
6420 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6422 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6423 FREE(txdata_var.data);
6424 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6426 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6427 if (get_jenv_res == JNI_EDETACHED) {
6428 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6431 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6432 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6434 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6435 if (get_jenv_res == JNI_EDETACHED) {
6436 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6438 DO_ASSERT(get_jenv_res == JNI_OK);
6440 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6441 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6442 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6444 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6445 if (get_jenv_res == JNI_EDETACHED) {
6446 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6449 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6450 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6452 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6453 if (get_jenv_res == JNI_EDETACHED) {
6454 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6456 DO_ASSERT(get_jenv_res == JNI_OK);
6458 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6459 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6460 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6462 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6463 if (get_jenv_res == JNI_EDETACHED) {
6464 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6467 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6468 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6470 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6471 if (get_jenv_res == JNI_EDETACHED) {
6472 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6474 DO_ASSERT(get_jenv_res == JNI_OK);
6476 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6478 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6479 LDKCVec_TxidZ ret_constr;
6480 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6481 if (ret_constr.datalen > 0)
6482 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6484 ret_constr.data = NULL;
6485 for (size_t i = 0; i < ret_constr.datalen; i++) {
6486 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6487 LDKThirtyTwoBytes ret_conv_8_ref;
6488 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6489 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6490 ret_constr.data[i] = ret_conv_8_ref;
6492 if (get_jenv_res == JNI_EDETACHED) {
6493 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6497 static void* LDKConfirm_JCalls_clone(const void* this_arg) {
6498 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6499 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6500 return (void*) this_arg;
6502 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6503 jclass c = (*env)->GetObjectClass(env, o);
6505 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6506 atomic_init(&calls->refcnt, 1);
6507 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6508 calls->o = (*env)->NewWeakGlobalRef(env, o);
6509 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6510 CHECK(calls->transactions_confirmed_meth != NULL);
6511 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6512 CHECK(calls->transaction_unconfirmed_meth != NULL);
6513 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6514 CHECK(calls->best_block_updated_meth != NULL);
6515 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6516 CHECK(calls->get_relevant_txids_meth != NULL);
6519 .this_arg = (void*) calls,
6520 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6521 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6522 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6523 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6524 .free = LDKConfirm_JCalls_free,
6528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6529 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6530 *res_ptr = LDKConfirm_init(env, clz, o);
6531 return (uint64_t)res_ptr;
6533 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) {
6534 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6535 unsigned char header_arr[80];
6536 CHECK((*env)->GetArrayLength(env, header) == 80);
6537 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6538 unsigned char (*header_ref)[80] = &header_arr;
6539 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6540 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6541 if (txdata_constr.datalen > 0)
6542 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6544 txdata_constr.data = NULL;
6545 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6546 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6547 int64_t txdata_conv_24 = txdata_vals[y];
6548 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6549 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6550 txdata_constr.data[y] = txdata_conv_24_conv;
6552 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6553 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6557 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6558 unsigned char txid_arr[32];
6559 CHECK((*env)->GetArrayLength(env, txid) == 32);
6560 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6561 unsigned char (*txid_ref)[32] = &txid_arr;
6562 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6565 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) {
6566 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6567 unsigned char header_arr[80];
6568 CHECK((*env)->GetArrayLength(env, header) == 80);
6569 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6570 unsigned char (*header_ref)[80] = &header_arr;
6571 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6574 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6575 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6576 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6577 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6579 for (size_t i = 0; i < ret_var.datalen; i++) {
6580 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6581 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6582 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6588 typedef struct LDKFilter_JCalls {
6589 atomic_size_t refcnt;
6592 jmethodID register_tx_meth;
6593 jmethodID register_output_meth;
6595 static void LDKFilter_JCalls_free(void* this_arg) {
6596 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6597 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6599 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6600 if (get_jenv_res == JNI_EDETACHED) {
6601 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6603 DO_ASSERT(get_jenv_res == JNI_OK);
6605 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6606 if (get_jenv_res == JNI_EDETACHED) {
6607 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6612 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6613 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6615 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6616 if (get_jenv_res == JNI_EDETACHED) {
6617 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6619 DO_ASSERT(get_jenv_res == JNI_OK);
6621 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6622 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6623 LDKu8slice script_pubkey_var = script_pubkey;
6624 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6625 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6626 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6628 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6629 if (get_jenv_res == JNI_EDETACHED) {
6630 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6633 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6634 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6637 if (get_jenv_res == JNI_EDETACHED) {
6638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6640 DO_ASSERT(get_jenv_res == JNI_OK);
6642 LDKWatchedOutput output_var = output;
6643 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6644 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6645 uint64_t output_ref = (uint64_t)output_var.inner;
6646 if (output_var.is_owned) {
6649 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6651 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
6652 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
6653 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
6654 if (get_jenv_res == JNI_EDETACHED) {
6655 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6659 static void* LDKFilter_JCalls_clone(const void* this_arg) {
6660 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6661 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6662 return (void*) this_arg;
6664 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
6665 jclass c = (*env)->GetObjectClass(env, o);
6667 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
6668 atomic_init(&calls->refcnt, 1);
6669 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6670 calls->o = (*env)->NewWeakGlobalRef(env, o);
6671 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
6672 CHECK(calls->register_tx_meth != NULL);
6673 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
6674 CHECK(calls->register_output_meth != NULL);
6677 .this_arg = (void*) calls,
6678 .register_tx = register_tx_LDKFilter_jcall,
6679 .register_output = register_output_LDKFilter_jcall,
6680 .free = LDKFilter_JCalls_free,
6684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
6685 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
6686 *res_ptr = LDKFilter_init(env, clz, o);
6687 return (uint64_t)res_ptr;
6689 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) {
6690 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6691 unsigned char txid_arr[32];
6692 CHECK((*env)->GetArrayLength(env, txid) == 32);
6693 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6694 unsigned char (*txid_ref)[32] = &txid_arr;
6695 LDKu8slice script_pubkey_ref;
6696 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
6697 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
6698 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
6699 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
6702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
6703 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
6704 LDKWatchedOutput output_conv;
6705 output_conv.inner = (void*)(output & (~1));
6706 output_conv.is_owned = (output & 1) || (output == 0);
6707 output_conv = WatchedOutput_clone(&output_conv);
6708 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
6709 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
6710 uint64_t ret_ref = (uint64_t)ret_copy;
6714 typedef struct LDKPersist_JCalls {
6715 atomic_size_t refcnt;
6718 jmethodID persist_new_channel_meth;
6719 jmethodID update_persisted_channel_meth;
6720 } LDKPersist_JCalls;
6721 static void LDKPersist_JCalls_free(void* this_arg) {
6722 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6723 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
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 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6732 if (get_jenv_res == JNI_EDETACHED) {
6733 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6738 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
6739 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6741 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6742 if (get_jenv_res == JNI_EDETACHED) {
6743 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6745 DO_ASSERT(get_jenv_res == JNI_OK);
6747 LDKOutPoint id_var = id;
6748 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6749 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6750 uint64_t id_ref = (uint64_t)id_var.inner;
6751 if (id_var.is_owned) {
6754 LDKChannelMonitor data_var = *data;
6755 data_var = ChannelMonitor_clone(data);
6756 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6757 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6758 uint64_t data_ref = (uint64_t)data_var.inner;
6759 if (data_var.is_owned) {
6762 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6764 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
6765 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6766 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6767 if (get_jenv_res == JNI_EDETACHED) {
6768 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6772 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
6773 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6775 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6776 if (get_jenv_res == JNI_EDETACHED) {
6777 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6779 DO_ASSERT(get_jenv_res == JNI_OK);
6781 LDKOutPoint id_var = id;
6782 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6783 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6784 uint64_t id_ref = (uint64_t)id_var.inner;
6785 if (id_var.is_owned) {
6788 LDKChannelMonitorUpdate update_var = *update;
6789 update_var = ChannelMonitorUpdate_clone(update);
6790 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6791 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6792 uint64_t update_ref = (uint64_t)update_var.inner;
6793 if (update_var.is_owned) {
6796 LDKChannelMonitor data_var = *data;
6797 data_var = ChannelMonitor_clone(data);
6798 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6799 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6800 uint64_t data_ref = (uint64_t)data_var.inner;
6801 if (data_var.is_owned) {
6804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6806 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
6807 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
6808 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
6809 if (get_jenv_res == JNI_EDETACHED) {
6810 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6814 static void* LDKPersist_JCalls_clone(const void* this_arg) {
6815 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
6816 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6817 return (void*) this_arg;
6819 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
6820 jclass c = (*env)->GetObjectClass(env, o);
6822 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
6823 atomic_init(&calls->refcnt, 1);
6824 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6825 calls->o = (*env)->NewWeakGlobalRef(env, o);
6826 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
6827 CHECK(calls->persist_new_channel_meth != NULL);
6828 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
6829 CHECK(calls->update_persisted_channel_meth != NULL);
6832 .this_arg = (void*) calls,
6833 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
6834 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
6835 .free = LDKPersist_JCalls_free,
6839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
6840 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
6841 *res_ptr = LDKPersist_init(env, clz, o);
6842 return (uint64_t)res_ptr;
6844 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) {
6845 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6846 LDKOutPoint id_conv;
6847 id_conv.inner = (void*)(id & (~1));
6848 id_conv.is_owned = (id & 1) || (id == 0);
6849 id_conv = OutPoint_clone(&id_conv);
6850 LDKChannelMonitor data_conv;
6851 data_conv.inner = (void*)(data & (~1));
6852 data_conv.is_owned = false;
6853 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6854 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
6855 return (uint64_t)ret_conv;
6858 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) {
6859 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
6860 LDKOutPoint id_conv;
6861 id_conv.inner = (void*)(id & (~1));
6862 id_conv.is_owned = (id & 1) || (id == 0);
6863 id_conv = OutPoint_clone(&id_conv);
6864 LDKChannelMonitorUpdate update_conv;
6865 update_conv.inner = (void*)(update & (~1));
6866 update_conv.is_owned = false;
6867 LDKChannelMonitor data_conv;
6868 data_conv.inner = (void*)(data & (~1));
6869 data_conv.is_owned = false;
6870 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
6871 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
6872 return (uint64_t)ret_conv;
6875 typedef struct LDKChannelMessageHandler_JCalls {
6876 atomic_size_t refcnt;
6879 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
6880 jmethodID handle_open_channel_meth;
6881 jmethodID handle_accept_channel_meth;
6882 jmethodID handle_funding_created_meth;
6883 jmethodID handle_funding_signed_meth;
6884 jmethodID handle_funding_locked_meth;
6885 jmethodID handle_shutdown_meth;
6886 jmethodID handle_closing_signed_meth;
6887 jmethodID handle_update_add_htlc_meth;
6888 jmethodID handle_update_fulfill_htlc_meth;
6889 jmethodID handle_update_fail_htlc_meth;
6890 jmethodID handle_update_fail_malformed_htlc_meth;
6891 jmethodID handle_commitment_signed_meth;
6892 jmethodID handle_revoke_and_ack_meth;
6893 jmethodID handle_update_fee_meth;
6894 jmethodID handle_announcement_signatures_meth;
6895 jmethodID peer_disconnected_meth;
6896 jmethodID peer_connected_meth;
6897 jmethodID handle_channel_reestablish_meth;
6898 jmethodID handle_channel_update_meth;
6899 jmethodID handle_error_meth;
6900 } LDKChannelMessageHandler_JCalls;
6901 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
6902 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6903 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6905 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6906 if (get_jenv_res == JNI_EDETACHED) {
6907 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6909 DO_ASSERT(get_jenv_res == JNI_OK);
6911 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6912 if (get_jenv_res == JNI_EDETACHED) {
6913 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6918 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
6919 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6921 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6922 if (get_jenv_res == JNI_EDETACHED) {
6923 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6925 DO_ASSERT(get_jenv_res == JNI_OK);
6927 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6928 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6929 LDKInitFeatures their_features_var = their_features;
6930 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6931 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6932 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6933 if (their_features_var.is_owned) {
6934 their_features_ref |= 1;
6936 LDKOpenChannel msg_var = *msg;
6937 msg_var = OpenChannel_clone(msg);
6938 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6939 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6940 uint64_t msg_ref = (uint64_t)msg_var.inner;
6941 if (msg_var.is_owned) {
6944 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6946 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6947 if (get_jenv_res == JNI_EDETACHED) {
6948 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6951 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
6952 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6954 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6955 if (get_jenv_res == JNI_EDETACHED) {
6956 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6958 DO_ASSERT(get_jenv_res == JNI_OK);
6960 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6961 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6962 LDKInitFeatures their_features_var = their_features;
6963 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6964 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6965 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
6966 if (their_features_var.is_owned) {
6967 their_features_ref |= 1;
6969 LDKAcceptChannel msg_var = *msg;
6970 msg_var = AcceptChannel_clone(msg);
6971 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6972 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6973 uint64_t msg_ref = (uint64_t)msg_var.inner;
6974 if (msg_var.is_owned) {
6977 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6979 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
6980 if (get_jenv_res == JNI_EDETACHED) {
6981 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6984 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
6985 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
6987 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6988 if (get_jenv_res == JNI_EDETACHED) {
6989 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6991 DO_ASSERT(get_jenv_res == JNI_OK);
6993 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
6994 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
6995 LDKFundingCreated msg_var = *msg;
6996 msg_var = FundingCreated_clone(msg);
6997 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6998 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6999 uint64_t msg_ref = (uint64_t)msg_var.inner;
7000 if (msg_var.is_owned) {
7003 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7005 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7006 if (get_jenv_res == JNI_EDETACHED) {
7007 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7010 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7011 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7013 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7014 if (get_jenv_res == JNI_EDETACHED) {
7015 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7017 DO_ASSERT(get_jenv_res == JNI_OK);
7019 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7020 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7021 LDKFundingSigned msg_var = *msg;
7022 msg_var = FundingSigned_clone(msg);
7023 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7024 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7025 uint64_t msg_ref = (uint64_t)msg_var.inner;
7026 if (msg_var.is_owned) {
7029 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7031 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7032 if (get_jenv_res == JNI_EDETACHED) {
7033 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7036 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7037 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7039 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7040 if (get_jenv_res == JNI_EDETACHED) {
7041 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7043 DO_ASSERT(get_jenv_res == JNI_OK);
7045 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7046 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7047 LDKFundingLocked msg_var = *msg;
7048 msg_var = FundingLocked_clone(msg);
7049 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7050 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7051 uint64_t msg_ref = (uint64_t)msg_var.inner;
7052 if (msg_var.is_owned) {
7055 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7057 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7058 if (get_jenv_res == JNI_EDETACHED) {
7059 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7062 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7063 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7065 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7066 if (get_jenv_res == JNI_EDETACHED) {
7067 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7069 DO_ASSERT(get_jenv_res == JNI_OK);
7071 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7072 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7073 LDKInitFeatures their_features_var = *their_features;
7074 their_features_var = InitFeatures_clone(their_features);
7075 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7076 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7077 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7078 if (their_features_var.is_owned) {
7079 their_features_ref |= 1;
7081 LDKShutdown msg_var = *msg;
7082 msg_var = Shutdown_clone(msg);
7083 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7084 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7085 uint64_t msg_ref = (uint64_t)msg_var.inner;
7086 if (msg_var.is_owned) {
7089 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7091 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7092 if (get_jenv_res == JNI_EDETACHED) {
7093 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7096 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7097 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7099 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7100 if (get_jenv_res == JNI_EDETACHED) {
7101 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7103 DO_ASSERT(get_jenv_res == JNI_OK);
7105 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7106 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7107 LDKClosingSigned msg_var = *msg;
7108 msg_var = ClosingSigned_clone(msg);
7109 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7110 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7111 uint64_t msg_ref = (uint64_t)msg_var.inner;
7112 if (msg_var.is_owned) {
7115 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7117 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7118 if (get_jenv_res == JNI_EDETACHED) {
7119 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7122 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7123 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7125 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7126 if (get_jenv_res == JNI_EDETACHED) {
7127 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7129 DO_ASSERT(get_jenv_res == JNI_OK);
7131 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7132 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7133 LDKUpdateAddHTLC msg_var = *msg;
7134 msg_var = UpdateAddHTLC_clone(msg);
7135 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7136 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7137 uint64_t msg_ref = (uint64_t)msg_var.inner;
7138 if (msg_var.is_owned) {
7141 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7143 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7144 if (get_jenv_res == JNI_EDETACHED) {
7145 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7148 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7149 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7151 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7152 if (get_jenv_res == JNI_EDETACHED) {
7153 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7155 DO_ASSERT(get_jenv_res == JNI_OK);
7157 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7158 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7159 LDKUpdateFulfillHTLC msg_var = *msg;
7160 msg_var = UpdateFulfillHTLC_clone(msg);
7161 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7162 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7163 uint64_t msg_ref = (uint64_t)msg_var.inner;
7164 if (msg_var.is_owned) {
7167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7169 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7170 if (get_jenv_res == JNI_EDETACHED) {
7171 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7174 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7175 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7177 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7178 if (get_jenv_res == JNI_EDETACHED) {
7179 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7181 DO_ASSERT(get_jenv_res == JNI_OK);
7183 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7184 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7185 LDKUpdateFailHTLC msg_var = *msg;
7186 msg_var = UpdateFailHTLC_clone(msg);
7187 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7188 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7189 uint64_t msg_ref = (uint64_t)msg_var.inner;
7190 if (msg_var.is_owned) {
7193 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7195 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7196 if (get_jenv_res == JNI_EDETACHED) {
7197 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7200 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7201 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7203 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7204 if (get_jenv_res == JNI_EDETACHED) {
7205 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7207 DO_ASSERT(get_jenv_res == JNI_OK);
7209 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7210 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7211 LDKUpdateFailMalformedHTLC msg_var = *msg;
7212 msg_var = UpdateFailMalformedHTLC_clone(msg);
7213 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7214 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7215 uint64_t msg_ref = (uint64_t)msg_var.inner;
7216 if (msg_var.is_owned) {
7219 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7221 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7222 if (get_jenv_res == JNI_EDETACHED) {
7223 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7226 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7227 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7229 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7230 if (get_jenv_res == JNI_EDETACHED) {
7231 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7233 DO_ASSERT(get_jenv_res == JNI_OK);
7235 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7236 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7237 LDKCommitmentSigned msg_var = *msg;
7238 msg_var = CommitmentSigned_clone(msg);
7239 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7240 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7241 uint64_t msg_ref = (uint64_t)msg_var.inner;
7242 if (msg_var.is_owned) {
7245 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7247 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7248 if (get_jenv_res == JNI_EDETACHED) {
7249 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7252 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7253 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7255 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7256 if (get_jenv_res == JNI_EDETACHED) {
7257 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7259 DO_ASSERT(get_jenv_res == JNI_OK);
7261 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7262 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7263 LDKRevokeAndACK msg_var = *msg;
7264 msg_var = RevokeAndACK_clone(msg);
7265 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7266 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7267 uint64_t msg_ref = (uint64_t)msg_var.inner;
7268 if (msg_var.is_owned) {
7271 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7273 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7274 if (get_jenv_res == JNI_EDETACHED) {
7275 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7278 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7279 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7281 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7282 if (get_jenv_res == JNI_EDETACHED) {
7283 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7285 DO_ASSERT(get_jenv_res == JNI_OK);
7287 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7288 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7289 LDKUpdateFee msg_var = *msg;
7290 msg_var = UpdateFee_clone(msg);
7291 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7292 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7293 uint64_t msg_ref = (uint64_t)msg_var.inner;
7294 if (msg_var.is_owned) {
7297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7299 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7300 if (get_jenv_res == JNI_EDETACHED) {
7301 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7304 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7305 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7307 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7308 if (get_jenv_res == JNI_EDETACHED) {
7309 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7311 DO_ASSERT(get_jenv_res == JNI_OK);
7313 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7314 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7315 LDKAnnouncementSignatures msg_var = *msg;
7316 msg_var = AnnouncementSignatures_clone(msg);
7317 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7318 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7319 uint64_t msg_ref = (uint64_t)msg_var.inner;
7320 if (msg_var.is_owned) {
7323 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7325 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7326 if (get_jenv_res == JNI_EDETACHED) {
7327 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7330 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7331 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7333 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7334 if (get_jenv_res == JNI_EDETACHED) {
7335 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7337 DO_ASSERT(get_jenv_res == JNI_OK);
7339 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7340 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7341 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7343 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7344 if (get_jenv_res == JNI_EDETACHED) {
7345 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7348 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7349 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7351 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7352 if (get_jenv_res == JNI_EDETACHED) {
7353 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7355 DO_ASSERT(get_jenv_res == JNI_OK);
7357 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7358 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7359 LDKInit msg_var = *msg;
7360 msg_var = Init_clone(msg);
7361 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7362 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7363 uint64_t msg_ref = (uint64_t)msg_var.inner;
7364 if (msg_var.is_owned) {
7367 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7369 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7370 if (get_jenv_res == JNI_EDETACHED) {
7371 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7374 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7375 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7377 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7378 if (get_jenv_res == JNI_EDETACHED) {
7379 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7381 DO_ASSERT(get_jenv_res == JNI_OK);
7383 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7384 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7385 LDKChannelReestablish msg_var = *msg;
7386 msg_var = ChannelReestablish_clone(msg);
7387 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7388 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7389 uint64_t msg_ref = (uint64_t)msg_var.inner;
7390 if (msg_var.is_owned) {
7393 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7395 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7396 if (get_jenv_res == JNI_EDETACHED) {
7397 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7400 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * 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 LDKChannelUpdate msg_var = *msg;
7412 msg_var = ChannelUpdate_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_channel_update_meth, their_node_id_arr, msg_ref);
7422 if (get_jenv_res == JNI_EDETACHED) {
7423 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7426 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7427 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7429 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7430 if (get_jenv_res == JNI_EDETACHED) {
7431 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7433 DO_ASSERT(get_jenv_res == JNI_OK);
7435 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7436 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7437 LDKErrorMessage msg_var = *msg;
7438 msg_var = ErrorMessage_clone(msg);
7439 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7440 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7441 uint64_t msg_ref = (uint64_t)msg_var.inner;
7442 if (msg_var.is_owned) {
7445 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7447 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7448 if (get_jenv_res == JNI_EDETACHED) {
7449 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7452 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
7453 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7454 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7455 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7456 return (void*) this_arg;
7458 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7459 jclass c = (*env)->GetObjectClass(env, o);
7461 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7462 atomic_init(&calls->refcnt, 1);
7463 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7464 calls->o = (*env)->NewWeakGlobalRef(env, o);
7465 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7466 CHECK(calls->handle_open_channel_meth != NULL);
7467 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7468 CHECK(calls->handle_accept_channel_meth != NULL);
7469 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7470 CHECK(calls->handle_funding_created_meth != NULL);
7471 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7472 CHECK(calls->handle_funding_signed_meth != NULL);
7473 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7474 CHECK(calls->handle_funding_locked_meth != NULL);
7475 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7476 CHECK(calls->handle_shutdown_meth != NULL);
7477 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7478 CHECK(calls->handle_closing_signed_meth != NULL);
7479 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7480 CHECK(calls->handle_update_add_htlc_meth != NULL);
7481 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7482 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7483 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7484 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7485 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7486 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7487 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7488 CHECK(calls->handle_commitment_signed_meth != NULL);
7489 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7490 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7491 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7492 CHECK(calls->handle_update_fee_meth != NULL);
7493 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7494 CHECK(calls->handle_announcement_signatures_meth != NULL);
7495 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7496 CHECK(calls->peer_disconnected_meth != NULL);
7497 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7498 CHECK(calls->peer_connected_meth != NULL);
7499 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7500 CHECK(calls->handle_channel_reestablish_meth != NULL);
7501 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7502 CHECK(calls->handle_channel_update_meth != NULL);
7503 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7504 CHECK(calls->handle_error_meth != NULL);
7506 LDKChannelMessageHandler ret = {
7507 .this_arg = (void*) calls,
7508 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7509 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7510 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7511 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7512 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7513 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7514 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7515 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7516 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7517 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7518 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7519 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7520 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7521 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7522 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7523 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7524 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7525 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7526 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7527 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7528 .free = LDKChannelMessageHandler_JCalls_free,
7529 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7531 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7535 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7536 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7537 return (uint64_t)res_ptr;
7539 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) {
7540 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7541 LDKPublicKey their_node_id_ref;
7542 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7543 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7544 LDKInitFeatures their_features_conv;
7545 their_features_conv.inner = (void*)(their_features & (~1));
7546 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7547 their_features_conv = InitFeatures_clone(&their_features_conv);
7548 LDKOpenChannel msg_conv;
7549 msg_conv.inner = (void*)(msg & (~1));
7550 msg_conv.is_owned = false;
7551 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7554 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) {
7555 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7556 LDKPublicKey their_node_id_ref;
7557 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7558 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7559 LDKInitFeatures their_features_conv;
7560 their_features_conv.inner = (void*)(their_features & (~1));
7561 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7562 their_features_conv = InitFeatures_clone(&their_features_conv);
7563 LDKAcceptChannel msg_conv;
7564 msg_conv.inner = (void*)(msg & (~1));
7565 msg_conv.is_owned = false;
7566 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
7569 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) {
7570 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7571 LDKPublicKey their_node_id_ref;
7572 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7573 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7574 LDKFundingCreated msg_conv;
7575 msg_conv.inner = (void*)(msg & (~1));
7576 msg_conv.is_owned = false;
7577 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7580 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) {
7581 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7582 LDKPublicKey their_node_id_ref;
7583 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7584 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7585 LDKFundingSigned msg_conv;
7586 msg_conv.inner = (void*)(msg & (~1));
7587 msg_conv.is_owned = false;
7588 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7591 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) {
7592 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7593 LDKPublicKey their_node_id_ref;
7594 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7595 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7596 LDKFundingLocked msg_conv;
7597 msg_conv.inner = (void*)(msg & (~1));
7598 msg_conv.is_owned = false;
7599 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7602 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) {
7603 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7604 LDKPublicKey their_node_id_ref;
7605 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7606 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7607 LDKInitFeatures their_features_conv;
7608 their_features_conv.inner = (void*)(their_features & (~1));
7609 their_features_conv.is_owned = false;
7610 LDKShutdown msg_conv;
7611 msg_conv.inner = (void*)(msg & (~1));
7612 msg_conv.is_owned = false;
7613 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
7616 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) {
7617 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7618 LDKPublicKey their_node_id_ref;
7619 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7620 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7621 LDKClosingSigned msg_conv;
7622 msg_conv.inner = (void*)(msg & (~1));
7623 msg_conv.is_owned = false;
7624 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7627 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) {
7628 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7629 LDKPublicKey their_node_id_ref;
7630 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7631 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7632 LDKUpdateAddHTLC msg_conv;
7633 msg_conv.inner = (void*)(msg & (~1));
7634 msg_conv.is_owned = false;
7635 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7638 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) {
7639 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7640 LDKPublicKey their_node_id_ref;
7641 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7642 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7643 LDKUpdateFulfillHTLC msg_conv;
7644 msg_conv.inner = (void*)(msg & (~1));
7645 msg_conv.is_owned = false;
7646 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7649 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) {
7650 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7651 LDKPublicKey their_node_id_ref;
7652 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7653 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7654 LDKUpdateFailHTLC msg_conv;
7655 msg_conv.inner = (void*)(msg & (~1));
7656 msg_conv.is_owned = false;
7657 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7660 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) {
7661 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7662 LDKPublicKey their_node_id_ref;
7663 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7664 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7665 LDKUpdateFailMalformedHTLC msg_conv;
7666 msg_conv.inner = (void*)(msg & (~1));
7667 msg_conv.is_owned = false;
7668 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7671 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) {
7672 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7673 LDKPublicKey their_node_id_ref;
7674 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7675 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7676 LDKCommitmentSigned msg_conv;
7677 msg_conv.inner = (void*)(msg & (~1));
7678 msg_conv.is_owned = false;
7679 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7682 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) {
7683 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7684 LDKPublicKey their_node_id_ref;
7685 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7686 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7687 LDKRevokeAndACK msg_conv;
7688 msg_conv.inner = (void*)(msg & (~1));
7689 msg_conv.is_owned = false;
7690 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7693 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) {
7694 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7695 LDKPublicKey their_node_id_ref;
7696 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7697 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7698 LDKUpdateFee msg_conv;
7699 msg_conv.inner = (void*)(msg & (~1));
7700 msg_conv.is_owned = false;
7701 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7704 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) {
7705 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7706 LDKPublicKey their_node_id_ref;
7707 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7708 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7709 LDKAnnouncementSignatures msg_conv;
7710 msg_conv.inner = (void*)(msg & (~1));
7711 msg_conv.is_owned = false;
7712 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7715 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) {
7716 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7717 LDKPublicKey their_node_id_ref;
7718 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7719 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7720 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
7723 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) {
7724 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7725 LDKPublicKey their_node_id_ref;
7726 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7727 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7729 msg_conv.inner = (void*)(msg & (~1));
7730 msg_conv.is_owned = false;
7731 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7734 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) {
7735 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7736 LDKPublicKey their_node_id_ref;
7737 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7738 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7739 LDKChannelReestablish msg_conv;
7740 msg_conv.inner = (void*)(msg & (~1));
7741 msg_conv.is_owned = false;
7742 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7745 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) {
7746 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7747 LDKPublicKey their_node_id_ref;
7748 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7749 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7750 LDKChannelUpdate msg_conv;
7751 msg_conv.inner = (void*)(msg & (~1));
7752 msg_conv.is_owned = false;
7753 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7756 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) {
7757 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7758 LDKPublicKey their_node_id_ref;
7759 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7760 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7761 LDKErrorMessage msg_conv;
7762 msg_conv.inner = (void*)(msg & (~1));
7763 msg_conv.is_owned = false;
7764 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
7767 typedef struct LDKRoutingMessageHandler_JCalls {
7768 atomic_size_t refcnt;
7771 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7772 jmethodID handle_node_announcement_meth;
7773 jmethodID handle_channel_announcement_meth;
7774 jmethodID handle_channel_update_meth;
7775 jmethodID handle_htlc_fail_channel_update_meth;
7776 jmethodID get_next_channel_announcements_meth;
7777 jmethodID get_next_node_announcements_meth;
7778 jmethodID sync_routing_table_meth;
7779 jmethodID handle_reply_channel_range_meth;
7780 jmethodID handle_reply_short_channel_ids_end_meth;
7781 jmethodID handle_query_channel_range_meth;
7782 jmethodID handle_query_short_channel_ids_meth;
7783 } LDKRoutingMessageHandler_JCalls;
7784 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
7785 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7786 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7788 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7789 if (get_jenv_res == JNI_EDETACHED) {
7790 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7792 DO_ASSERT(get_jenv_res == JNI_OK);
7794 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7795 if (get_jenv_res == JNI_EDETACHED) {
7796 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7801 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
7802 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7804 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7805 if (get_jenv_res == JNI_EDETACHED) {
7806 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7808 DO_ASSERT(get_jenv_res == JNI_OK);
7810 LDKNodeAnnouncement msg_var = *msg;
7811 msg_var = NodeAnnouncement_clone(msg);
7812 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7813 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7814 uint64_t msg_ref = (uint64_t)msg_var.inner;
7815 if (msg_var.is_owned) {
7818 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7820 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
7821 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7822 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7823 if (get_jenv_res == JNI_EDETACHED) {
7824 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7828 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
7829 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7831 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7832 if (get_jenv_res == JNI_EDETACHED) {
7833 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7835 DO_ASSERT(get_jenv_res == JNI_OK);
7837 LDKChannelAnnouncement msg_var = *msg;
7838 msg_var = ChannelAnnouncement_clone(msg);
7839 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7840 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7841 uint64_t msg_ref = (uint64_t)msg_var.inner;
7842 if (msg_var.is_owned) {
7845 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7847 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
7848 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7849 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7850 if (get_jenv_res == JNI_EDETACHED) {
7851 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7855 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
7856 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7858 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7859 if (get_jenv_res == JNI_EDETACHED) {
7860 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7862 DO_ASSERT(get_jenv_res == JNI_OK);
7864 LDKChannelUpdate msg_var = *msg;
7865 msg_var = ChannelUpdate_clone(msg);
7866 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7867 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7868 uint64_t msg_ref = (uint64_t)msg_var.inner;
7869 if (msg_var.is_owned) {
7872 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7874 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
7875 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
7876 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
7877 if (get_jenv_res == JNI_EDETACHED) {
7878 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7882 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
7883 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7885 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7886 if (get_jenv_res == JNI_EDETACHED) {
7887 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7889 DO_ASSERT(get_jenv_res == JNI_OK);
7891 uint64_t ret_update = (uint64_t)update;
7892 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7894 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
7895 if (get_jenv_res == JNI_EDETACHED) {
7896 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7899 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
7900 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7903 if (get_jenv_res == JNI_EDETACHED) {
7904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7906 DO_ASSERT(get_jenv_res == JNI_OK);
7908 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7910 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
7911 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
7912 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7913 if (ret_constr.datalen > 0)
7914 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
7916 ret_constr.data = NULL;
7917 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7918 for (size_t l = 0; l < ret_constr.datalen; l++) {
7919 int64_t ret_conv_63 = ret_vals[l];
7920 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
7921 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
7922 ret_constr.data[l] = ret_conv_63_conv;
7924 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7925 if (get_jenv_res == JNI_EDETACHED) {
7926 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7930 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
7931 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7933 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7934 if (get_jenv_res == JNI_EDETACHED) {
7935 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7937 DO_ASSERT(get_jenv_res == JNI_OK);
7939 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
7940 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
7941 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7943 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
7944 LDKCVec_NodeAnnouncementZ ret_constr;
7945 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
7946 if (ret_constr.datalen > 0)
7947 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
7949 ret_constr.data = NULL;
7950 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
7951 for (size_t s = 0; s < ret_constr.datalen; s++) {
7952 int64_t ret_conv_18 = ret_vals[s];
7953 LDKNodeAnnouncement ret_conv_18_conv;
7954 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
7955 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
7956 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
7957 ret_constr.data[s] = ret_conv_18_conv;
7959 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
7960 if (get_jenv_res == JNI_EDETACHED) {
7961 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7965 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
7966 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7968 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7969 if (get_jenv_res == JNI_EDETACHED) {
7970 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7972 DO_ASSERT(get_jenv_res == JNI_OK);
7974 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7975 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7976 LDKInit init_var = *init;
7977 init_var = Init_clone(init);
7978 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7979 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7980 uint64_t init_ref = (uint64_t)init_var.inner;
7981 if (init_var.is_owned) {
7984 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7986 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
7987 if (get_jenv_res == JNI_EDETACHED) {
7988 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7991 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
7992 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
7994 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7995 if (get_jenv_res == JNI_EDETACHED) {
7996 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7998 DO_ASSERT(get_jenv_res == JNI_OK);
8000 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8001 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8002 LDKReplyChannelRange msg_var = msg;
8003 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8004 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8005 uint64_t msg_ref = (uint64_t)msg_var.inner;
8006 if (msg_var.is_owned) {
8009 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8011 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8012 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8013 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8014 if (get_jenv_res == JNI_EDETACHED) {
8015 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8019 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8020 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8022 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8023 if (get_jenv_res == JNI_EDETACHED) {
8024 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8026 DO_ASSERT(get_jenv_res == JNI_OK);
8028 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8029 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8030 LDKReplyShortChannelIdsEnd msg_var = msg;
8031 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8032 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8033 uint64_t msg_ref = (uint64_t)msg_var.inner;
8034 if (msg_var.is_owned) {
8037 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8039 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8040 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8041 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8042 if (get_jenv_res == JNI_EDETACHED) {
8043 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8047 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8048 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8050 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8051 if (get_jenv_res == JNI_EDETACHED) {
8052 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8054 DO_ASSERT(get_jenv_res == JNI_OK);
8056 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8057 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8058 LDKQueryChannelRange msg_var = msg;
8059 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8060 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8061 uint64_t msg_ref = (uint64_t)msg_var.inner;
8062 if (msg_var.is_owned) {
8065 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8067 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8068 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8069 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8070 if (get_jenv_res == JNI_EDETACHED) {
8071 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8075 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8076 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8078 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8079 if (get_jenv_res == JNI_EDETACHED) {
8080 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8082 DO_ASSERT(get_jenv_res == JNI_OK);
8084 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8085 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8086 LDKQueryShortChannelIds msg_var = msg;
8087 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8088 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8089 uint64_t msg_ref = (uint64_t)msg_var.inner;
8090 if (msg_var.is_owned) {
8093 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8095 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8096 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8097 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8098 if (get_jenv_res == JNI_EDETACHED) {
8099 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8103 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
8104 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8105 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8106 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8107 return (void*) this_arg;
8109 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8110 jclass c = (*env)->GetObjectClass(env, o);
8112 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8113 atomic_init(&calls->refcnt, 1);
8114 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8115 calls->o = (*env)->NewWeakGlobalRef(env, o);
8116 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8117 CHECK(calls->handle_node_announcement_meth != NULL);
8118 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8119 CHECK(calls->handle_channel_announcement_meth != NULL);
8120 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8121 CHECK(calls->handle_channel_update_meth != NULL);
8122 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8123 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8124 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8125 CHECK(calls->get_next_channel_announcements_meth != NULL);
8126 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8127 CHECK(calls->get_next_node_announcements_meth != NULL);
8128 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8129 CHECK(calls->sync_routing_table_meth != NULL);
8130 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8131 CHECK(calls->handle_reply_channel_range_meth != NULL);
8132 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8133 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8134 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8135 CHECK(calls->handle_query_channel_range_meth != NULL);
8136 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8137 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8139 LDKRoutingMessageHandler ret = {
8140 .this_arg = (void*) calls,
8141 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8142 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8143 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8144 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8145 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8146 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8147 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8148 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8149 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8150 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8151 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8152 .free = LDKRoutingMessageHandler_JCalls_free,
8153 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8155 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8159 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8160 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8161 return (uint64_t)res_ptr;
8163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8164 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8165 LDKNodeAnnouncement msg_conv;
8166 msg_conv.inner = (void*)(msg & (~1));
8167 msg_conv.is_owned = false;
8168 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8169 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8170 return (uint64_t)ret_conv;
8173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8174 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8175 LDKChannelAnnouncement msg_conv;
8176 msg_conv.inner = (void*)(msg & (~1));
8177 msg_conv.is_owned = false;
8178 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8179 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8180 return (uint64_t)ret_conv;
8183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8184 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8185 LDKChannelUpdate msg_conv;
8186 msg_conv.inner = (void*)(msg & (~1));
8187 msg_conv.is_owned = false;
8188 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8189 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8190 return (uint64_t)ret_conv;
8193 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) {
8194 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8195 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8196 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8199 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) {
8200 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8201 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8202 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8203 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8204 for (size_t l = 0; l < ret_var.datalen; l++) {
8205 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8206 *ret_conv_63_ref = ret_var.data[l];
8207 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8209 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8214 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) {
8215 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8216 LDKPublicKey starting_point_ref;
8217 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8218 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8219 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8220 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8221 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8222 for (size_t s = 0; s < ret_var.datalen; s++) {
8223 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8224 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8225 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8226 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8227 if (ret_conv_18_var.is_owned) {
8228 ret_conv_18_ref |= 1;
8230 ret_arr_ptr[s] = ret_conv_18_ref;
8232 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8237 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) {
8238 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8239 LDKPublicKey their_node_id_ref;
8240 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8241 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8243 init_conv.inner = (void*)(init & (~1));
8244 init_conv.is_owned = false;
8245 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8248 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) {
8249 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8250 LDKPublicKey their_node_id_ref;
8251 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8252 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8253 LDKReplyChannelRange msg_conv;
8254 msg_conv.inner = (void*)(msg & (~1));
8255 msg_conv.is_owned = (msg & 1) || (msg == 0);
8256 msg_conv = ReplyChannelRange_clone(&msg_conv);
8257 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8258 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8259 return (uint64_t)ret_conv;
8262 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) {
8263 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8264 LDKPublicKey their_node_id_ref;
8265 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8266 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8267 LDKReplyShortChannelIdsEnd msg_conv;
8268 msg_conv.inner = (void*)(msg & (~1));
8269 msg_conv.is_owned = (msg & 1) || (msg == 0);
8270 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8271 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8272 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8273 return (uint64_t)ret_conv;
8276 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) {
8277 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8278 LDKPublicKey their_node_id_ref;
8279 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8280 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8281 LDKQueryChannelRange msg_conv;
8282 msg_conv.inner = (void*)(msg & (~1));
8283 msg_conv.is_owned = (msg & 1) || (msg == 0);
8284 msg_conv = QueryChannelRange_clone(&msg_conv);
8285 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8286 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8287 return (uint64_t)ret_conv;
8290 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) {
8291 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8292 LDKPublicKey their_node_id_ref;
8293 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8294 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8295 LDKQueryShortChannelIds msg_conv;
8296 msg_conv.inner = (void*)(msg & (~1));
8297 msg_conv.is_owned = (msg & 1) || (msg == 0);
8298 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8299 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8300 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8301 return (uint64_t)ret_conv;
8304 typedef struct LDKSocketDescriptor_JCalls {
8305 atomic_size_t refcnt;
8308 jmethodID send_data_meth;
8309 jmethodID disconnect_socket_meth;
8311 jmethodID hash_meth;
8312 } LDKSocketDescriptor_JCalls;
8313 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8314 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8315 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8317 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8318 if (get_jenv_res == JNI_EDETACHED) {
8319 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8321 DO_ASSERT(get_jenv_res == JNI_OK);
8323 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8324 if (get_jenv_res == JNI_EDETACHED) {
8325 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8330 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8331 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8333 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8334 if (get_jenv_res == JNI_EDETACHED) {
8335 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8337 DO_ASSERT(get_jenv_res == JNI_OK);
8339 LDKu8slice data_var = data;
8340 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8341 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8342 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8344 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8345 if (get_jenv_res == JNI_EDETACHED) {
8346 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8350 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8351 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8353 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8354 if (get_jenv_res == JNI_EDETACHED) {
8355 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8357 DO_ASSERT(get_jenv_res == JNI_OK);
8359 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8361 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8362 if (get_jenv_res == JNI_EDETACHED) {
8363 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8366 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8367 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8369 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8370 if (get_jenv_res == JNI_EDETACHED) {
8371 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8373 DO_ASSERT(get_jenv_res == JNI_OK);
8375 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8376 *other_arg_clone = SocketDescriptor_clone(other_arg);
8377 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8379 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8380 if (get_jenv_res == JNI_EDETACHED) {
8381 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8385 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8386 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8389 if (get_jenv_res == JNI_EDETACHED) {
8390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8392 DO_ASSERT(get_jenv_res == JNI_OK);
8394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8396 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8397 if (get_jenv_res == JNI_EDETACHED) {
8398 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8402 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
8403 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8404 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8405 return (void*) this_arg;
8407 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8408 jclass c = (*env)->GetObjectClass(env, o);
8410 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8411 atomic_init(&calls->refcnt, 1);
8412 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8413 calls->o = (*env)->NewWeakGlobalRef(env, o);
8414 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8415 CHECK(calls->send_data_meth != NULL);
8416 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8417 CHECK(calls->disconnect_socket_meth != NULL);
8418 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8419 CHECK(calls->eq_meth != NULL);
8420 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8421 CHECK(calls->hash_meth != NULL);
8423 LDKSocketDescriptor ret = {
8424 .this_arg = (void*) calls,
8425 .send_data = send_data_LDKSocketDescriptor_jcall,
8426 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8427 .eq = eq_LDKSocketDescriptor_jcall,
8428 .hash = hash_LDKSocketDescriptor_jcall,
8429 .clone = LDKSocketDescriptor_JCalls_clone,
8430 .free = LDKSocketDescriptor_JCalls_free,
8434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8435 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8436 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8437 return (uint64_t)res_ptr;
8439 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) {
8440 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8441 LDKu8slice data_ref;
8442 data_ref.datalen = (*env)->GetArrayLength(env, data);
8443 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8444 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8445 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8450 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8451 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8455 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8456 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8460 typedef struct LDKChannelManagerPersister_JCalls {
8461 atomic_size_t refcnt;
8464 jmethodID persist_manager_meth;
8465 } LDKChannelManagerPersister_JCalls;
8466 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8467 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8468 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8470 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8471 if (get_jenv_res == JNI_EDETACHED) {
8472 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8474 DO_ASSERT(get_jenv_res == JNI_OK);
8476 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8477 if (get_jenv_res == JNI_EDETACHED) {
8478 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8483 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8484 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8486 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8487 if (get_jenv_res == JNI_EDETACHED) {
8488 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8490 DO_ASSERT(get_jenv_res == JNI_OK);
8492 LDKChannelManager channel_manager_var = *channel_manager;
8493 // Warning: we may need a move here but no clone is available for LDKChannelManager
8494 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8495 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8496 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
8497 if (channel_manager_var.is_owned) {
8498 channel_manager_ref |= 1;
8500 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8502 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
8503 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
8504 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
8505 if (get_jenv_res == JNI_EDETACHED) {
8506 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8510 static void* LDKChannelManagerPersister_JCalls_clone(const void* this_arg) {
8511 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8512 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8513 return (void*) this_arg;
8515 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
8516 jclass c = (*env)->GetObjectClass(env, o);
8518 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
8519 atomic_init(&calls->refcnt, 1);
8520 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8521 calls->o = (*env)->NewWeakGlobalRef(env, o);
8522 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
8523 CHECK(calls->persist_manager_meth != NULL);
8525 LDKChannelManagerPersister ret = {
8526 .this_arg = (void*) calls,
8527 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
8528 .free = LDKChannelManagerPersister_JCalls_free,
8532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
8533 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
8534 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
8535 return (uint64_t)res_ptr;
8537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
8538 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
8539 LDKChannelManager channel_manager_conv;
8540 channel_manager_conv.inner = (void*)(channel_manager & (~1));
8541 channel_manager_conv.is_owned = false;
8542 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8543 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8544 return (uint64_t)ret_conv;
8547 static jclass LDKFallback_SegWitProgram_class = NULL;
8548 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
8549 static jclass LDKFallback_PubKeyHash_class = NULL;
8550 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
8551 static jclass LDKFallback_ScriptHash_class = NULL;
8552 static jmethodID LDKFallback_ScriptHash_meth = NULL;
8553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
8554 LDKFallback_SegWitProgram_class =
8555 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
8556 CHECK(LDKFallback_SegWitProgram_class != NULL);
8557 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
8558 CHECK(LDKFallback_SegWitProgram_meth != NULL);
8559 LDKFallback_PubKeyHash_class =
8560 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
8561 CHECK(LDKFallback_PubKeyHash_class != NULL);
8562 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
8563 CHECK(LDKFallback_PubKeyHash_meth != NULL);
8564 LDKFallback_ScriptHash_class =
8565 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
8566 CHECK(LDKFallback_ScriptHash_class != NULL);
8567 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
8568 CHECK(LDKFallback_ScriptHash_meth != NULL);
8570 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8571 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
8573 case LDKFallback_SegWitProgram: {
8574 uint8_t version_val = obj->seg_wit_program.version._0;
8575 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
8576 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
8577 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
8578 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
8580 case LDKFallback_PubKeyHash: {
8581 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
8582 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
8583 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
8585 case LDKFallback_ScriptHash: {
8586 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
8587 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
8588 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
8593 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8594 LDKStr ret_str = _ldk_get_compiled_version();
8595 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8599 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
8600 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
8601 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
8605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
8606 LDKTransaction _res_ref;
8607 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
8608 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
8609 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
8610 _res_ref.data_is_owned = true;
8611 Transaction_free(_res_ref);
8614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
8615 if ((_res & 1) != 0) return;
8616 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
8618 TxOut_free(_res_conv);
8621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8622 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
8623 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8624 *ret_ref = TxOut_clone(orig_conv);
8625 return (uint64_t)ret_ref;
8628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
8629 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
8633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8635 CHECK((*env)->GetArrayLength(env, o) == 32);
8636 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
8637 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8638 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
8639 return (uint64_t)ret_conv;
8642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8643 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8644 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
8645 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
8646 return (uint64_t)ret_conv;
8649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8650 if ((_res & 1) != 0) return;
8651 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
8653 CResult_SecretKeyErrorZ_free(_res_conv);
8656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
8658 CHECK((*env)->GetArrayLength(env, o) == 33);
8659 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
8660 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8661 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
8662 return (uint64_t)ret_conv;
8665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8666 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8667 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8668 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
8669 return (uint64_t)ret_conv;
8672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8673 if ((_res & 1) != 0) return;
8674 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
8676 CResult_PublicKeyErrorZ_free(_res_conv);
8679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8680 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
8681 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
8682 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
8683 return (uint64_t)ret_conv;
8686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8687 LDKTxCreationKeys o_conv;
8688 o_conv.inner = (void*)(o & (~1));
8689 o_conv.is_owned = (o & 1) || (o == 0);
8690 o_conv = TxCreationKeys_clone(&o_conv);
8691 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8692 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
8693 return (uint64_t)ret_conv;
8696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8697 LDKDecodeError e_conv;
8698 e_conv.inner = (void*)(e & (~1));
8699 e_conv.is_owned = (e & 1) || (e == 0);
8700 e_conv = DecodeError_clone(&e_conv);
8701 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8702 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
8703 return (uint64_t)ret_conv;
8706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8707 if ((_res & 1) != 0) return;
8708 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8710 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
8713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8714 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
8715 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
8716 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
8717 return (uint64_t)ret_conv;
8720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8721 LDKChannelPublicKeys o_conv;
8722 o_conv.inner = (void*)(o & (~1));
8723 o_conv.is_owned = (o & 1) || (o == 0);
8724 o_conv = ChannelPublicKeys_clone(&o_conv);
8725 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8726 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
8727 return (uint64_t)ret_conv;
8730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8731 LDKDecodeError e_conv;
8732 e_conv.inner = (void*)(e & (~1));
8733 e_conv.is_owned = (e & 1) || (e == 0);
8734 e_conv = DecodeError_clone(&e_conv);
8735 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8736 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
8737 return (uint64_t)ret_conv;
8740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8741 if ((_res & 1) != 0) return;
8742 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
8744 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
8747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8748 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
8749 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
8750 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
8751 return (uint64_t)ret_conv;
8754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8755 LDKTxCreationKeys o_conv;
8756 o_conv.inner = (void*)(o & (~1));
8757 o_conv.is_owned = (o & 1) || (o == 0);
8758 o_conv = TxCreationKeys_clone(&o_conv);
8759 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8760 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
8761 return (uint64_t)ret_conv;
8764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
8765 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
8766 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8767 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
8768 return (uint64_t)ret_conv;
8771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8772 if ((_res & 1) != 0) return;
8773 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
8775 CResult_TxCreationKeysErrorZ_free(_res_conv);
8778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8779 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
8780 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
8781 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
8782 return (uint64_t)ret_conv;
8785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
8786 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8787 *ret_copy = COption_u32Z_some(o);
8788 uint64_t ret_ref = (uint64_t)ret_copy;
8792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
8793 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8794 *ret_copy = COption_u32Z_none();
8795 uint64_t ret_ref = (uint64_t)ret_copy;
8799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
8800 if ((_res & 1) != 0) return;
8801 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
8803 COption_u32Z_free(_res_conv);
8806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8807 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
8808 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
8809 *ret_copy = COption_u32Z_clone(orig_conv);
8810 uint64_t ret_ref = (uint64_t)ret_copy;
8814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8815 LDKHTLCOutputInCommitment o_conv;
8816 o_conv.inner = (void*)(o & (~1));
8817 o_conv.is_owned = (o & 1) || (o == 0);
8818 o_conv = HTLCOutputInCommitment_clone(&o_conv);
8819 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8820 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
8821 return (uint64_t)ret_conv;
8824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8825 LDKDecodeError e_conv;
8826 e_conv.inner = (void*)(e & (~1));
8827 e_conv.is_owned = (e & 1) || (e == 0);
8828 e_conv = DecodeError_clone(&e_conv);
8829 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8830 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
8831 return (uint64_t)ret_conv;
8834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8835 if ((_res & 1) != 0) return;
8836 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
8838 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
8841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8842 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
8843 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
8844 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
8845 return (uint64_t)ret_conv;
8848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8849 LDKCounterpartyChannelTransactionParameters o_conv;
8850 o_conv.inner = (void*)(o & (~1));
8851 o_conv.is_owned = (o & 1) || (o == 0);
8852 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
8853 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8854 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8855 return (uint64_t)ret_conv;
8858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8859 LDKDecodeError e_conv;
8860 e_conv.inner = (void*)(e & (~1));
8861 e_conv.is_owned = (e & 1) || (e == 0);
8862 e_conv = DecodeError_clone(&e_conv);
8863 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8864 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
8865 return (uint64_t)ret_conv;
8868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8869 if ((_res & 1) != 0) return;
8870 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8872 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8876 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8877 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
8878 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8879 return (uint64_t)ret_conv;
8882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8883 LDKChannelTransactionParameters o_conv;
8884 o_conv.inner = (void*)(o & (~1));
8885 o_conv.is_owned = (o & 1) || (o == 0);
8886 o_conv = ChannelTransactionParameters_clone(&o_conv);
8887 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8888 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
8889 return (uint64_t)ret_conv;
8892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8893 LDKDecodeError e_conv;
8894 e_conv.inner = (void*)(e & (~1));
8895 e_conv.is_owned = (e & 1) || (e == 0);
8896 e_conv = DecodeError_clone(&e_conv);
8897 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8898 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
8899 return (uint64_t)ret_conv;
8902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8903 if ((_res & 1) != 0) return;
8904 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
8906 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
8909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8910 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
8911 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
8912 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
8913 return (uint64_t)ret_conv;
8916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
8917 LDKCVec_SignatureZ _res_constr;
8918 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
8919 if (_res_constr.datalen > 0)
8920 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8922 _res_constr.data = NULL;
8923 for (size_t i = 0; i < _res_constr.datalen; i++) {
8924 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
8925 LDKSignature _res_conv_8_ref;
8926 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
8927 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
8928 _res_constr.data[i] = _res_conv_8_ref;
8930 CVec_SignatureZ_free(_res_constr);
8933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8934 LDKHolderCommitmentTransaction o_conv;
8935 o_conv.inner = (void*)(o & (~1));
8936 o_conv.is_owned = (o & 1) || (o == 0);
8937 o_conv = HolderCommitmentTransaction_clone(&o_conv);
8938 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8939 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
8940 return (uint64_t)ret_conv;
8943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8944 LDKDecodeError e_conv;
8945 e_conv.inner = (void*)(e & (~1));
8946 e_conv.is_owned = (e & 1) || (e == 0);
8947 e_conv = DecodeError_clone(&e_conv);
8948 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8949 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
8950 return (uint64_t)ret_conv;
8953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8954 if ((_res & 1) != 0) return;
8955 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8957 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
8960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8961 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8962 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
8963 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8964 return (uint64_t)ret_conv;
8967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
8968 LDKBuiltCommitmentTransaction o_conv;
8969 o_conv.inner = (void*)(o & (~1));
8970 o_conv.is_owned = (o & 1) || (o == 0);
8971 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
8972 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8973 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
8974 return (uint64_t)ret_conv;
8977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
8978 LDKDecodeError e_conv;
8979 e_conv.inner = (void*)(e & (~1));
8980 e_conv.is_owned = (e & 1) || (e == 0);
8981 e_conv = DecodeError_clone(&e_conv);
8982 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8983 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
8984 return (uint64_t)ret_conv;
8987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
8988 if ((_res & 1) != 0) return;
8989 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
8991 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
8994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8995 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
8996 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
8997 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
8998 return (uint64_t)ret_conv;
9001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9002 LDKCommitmentTransaction o_conv;
9003 o_conv.inner = (void*)(o & (~1));
9004 o_conv.is_owned = (o & 1) || (o == 0);
9005 o_conv = CommitmentTransaction_clone(&o_conv);
9006 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9007 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9008 return (uint64_t)ret_conv;
9011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9012 LDKDecodeError e_conv;
9013 e_conv.inner = (void*)(e & (~1));
9014 e_conv.is_owned = (e & 1) || (e == 0);
9015 e_conv = DecodeError_clone(&e_conv);
9016 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9017 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9018 return (uint64_t)ret_conv;
9021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9022 if ((_res & 1) != 0) return;
9023 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9025 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9029 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9030 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9031 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9032 return (uint64_t)ret_conv;
9035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9036 LDKTrustedCommitmentTransaction o_conv;
9037 o_conv.inner = (void*)(o & (~1));
9038 o_conv.is_owned = (o & 1) || (o == 0);
9039 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9040 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9041 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9042 return (uint64_t)ret_conv;
9045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9046 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9047 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9048 return (uint64_t)ret_conv;
9051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9052 if ((_res & 1) != 0) return;
9053 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9055 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9059 LDKCVec_SignatureZ o_constr;
9060 o_constr.datalen = (*env)->GetArrayLength(env, o);
9061 if (o_constr.datalen > 0)
9062 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9064 o_constr.data = NULL;
9065 for (size_t i = 0; i < o_constr.datalen; i++) {
9066 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9067 LDKSignature o_conv_8_ref;
9068 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9069 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9070 o_constr.data[i] = o_conv_8_ref;
9072 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9073 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9074 return (uint64_t)ret_conv;
9077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9078 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9079 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9080 return (uint64_t)ret_conv;
9083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9084 if ((_res & 1) != 0) return;
9085 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9087 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9091 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9092 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9093 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9094 return (uint64_t)ret_conv;
9097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9098 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9099 *ret_conv = CResult_NoneErrorZ_ok();
9100 return (uint64_t)ret_conv;
9103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9104 LDKIOError e_conv = LDKIOError_from_java(env, e);
9105 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9106 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9107 return (uint64_t)ret_conv;
9110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9111 if ((_res & 1) != 0) return;
9112 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9114 CResult_NoneErrorZ_free(_res_conv);
9117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9118 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9119 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9120 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9121 return (uint64_t)ret_conv;
9124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9126 o_conv.inner = (void*)(o & (~1));
9127 o_conv.is_owned = (o & 1) || (o == 0);
9128 o_conv = RouteHop_clone(&o_conv);
9129 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9130 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9131 return (uint64_t)ret_conv;
9134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9135 LDKDecodeError e_conv;
9136 e_conv.inner = (void*)(e & (~1));
9137 e_conv.is_owned = (e & 1) || (e == 0);
9138 e_conv = DecodeError_clone(&e_conv);
9139 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9140 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9141 return (uint64_t)ret_conv;
9144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9145 if ((_res & 1) != 0) return;
9146 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9148 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9152 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9153 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9154 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9155 return (uint64_t)ret_conv;
9158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9159 LDKCVec_RouteHopZ _res_constr;
9160 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9161 if (_res_constr.datalen > 0)
9162 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9164 _res_constr.data = NULL;
9165 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9166 for (size_t k = 0; k < _res_constr.datalen; k++) {
9167 int64_t _res_conv_10 = _res_vals[k];
9168 LDKRouteHop _res_conv_10_conv;
9169 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9170 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9171 _res_constr.data[k] = _res_conv_10_conv;
9173 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9174 CVec_RouteHopZ_free(_res_constr);
9177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9178 LDKCVec_CVec_RouteHopZZ _res_constr;
9179 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9180 if (_res_constr.datalen > 0)
9181 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9183 _res_constr.data = NULL;
9184 for (size_t m = 0; m < _res_constr.datalen; m++) {
9185 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9186 LDKCVec_RouteHopZ _res_conv_12_constr;
9187 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9188 if (_res_conv_12_constr.datalen > 0)
9189 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9191 _res_conv_12_constr.data = NULL;
9192 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9193 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9194 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9195 LDKRouteHop _res_conv_12_conv_10_conv;
9196 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9197 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9198 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9200 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9201 _res_constr.data[m] = _res_conv_12_constr;
9203 CVec_CVec_RouteHopZZ_free(_res_constr);
9206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9208 o_conv.inner = (void*)(o & (~1));
9209 o_conv.is_owned = (o & 1) || (o == 0);
9210 o_conv = Route_clone(&o_conv);
9211 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9212 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9213 return (uint64_t)ret_conv;
9216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9217 LDKDecodeError e_conv;
9218 e_conv.inner = (void*)(e & (~1));
9219 e_conv.is_owned = (e & 1) || (e == 0);
9220 e_conv = DecodeError_clone(&e_conv);
9221 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9222 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9223 return (uint64_t)ret_conv;
9226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9227 if ((_res & 1) != 0) return;
9228 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9230 CResult_RouteDecodeErrorZ_free(_res_conv);
9233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9234 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9235 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9236 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9237 return (uint64_t)ret_conv;
9240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9241 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9242 *ret_copy = COption_u64Z_some(o);
9243 uint64_t ret_ref = (uint64_t)ret_copy;
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9248 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9249 *ret_copy = COption_u64Z_none();
9250 uint64_t ret_ref = (uint64_t)ret_copy;
9254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9255 if ((_res & 1) != 0) return;
9256 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9258 COption_u64Z_free(_res_conv);
9261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9262 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9263 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9264 *ret_copy = COption_u64Z_clone(orig_conv);
9265 uint64_t ret_ref = (uint64_t)ret_copy;
9269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9270 LDKCVec_ChannelDetailsZ _res_constr;
9271 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9272 if (_res_constr.datalen > 0)
9273 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9275 _res_constr.data = NULL;
9276 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9277 for (size_t q = 0; q < _res_constr.datalen; q++) {
9278 int64_t _res_conv_16 = _res_vals[q];
9279 LDKChannelDetails _res_conv_16_conv;
9280 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9281 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9282 _res_constr.data[q] = _res_conv_16_conv;
9284 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9285 CVec_ChannelDetailsZ_free(_res_constr);
9288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9289 LDKCVec_RouteHintZ _res_constr;
9290 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9291 if (_res_constr.datalen > 0)
9292 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9294 _res_constr.data = NULL;
9295 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9296 for (size_t l = 0; l < _res_constr.datalen; l++) {
9297 int64_t _res_conv_11 = _res_vals[l];
9298 LDKRouteHint _res_conv_11_conv;
9299 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9300 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9301 _res_constr.data[l] = _res_conv_11_conv;
9303 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9304 CVec_RouteHintZ_free(_res_constr);
9307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9309 o_conv.inner = (void*)(o & (~1));
9310 o_conv.is_owned = (o & 1) || (o == 0);
9311 o_conv = Route_clone(&o_conv);
9312 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9313 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9314 return (uint64_t)ret_conv;
9317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9318 LDKLightningError e_conv;
9319 e_conv.inner = (void*)(e & (~1));
9320 e_conv.is_owned = (e & 1) || (e == 0);
9321 e_conv = LightningError_clone(&e_conv);
9322 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9323 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9324 return (uint64_t)ret_conv;
9327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9328 if ((_res & 1) != 0) return;
9329 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9331 CResult_RouteLightningErrorZ_free(_res_conv);
9334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9335 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9336 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9337 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9338 return (uint64_t)ret_conv;
9341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9342 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9343 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9344 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9345 return (uint64_t)ret_conv;
9348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9349 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9350 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9351 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9352 return (uint64_t)ret_conv;
9355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9356 if ((_res & 1) != 0) return;
9357 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9359 CResult_TxOutAccessErrorZ_free(_res_conv);
9362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9363 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9364 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9365 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9366 return (uint64_t)ret_conv;
9369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9370 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9371 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9372 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9373 return (uint64_t)ret_ref;
9376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9377 LDKTransaction b_ref;
9378 b_ref.datalen = (*env)->GetArrayLength(env, b);
9379 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9380 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9381 b_ref.data_is_owned = true;
9382 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9383 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9384 return (uint64_t)ret_ref;
9387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9388 if ((_res & 1) != 0) return;
9389 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9391 C2Tuple_usizeTransactionZ_free(_res_conv);
9394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9395 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9396 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9397 if (_res_constr.datalen > 0)
9398 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9400 _res_constr.data = NULL;
9401 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9402 for (size_t y = 0; y < _res_constr.datalen; y++) {
9403 int64_t _res_conv_24 = _res_vals[y];
9404 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9405 FREE((void*)_res_conv_24);
9406 _res_constr.data[y] = _res_conv_24_conv;
9408 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9409 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9413 LDKCVec_TxidZ _res_constr;
9414 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9415 if (_res_constr.datalen > 0)
9416 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9418 _res_constr.data = NULL;
9419 for (size_t i = 0; i < _res_constr.datalen; i++) {
9420 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9421 LDKThirtyTwoBytes _res_conv_8_ref;
9422 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9423 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9424 _res_constr.data[i] = _res_conv_8_ref;
9426 CVec_TxidZ_free(_res_constr);
9429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9430 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9431 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9432 return (uint64_t)ret_conv;
9435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9436 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9437 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9438 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9439 return (uint64_t)ret_conv;
9442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9443 if ((_res & 1) != 0) return;
9444 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9446 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9450 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9451 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9452 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9453 return (uint64_t)ret_conv;
9456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9457 LDKCVec_MonitorEventZ _res_constr;
9458 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9459 if (_res_constr.datalen > 0)
9460 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9462 _res_constr.data = NULL;
9463 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9464 for (size_t o = 0; o < _res_constr.datalen; o++) {
9465 int64_t _res_conv_14 = _res_vals[o];
9466 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9467 FREE((void*)_res_conv_14);
9468 _res_constr.data[o] = _res_conv_14_conv;
9470 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9471 CVec_MonitorEventZ_free(_res_constr);
9474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9475 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9476 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9477 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9478 uint64_t ret_ref = (uint64_t)ret_copy;
9482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
9483 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9484 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
9485 uint64_t ret_ref = (uint64_t)ret_copy;
9489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9490 if ((_res & 1) != 0) return;
9491 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
9493 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
9496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9497 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
9498 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9499 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
9500 uint64_t ret_ref = (uint64_t)ret_copy;
9504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9505 LDKCVec_SpendableOutputDescriptorZ _res_constr;
9506 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9507 if (_res_constr.datalen > 0)
9508 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
9510 _res_constr.data = NULL;
9511 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9512 for (size_t b = 0; b < _res_constr.datalen; b++) {
9513 int64_t _res_conv_27 = _res_vals[b];
9514 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
9515 FREE((void*)_res_conv_27);
9516 _res_constr.data[b] = _res_conv_27_conv;
9518 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9519 CVec_SpendableOutputDescriptorZ_free(_res_constr);
9522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9523 LDKCVec_MessageSendEventZ _res_constr;
9524 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9525 if (_res_constr.datalen > 0)
9526 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
9528 _res_constr.data = NULL;
9529 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9530 for (size_t s = 0; s < _res_constr.datalen; s++) {
9531 int64_t _res_conv_18 = _res_vals[s];
9532 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
9533 FREE((void*)_res_conv_18);
9534 _res_constr.data[s] = _res_conv_18_conv;
9536 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9537 CVec_MessageSendEventZ_free(_res_constr);
9540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9541 LDKInitFeatures o_conv;
9542 o_conv.inner = (void*)(o & (~1));
9543 o_conv.is_owned = (o & 1) || (o == 0);
9544 o_conv = InitFeatures_clone(&o_conv);
9545 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9546 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
9547 return (uint64_t)ret_conv;
9550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9551 LDKDecodeError e_conv;
9552 e_conv.inner = (void*)(e & (~1));
9553 e_conv.is_owned = (e & 1) || (e == 0);
9554 e_conv = DecodeError_clone(&e_conv);
9555 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
9556 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
9557 return (uint64_t)ret_conv;
9560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9561 if ((_res & 1) != 0) return;
9562 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9564 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
9567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9568 LDKNodeFeatures o_conv;
9569 o_conv.inner = (void*)(o & (~1));
9570 o_conv.is_owned = (o & 1) || (o == 0);
9571 o_conv = NodeFeatures_clone(&o_conv);
9572 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9573 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
9574 return (uint64_t)ret_conv;
9577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9578 LDKDecodeError e_conv;
9579 e_conv.inner = (void*)(e & (~1));
9580 e_conv.is_owned = (e & 1) || (e == 0);
9581 e_conv = DecodeError_clone(&e_conv);
9582 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
9583 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
9584 return (uint64_t)ret_conv;
9587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9588 if ((_res & 1) != 0) return;
9589 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9591 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
9594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9595 LDKChannelFeatures o_conv;
9596 o_conv.inner = (void*)(o & (~1));
9597 o_conv.is_owned = (o & 1) || (o == 0);
9598 o_conv = ChannelFeatures_clone(&o_conv);
9599 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9600 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
9601 return (uint64_t)ret_conv;
9604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9605 LDKDecodeError e_conv;
9606 e_conv.inner = (void*)(e & (~1));
9607 e_conv.is_owned = (e & 1) || (e == 0);
9608 e_conv = DecodeError_clone(&e_conv);
9609 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
9610 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
9611 return (uint64_t)ret_conv;
9614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9615 if ((_res & 1) != 0) return;
9616 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9618 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
9621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9622 LDKInvoiceFeatures o_conv;
9623 o_conv.inner = (void*)(o & (~1));
9624 o_conv.is_owned = (o & 1) || (o == 0);
9625 o_conv = InvoiceFeatures_clone(&o_conv);
9626 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9627 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
9628 return (uint64_t)ret_conv;
9631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9632 LDKDecodeError e_conv;
9633 e_conv.inner = (void*)(e & (~1));
9634 e_conv.is_owned = (e & 1) || (e == 0);
9635 e_conv = DecodeError_clone(&e_conv);
9636 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
9637 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
9638 return (uint64_t)ret_conv;
9641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9642 if ((_res & 1) != 0) return;
9643 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
9645 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
9648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9649 LDKDelayedPaymentOutputDescriptor o_conv;
9650 o_conv.inner = (void*)(o & (~1));
9651 o_conv.is_owned = (o & 1) || (o == 0);
9652 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
9653 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9654 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9655 return (uint64_t)ret_conv;
9658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9659 LDKDecodeError e_conv;
9660 e_conv.inner = (void*)(e & (~1));
9661 e_conv.is_owned = (e & 1) || (e == 0);
9662 e_conv = DecodeError_clone(&e_conv);
9663 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9664 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9665 return (uint64_t)ret_conv;
9668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9669 if ((_res & 1) != 0) return;
9670 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9672 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9676 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9677 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
9678 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9679 return (uint64_t)ret_conv;
9682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9683 LDKStaticPaymentOutputDescriptor o_conv;
9684 o_conv.inner = (void*)(o & (~1));
9685 o_conv.is_owned = (o & 1) || (o == 0);
9686 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
9687 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9688 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
9689 return (uint64_t)ret_conv;
9692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9693 LDKDecodeError e_conv;
9694 e_conv.inner = (void*)(e & (~1));
9695 e_conv.is_owned = (e & 1) || (e == 0);
9696 e_conv = DecodeError_clone(&e_conv);
9697 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9698 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
9699 return (uint64_t)ret_conv;
9702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9703 if ((_res & 1) != 0) return;
9704 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9706 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
9709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9710 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
9711 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
9712 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
9713 return (uint64_t)ret_conv;
9716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9717 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
9718 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9719 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
9720 return (uint64_t)ret_conv;
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9724 LDKDecodeError e_conv;
9725 e_conv.inner = (void*)(e & (~1));
9726 e_conv.is_owned = (e & 1) || (e == 0);
9727 e_conv = DecodeError_clone(&e_conv);
9728 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9729 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
9730 return (uint64_t)ret_conv;
9733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9734 if ((_res & 1) != 0) return;
9735 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
9737 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
9740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9741 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
9742 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
9743 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
9744 return (uint64_t)ret_conv;
9747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9748 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
9749 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9750 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
9751 return (uint64_t)ret_ref;
9754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
9756 CHECK((*env)->GetArrayLength(env, a) == 64);
9757 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
9758 LDKCVec_SignatureZ b_constr;
9759 b_constr.datalen = (*env)->GetArrayLength(env, b);
9760 if (b_constr.datalen > 0)
9761 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9763 b_constr.data = NULL;
9764 for (size_t i = 0; i < b_constr.datalen; i++) {
9765 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
9766 LDKSignature b_conv_8_ref;
9767 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
9768 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
9769 b_constr.data[i] = b_conv_8_ref;
9771 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
9772 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
9773 return (uint64_t)ret_ref;
9776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9777 if ((_res & 1) != 0) return;
9778 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
9780 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
9783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9784 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
9785 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9786 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
9787 return (uint64_t)ret_conv;
9790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
9791 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9792 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
9793 return (uint64_t)ret_conv;
9796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9797 if ((_res & 1) != 0) return;
9798 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
9800 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
9803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9804 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
9805 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
9806 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
9807 return (uint64_t)ret_conv;
9810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9812 CHECK((*env)->GetArrayLength(env, o) == 64);
9813 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
9814 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9815 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
9816 return (uint64_t)ret_conv;
9819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9820 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9821 *ret_conv = CResult_SignatureNoneZ_err();
9822 return (uint64_t)ret_conv;
9825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9826 if ((_res & 1) != 0) return;
9827 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
9829 CResult_SignatureNoneZ_free(_res_conv);
9832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9833 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
9834 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
9835 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
9836 return (uint64_t)ret_conv;
9839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9840 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
9841 if (o_conv.free == LDKSign_JCalls_free) {
9842 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9843 LDKSign_JCalls_clone(o_conv.this_arg);
9845 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9846 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
9847 return (uint64_t)ret_conv;
9850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9851 LDKDecodeError e_conv;
9852 e_conv.inner = (void*)(e & (~1));
9853 e_conv.is_owned = (e & 1) || (e == 0);
9854 e_conv = DecodeError_clone(&e_conv);
9855 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9856 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
9857 return (uint64_t)ret_conv;
9860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9861 if ((_res & 1) != 0) return;
9862 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
9864 CResult_SignDecodeErrorZ_free(_res_conv);
9867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9868 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
9869 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
9870 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
9871 return (uint64_t)ret_conv;
9874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9875 LDKCVec_u8Z _res_ref;
9876 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9877 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
9878 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9879 CVec_u8Z_free(_res_ref);
9882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
9883 LDKRecoverableSignature arg_ref;
9884 CHECK((*env)->GetArrayLength(env, arg) == 68);
9885 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
9886 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9887 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
9888 return (uint64_t)ret_conv;
9891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
9892 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9893 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
9894 return (uint64_t)ret_conv;
9897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9898 if ((_res & 1) != 0) return;
9899 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
9901 CResult_RecoverableSignatureNoneZ_free(_res_conv);
9904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9905 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
9906 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9907 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
9908 return (uint64_t)ret_conv;
9911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9912 LDKCVec_CVec_u8ZZ _res_constr;
9913 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9914 if (_res_constr.datalen > 0)
9915 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9917 _res_constr.data = NULL;
9918 for (size_t i = 0; i < _res_constr.datalen; i++) {
9919 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9920 LDKCVec_u8Z _res_conv_8_ref;
9921 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
9922 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9923 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
9924 _res_constr.data[i] = _res_conv_8_ref;
9926 CVec_CVec_u8ZZ_free(_res_constr);
9929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9930 LDKCVec_CVec_u8ZZ o_constr;
9931 o_constr.datalen = (*env)->GetArrayLength(env, o);
9932 if (o_constr.datalen > 0)
9933 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
9935 o_constr.data = NULL;
9936 for (size_t i = 0; i < o_constr.datalen; i++) {
9937 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9938 LDKCVec_u8Z o_conv_8_ref;
9939 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
9940 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
9941 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
9942 o_constr.data[i] = o_conv_8_ref;
9944 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9945 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
9946 return (uint64_t)ret_conv;
9949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
9950 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9951 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
9952 return (uint64_t)ret_conv;
9955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9956 if ((_res & 1) != 0) return;
9957 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
9959 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
9962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9963 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
9964 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
9965 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
9966 return (uint64_t)ret_conv;
9969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9970 LDKInMemorySigner o_conv;
9971 o_conv.inner = (void*)(o & (~1));
9972 o_conv.is_owned = (o & 1) || (o == 0);
9973 o_conv = InMemorySigner_clone(&o_conv);
9974 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9975 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
9976 return (uint64_t)ret_conv;
9979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9980 LDKDecodeError e_conv;
9981 e_conv.inner = (void*)(e & (~1));
9982 e_conv.is_owned = (e & 1) || (e == 0);
9983 e_conv = DecodeError_clone(&e_conv);
9984 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9985 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
9986 return (uint64_t)ret_conv;
9989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9990 if ((_res & 1) != 0) return;
9991 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
9993 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
9996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9997 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
9998 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
9999 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10000 return (uint64_t)ret_conv;
10003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10004 LDKCVec_TxOutZ _res_constr;
10005 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10006 if (_res_constr.datalen > 0)
10007 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10009 _res_constr.data = NULL;
10010 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10011 for (size_t h = 0; h < _res_constr.datalen; h++) {
10012 int64_t _res_conv_7 = _res_vals[h];
10013 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10014 FREE((void*)_res_conv_7);
10015 _res_constr.data[h] = _res_conv_7_conv;
10017 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10018 CVec_TxOutZ_free(_res_constr);
10021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10022 LDKTransaction o_ref;
10023 o_ref.datalen = (*env)->GetArrayLength(env, o);
10024 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10025 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10026 o_ref.data_is_owned = true;
10027 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10028 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10029 return (uint64_t)ret_conv;
10032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10033 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10034 *ret_conv = CResult_TransactionNoneZ_err();
10035 return (uint64_t)ret_conv;
10038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10039 if ((_res & 1) != 0) return;
10040 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10042 CResult_TransactionNoneZ_free(_res_conv);
10045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10046 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10047 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10048 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10049 return (uint64_t)ret_conv;
10052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10053 LDKThirtyTwoBytes a_ref;
10054 CHECK((*env)->GetArrayLength(env, a) == 32);
10055 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10056 LDKChannelMonitor b_conv;
10057 b_conv.inner = (void*)(b & (~1));
10058 b_conv.is_owned = (b & 1) || (b == 0);
10059 b_conv = ChannelMonitor_clone(&b_conv);
10060 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10061 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10062 return (uint64_t)ret_ref;
10065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10066 if ((_res & 1) != 0) return;
10067 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10069 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10073 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10074 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10075 if (_res_constr.datalen > 0)
10076 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10078 _res_constr.data = NULL;
10079 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10080 for (size_t i = 0; i < _res_constr.datalen; i++) {
10081 int64_t _res_conv_34 = _res_vals[i];
10082 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10083 FREE((void*)_res_conv_34);
10084 _res_constr.data[i] = _res_conv_34_conv;
10086 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10087 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10091 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10092 o_constr.datalen = (*env)->GetArrayLength(env, o);
10093 if (o_constr.datalen > 0)
10094 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10096 o_constr.data = NULL;
10097 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10098 for (size_t i = 0; i < o_constr.datalen; i++) {
10099 int64_t o_conv_34 = o_vals[i];
10100 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10101 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10102 o_constr.data[i] = o_conv_34_conv;
10104 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10105 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10106 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10107 return (uint64_t)ret_conv;
10110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10111 LDKIOError e_conv = LDKIOError_from_java(env, e);
10112 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10113 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10114 return (uint64_t)ret_conv;
10117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10118 if ((_res & 1) != 0) return;
10119 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10121 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10125 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10126 *ret_conv = CResult_NoneAPIErrorZ_ok();
10127 return (uint64_t)ret_conv;
10130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10131 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10132 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10133 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10134 return (uint64_t)ret_conv;
10137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10138 if ((_res & 1) != 0) return;
10139 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10141 CResult_NoneAPIErrorZ_free(_res_conv);
10144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10145 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10146 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10147 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10148 return (uint64_t)ret_conv;
10151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10152 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10153 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10154 if (_res_constr.datalen > 0)
10155 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10157 _res_constr.data = NULL;
10158 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10159 for (size_t w = 0; w < _res_constr.datalen; w++) {
10160 int64_t _res_conv_22 = _res_vals[w];
10161 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10162 FREE((void*)_res_conv_22);
10163 _res_constr.data[w] = _res_conv_22_conv;
10165 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10166 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10170 LDKCVec_APIErrorZ _res_constr;
10171 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10172 if (_res_constr.datalen > 0)
10173 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10175 _res_constr.data = NULL;
10176 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10177 for (size_t k = 0; k < _res_constr.datalen; k++) {
10178 int64_t _res_conv_10 = _res_vals[k];
10179 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10180 FREE((void*)_res_conv_10);
10181 _res_constr.data[k] = _res_conv_10_conv;
10183 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10184 CVec_APIErrorZ_free(_res_constr);
10187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10188 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10189 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10190 return (uint64_t)ret_conv;
10193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10194 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10195 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10196 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10197 return (uint64_t)ret_conv;
10200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10201 if ((_res & 1) != 0) return;
10202 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10204 CResult_NonePaymentSendFailureZ_free(_res_conv);
10207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10208 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10209 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10210 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10211 return (uint64_t)ret_conv;
10214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10215 LDKCVec_NetAddressZ _res_constr;
10216 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10217 if (_res_constr.datalen > 0)
10218 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10220 _res_constr.data = NULL;
10221 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10222 for (size_t m = 0; m < _res_constr.datalen; m++) {
10223 int64_t _res_conv_12 = _res_vals[m];
10224 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10225 FREE((void*)_res_conv_12);
10226 _res_constr.data[m] = _res_conv_12_conv;
10228 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10229 CVec_NetAddressZ_free(_res_constr);
10232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10233 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10234 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10235 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10236 return (uint64_t)ret_ref;
10239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10240 LDKThirtyTwoBytes a_ref;
10241 CHECK((*env)->GetArrayLength(env, a) == 32);
10242 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10243 LDKThirtyTwoBytes b_ref;
10244 CHECK((*env)->GetArrayLength(env, b) == 32);
10245 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10246 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10247 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10248 return (uint64_t)ret_ref;
10251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10252 if ((_res & 1) != 0) return;
10253 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10255 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10259 LDKThirtyTwoBytes o_ref;
10260 CHECK((*env)->GetArrayLength(env, o) == 32);
10261 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10262 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10263 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10264 return (uint64_t)ret_conv;
10267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10268 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10269 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10270 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10271 return (uint64_t)ret_conv;
10274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10275 if ((_res & 1) != 0) return;
10276 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10278 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10282 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10283 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10284 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10285 return (uint64_t)ret_conv;
10288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10289 LDKCVec_ChannelMonitorZ _res_constr;
10290 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10291 if (_res_constr.datalen > 0)
10292 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10294 _res_constr.data = NULL;
10295 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10296 for (size_t q = 0; q < _res_constr.datalen; q++) {
10297 int64_t _res_conv_16 = _res_vals[q];
10298 LDKChannelMonitor _res_conv_16_conv;
10299 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10300 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10301 _res_constr.data[q] = _res_conv_16_conv;
10303 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10304 CVec_ChannelMonitorZ_free(_res_constr);
10307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10308 LDKThirtyTwoBytes a_ref;
10309 CHECK((*env)->GetArrayLength(env, a) == 32);
10310 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10311 LDKChannelManager b_conv;
10312 b_conv.inner = (void*)(b & (~1));
10313 b_conv.is_owned = (b & 1) || (b == 0);
10314 // Warning: we need a move here but no clone is available for LDKChannelManager
10315 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10316 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10317 return (uint64_t)ret_ref;
10320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10321 if ((_res & 1) != 0) return;
10322 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10324 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10328 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10329 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10330 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10331 return (uint64_t)ret_conv;
10334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10335 LDKDecodeError e_conv;
10336 e_conv.inner = (void*)(e & (~1));
10337 e_conv.is_owned = (e & 1) || (e == 0);
10338 e_conv = DecodeError_clone(&e_conv);
10339 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10340 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10341 return (uint64_t)ret_conv;
10344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10345 if ((_res & 1) != 0) return;
10346 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10348 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10352 LDKChannelConfig o_conv;
10353 o_conv.inner = (void*)(o & (~1));
10354 o_conv.is_owned = (o & 1) || (o == 0);
10355 o_conv = ChannelConfig_clone(&o_conv);
10356 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10357 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10358 return (uint64_t)ret_conv;
10361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10362 LDKDecodeError e_conv;
10363 e_conv.inner = (void*)(e & (~1));
10364 e_conv.is_owned = (e & 1) || (e == 0);
10365 e_conv = DecodeError_clone(&e_conv);
10366 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10367 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10368 return (uint64_t)ret_conv;
10371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10372 if ((_res & 1) != 0) return;
10373 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10375 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10379 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10380 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10381 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10382 return (uint64_t)ret_conv;
10385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10386 LDKOutPoint o_conv;
10387 o_conv.inner = (void*)(o & (~1));
10388 o_conv.is_owned = (o & 1) || (o == 0);
10389 o_conv = OutPoint_clone(&o_conv);
10390 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10391 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10392 return (uint64_t)ret_conv;
10395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10396 LDKDecodeError e_conv;
10397 e_conv.inner = (void*)(e & (~1));
10398 e_conv.is_owned = (e & 1) || (e == 0);
10399 e_conv = DecodeError_clone(&e_conv);
10400 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10401 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10402 return (uint64_t)ret_conv;
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10406 if ((_res & 1) != 0) return;
10407 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10409 CResult_OutPointDecodeErrorZ_free(_res_conv);
10412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10413 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10414 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10415 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10416 return (uint64_t)ret_conv;
10419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10420 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10421 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10422 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10423 return (uint64_t)ret_conv;
10426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
10427 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10428 *ret_conv = CResult_SiPrefixNoneZ_err();
10429 return (uint64_t)ret_conv;
10432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10433 if ((_res & 1) != 0) return;
10434 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
10436 CResult_SiPrefixNoneZ_free(_res_conv);
10439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10440 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
10441 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10442 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
10443 return (uint64_t)ret_conv;
10446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10448 o_conv.inner = (void*)(o & (~1));
10449 o_conv.is_owned = (o & 1) || (o == 0);
10450 o_conv = Invoice_clone(&o_conv);
10451 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10452 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
10453 return (uint64_t)ret_conv;
10456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10457 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10458 *ret_conv = CResult_InvoiceNoneZ_err();
10459 return (uint64_t)ret_conv;
10462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10463 if ((_res & 1) != 0) return;
10464 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
10466 CResult_InvoiceNoneZ_free(_res_conv);
10469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10470 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
10471 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
10472 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
10473 return (uint64_t)ret_conv;
10476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10477 LDKSignedRawInvoice o_conv;
10478 o_conv.inner = (void*)(o & (~1));
10479 o_conv.is_owned = (o & 1) || (o == 0);
10480 o_conv = SignedRawInvoice_clone(&o_conv);
10481 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10482 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
10483 return (uint64_t)ret_conv;
10486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
10487 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10488 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
10489 return (uint64_t)ret_conv;
10492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10493 if ((_res & 1) != 0) return;
10494 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
10496 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
10499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10500 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
10501 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
10502 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
10503 return (uint64_t)ret_conv;
10506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10507 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
10508 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10509 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
10510 return (uint64_t)ret_ref;
10513 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) {
10514 LDKRawInvoice a_conv;
10515 a_conv.inner = (void*)(a & (~1));
10516 a_conv.is_owned = (a & 1) || (a == 0);
10517 a_conv = RawInvoice_clone(&a_conv);
10518 LDKThirtyTwoBytes b_ref;
10519 CHECK((*env)->GetArrayLength(env, b) == 32);
10520 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10521 LDKInvoiceSignature c_conv;
10522 c_conv.inner = (void*)(c & (~1));
10523 c_conv.is_owned = (c & 1) || (c == 0);
10524 c_conv = InvoiceSignature_clone(&c_conv);
10525 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
10526 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
10527 return (uint64_t)ret_ref;
10530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10531 if ((_res & 1) != 0) return;
10532 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
10534 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
10537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10538 LDKPayeePubKey o_conv;
10539 o_conv.inner = (void*)(o & (~1));
10540 o_conv.is_owned = (o & 1) || (o == 0);
10541 o_conv = PayeePubKey_clone(&o_conv);
10542 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10543 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
10544 return (uint64_t)ret_conv;
10547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10548 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10549 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10550 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
10551 return (uint64_t)ret_conv;
10554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10555 if ((_res & 1) != 0) return;
10556 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
10558 CResult_PayeePubKeyErrorZ_free(_res_conv);
10561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10562 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
10563 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
10564 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
10565 return (uint64_t)ret_conv;
10568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10569 LDKCVec_PrivateRouteZ _res_constr;
10570 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10571 if (_res_constr.datalen > 0)
10572 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
10574 _res_constr.data = NULL;
10575 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10576 for (size_t o = 0; o < _res_constr.datalen; o++) {
10577 int64_t _res_conv_14 = _res_vals[o];
10578 LDKPrivateRoute _res_conv_14_conv;
10579 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
10580 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
10581 _res_constr.data[o] = _res_conv_14_conv;
10583 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10584 CVec_PrivateRouteZ_free(_res_constr);
10587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10588 LDKPositiveTimestamp o_conv;
10589 o_conv.inner = (void*)(o & (~1));
10590 o_conv.is_owned = (o & 1) || (o == 0);
10591 o_conv = PositiveTimestamp_clone(&o_conv);
10592 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10593 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
10594 return (uint64_t)ret_conv;
10597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10598 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10599 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10600 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
10601 return (uint64_t)ret_conv;
10604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10605 if ((_res & 1) != 0) return;
10606 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
10608 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
10611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10612 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
10613 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
10614 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
10615 return (uint64_t)ret_conv;
10618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
10619 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10620 *ret_conv = CResult_NoneSemanticErrorZ_ok();
10621 return (uint64_t)ret_conv;
10624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10625 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10626 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10627 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
10628 return (uint64_t)ret_conv;
10631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10632 if ((_res & 1) != 0) return;
10633 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
10635 CResult_NoneSemanticErrorZ_free(_res_conv);
10638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10639 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
10640 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
10641 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
10642 return (uint64_t)ret_conv;
10645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10647 o_conv.inner = (void*)(o & (~1));
10648 o_conv.is_owned = (o & 1) || (o == 0);
10649 o_conv = Invoice_clone(&o_conv);
10650 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10651 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
10652 return (uint64_t)ret_conv;
10655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10656 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
10657 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10658 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
10659 return (uint64_t)ret_conv;
10662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10663 if ((_res & 1) != 0) return;
10664 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
10666 CResult_InvoiceSemanticErrorZ_free(_res_conv);
10669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10670 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
10671 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
10672 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
10673 return (uint64_t)ret_conv;
10676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10677 LDKDescription o_conv;
10678 o_conv.inner = (void*)(o & (~1));
10679 o_conv.is_owned = (o & 1) || (o == 0);
10680 o_conv = Description_clone(&o_conv);
10681 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10682 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
10683 return (uint64_t)ret_conv;
10686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10687 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10688 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10689 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
10690 return (uint64_t)ret_conv;
10693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10694 if ((_res & 1) != 0) return;
10695 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
10697 CResult_DescriptionCreationErrorZ_free(_res_conv);
10700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10701 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
10702 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
10703 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
10704 return (uint64_t)ret_conv;
10707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10708 LDKExpiryTime o_conv;
10709 o_conv.inner = (void*)(o & (~1));
10710 o_conv.is_owned = (o & 1) || (o == 0);
10711 o_conv = ExpiryTime_clone(&o_conv);
10712 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10713 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
10714 return (uint64_t)ret_conv;
10717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10718 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10719 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10720 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
10721 return (uint64_t)ret_conv;
10724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10725 if ((_res & 1) != 0) return;
10726 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
10728 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
10731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10732 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
10733 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
10734 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
10735 return (uint64_t)ret_conv;
10738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10739 LDKPrivateRoute o_conv;
10740 o_conv.inner = (void*)(o & (~1));
10741 o_conv.is_owned = (o & 1) || (o == 0);
10742 o_conv = PrivateRoute_clone(&o_conv);
10743 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10744 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
10745 return (uint64_t)ret_conv;
10748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10749 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
10750 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10751 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
10752 return (uint64_t)ret_conv;
10755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10756 if ((_res & 1) != 0) return;
10757 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
10759 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
10762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10763 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
10764 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
10765 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
10766 return (uint64_t)ret_conv;
10769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
10770 LDKStr o_conv = java_to_owned_str(env, o);
10771 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10772 *ret_conv = CResult_StringErrorZ_ok(o_conv);
10773 return (uint64_t)ret_conv;
10776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10777 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
10778 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
10779 *ret_conv = CResult_StringErrorZ_err(e_conv);
10780 return (uint64_t)ret_conv;
10783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10784 if ((_res & 1) != 0) return;
10785 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
10787 CResult_StringErrorZ_free(_res_conv);
10790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10791 LDKChannelMonitorUpdate o_conv;
10792 o_conv.inner = (void*)(o & (~1));
10793 o_conv.is_owned = (o & 1) || (o == 0);
10794 o_conv = ChannelMonitorUpdate_clone(&o_conv);
10795 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10796 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
10797 return (uint64_t)ret_conv;
10800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10801 LDKDecodeError e_conv;
10802 e_conv.inner = (void*)(e & (~1));
10803 e_conv.is_owned = (e & 1) || (e == 0);
10804 e_conv = DecodeError_clone(&e_conv);
10805 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10806 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
10807 return (uint64_t)ret_conv;
10810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10811 if ((_res & 1) != 0) return;
10812 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10814 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
10817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10818 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
10819 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
10820 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
10821 return (uint64_t)ret_conv;
10824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10825 LDKHTLCUpdate o_conv;
10826 o_conv.inner = (void*)(o & (~1));
10827 o_conv.is_owned = (o & 1) || (o == 0);
10828 o_conv = HTLCUpdate_clone(&o_conv);
10829 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10830 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
10831 return (uint64_t)ret_conv;
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10835 LDKDecodeError e_conv;
10836 e_conv.inner = (void*)(e & (~1));
10837 e_conv.is_owned = (e & 1) || (e == 0);
10838 e_conv = DecodeError_clone(&e_conv);
10839 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10840 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
10841 return (uint64_t)ret_conv;
10844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10845 if ((_res & 1) != 0) return;
10846 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
10848 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
10851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10852 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
10853 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
10854 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
10855 return (uint64_t)ret_conv;
10858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
10859 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10860 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
10861 return (uint64_t)ret_conv;
10864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10865 LDKMonitorUpdateError e_conv;
10866 e_conv.inner = (void*)(e & (~1));
10867 e_conv.is_owned = (e & 1) || (e == 0);
10868 e_conv = MonitorUpdateError_clone(&e_conv);
10869 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10870 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
10871 return (uint64_t)ret_conv;
10874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10875 if ((_res & 1) != 0) return;
10876 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
10878 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
10881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10882 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
10883 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
10884 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
10885 return (uint64_t)ret_conv;
10888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10889 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
10890 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10891 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
10892 return (uint64_t)ret_ref;
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
10896 LDKOutPoint a_conv;
10897 a_conv.inner = (void*)(a & (~1));
10898 a_conv.is_owned = (a & 1) || (a == 0);
10899 a_conv = OutPoint_clone(&a_conv);
10901 b_ref.datalen = (*env)->GetArrayLength(env, b);
10902 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10903 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10904 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
10905 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
10906 return (uint64_t)ret_ref;
10909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10910 if ((_res & 1) != 0) return;
10911 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
10913 C2Tuple_OutPointScriptZ_free(_res_conv);
10916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10917 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
10918 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10919 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
10920 return (uint64_t)ret_ref;
10923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
10925 b_ref.datalen = (*env)->GetArrayLength(env, b);
10926 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
10927 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
10928 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
10929 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
10930 return (uint64_t)ret_ref;
10933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10934 if ((_res & 1) != 0) return;
10935 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
10937 C2Tuple_u32ScriptZ_free(_res_conv);
10940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10941 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
10942 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10943 if (_res_constr.datalen > 0)
10944 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10946 _res_constr.data = NULL;
10947 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10948 for (size_t b = 0; b < _res_constr.datalen; b++) {
10949 int64_t _res_conv_27 = _res_vals[b];
10950 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
10951 FREE((void*)_res_conv_27);
10952 _res_constr.data[b] = _res_conv_27_conv;
10954 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10955 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
10958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10959 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
10960 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10961 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
10962 return (uint64_t)ret_ref;
10965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
10966 LDKThirtyTwoBytes a_ref;
10967 CHECK((*env)->GetArrayLength(env, a) == 32);
10968 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10969 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
10970 b_constr.datalen = (*env)->GetArrayLength(env, b);
10971 if (b_constr.datalen > 0)
10972 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
10974 b_constr.data = NULL;
10975 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
10976 for (size_t b = 0; b < b_constr.datalen; b++) {
10977 int64_t b_conv_27 = b_vals[b];
10978 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
10979 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
10980 b_constr.data[b] = b_conv_27_conv;
10982 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
10983 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
10984 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
10985 return (uint64_t)ret_ref;
10988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10989 if ((_res & 1) != 0) return;
10990 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
10992 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
10995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10996 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
10997 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10998 if (_res_constr.datalen > 0)
10999 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11001 _res_constr.data = NULL;
11002 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11003 for (size_t v = 0; v < _res_constr.datalen; v++) {
11004 int64_t _res_conv_47 = _res_vals[v];
11005 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11006 FREE((void*)_res_conv_47);
11007 _res_constr.data[v] = _res_conv_47_conv;
11009 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11010 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11014 LDKCVec_EventZ _res_constr;
11015 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11016 if (_res_constr.datalen > 0)
11017 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11019 _res_constr.data = NULL;
11020 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11021 for (size_t h = 0; h < _res_constr.datalen; h++) {
11022 int64_t _res_conv_7 = _res_vals[h];
11023 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11024 FREE((void*)_res_conv_7);
11025 _res_constr.data[h] = _res_conv_7_conv;
11027 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11028 CVec_EventZ_free(_res_constr);
11031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11032 LDKCVec_TransactionZ _res_constr;
11033 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11034 if (_res_constr.datalen > 0)
11035 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11037 _res_constr.data = NULL;
11038 for (size_t i = 0; i < _res_constr.datalen; i++) {
11039 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11040 LDKTransaction _res_conv_8_ref;
11041 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11042 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11043 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11044 _res_conv_8_ref.data_is_owned = true;
11045 _res_constr.data[i] = _res_conv_8_ref;
11047 CVec_TransactionZ_free(_res_constr);
11050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11051 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11052 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11053 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11054 return (uint64_t)ret_ref;
11057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11058 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11059 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11060 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11061 return (uint64_t)ret_ref;
11064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11065 if ((_res & 1) != 0) return;
11066 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11068 C2Tuple_u32TxOutZ_free(_res_conv);
11071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11072 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11073 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11074 if (_res_constr.datalen > 0)
11075 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11077 _res_constr.data = NULL;
11078 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11079 for (size_t a = 0; a < _res_constr.datalen; a++) {
11080 int64_t _res_conv_26 = _res_vals[a];
11081 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11082 FREE((void*)_res_conv_26);
11083 _res_constr.data[a] = _res_conv_26_conv;
11085 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11086 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11090 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11091 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11092 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11093 return (uint64_t)ret_ref;
11096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11097 LDKThirtyTwoBytes a_ref;
11098 CHECK((*env)->GetArrayLength(env, a) == 32);
11099 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11100 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11101 b_constr.datalen = (*env)->GetArrayLength(env, b);
11102 if (b_constr.datalen > 0)
11103 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11105 b_constr.data = NULL;
11106 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11107 for (size_t a = 0; a < b_constr.datalen; a++) {
11108 int64_t b_conv_26 = b_vals[a];
11109 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11110 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11111 b_constr.data[a] = b_conv_26_conv;
11113 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11114 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11115 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11116 return (uint64_t)ret_ref;
11119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11120 if ((_res & 1) != 0) return;
11121 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11123 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11127 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11128 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11129 if (_res_constr.datalen > 0)
11130 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11132 _res_constr.data = NULL;
11133 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11134 for (size_t u = 0; u < _res_constr.datalen; u++) {
11135 int64_t _res_conv_46 = _res_vals[u];
11136 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11137 FREE((void*)_res_conv_46);
11138 _res_constr.data[u] = _res_conv_46_conv;
11140 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11141 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11145 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11146 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11147 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11148 return (uint64_t)ret_conv;
11151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11152 LDKDecodeError e_conv;
11153 e_conv.inner = (void*)(e & (~1));
11154 e_conv.is_owned = (e & 1) || (e == 0);
11155 e_conv = DecodeError_clone(&e_conv);
11156 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11157 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11158 return (uint64_t)ret_conv;
11161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11162 if ((_res & 1) != 0) return;
11163 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11165 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11169 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11170 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11171 return (uint64_t)ret_conv;
11174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11175 LDKLightningError e_conv;
11176 e_conv.inner = (void*)(e & (~1));
11177 e_conv.is_owned = (e & 1) || (e == 0);
11178 e_conv = LightningError_clone(&e_conv);
11179 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11180 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11181 return (uint64_t)ret_conv;
11184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11185 if ((_res & 1) != 0) return;
11186 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11188 CResult_boolLightningErrorZ_free(_res_conv);
11191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11192 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11193 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11194 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11195 return (uint64_t)ret_conv;
11198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11199 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11200 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11201 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11202 return (uint64_t)ret_ref;
11205 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) {
11206 LDKChannelAnnouncement a_conv;
11207 a_conv.inner = (void*)(a & (~1));
11208 a_conv.is_owned = (a & 1) || (a == 0);
11209 a_conv = ChannelAnnouncement_clone(&a_conv);
11210 LDKChannelUpdate b_conv;
11211 b_conv.inner = (void*)(b & (~1));
11212 b_conv.is_owned = (b & 1) || (b == 0);
11213 b_conv = ChannelUpdate_clone(&b_conv);
11214 LDKChannelUpdate c_conv;
11215 c_conv.inner = (void*)(c & (~1));
11216 c_conv.is_owned = (c & 1) || (c == 0);
11217 c_conv = ChannelUpdate_clone(&c_conv);
11218 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11219 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11220 return (uint64_t)ret_ref;
11223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11224 if ((_res & 1) != 0) return;
11225 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11227 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11231 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11232 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11233 if (_res_constr.datalen > 0)
11234 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11236 _res_constr.data = NULL;
11237 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11238 for (size_t l = 0; l < _res_constr.datalen; l++) {
11239 int64_t _res_conv_63 = _res_vals[l];
11240 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11241 FREE((void*)_res_conv_63);
11242 _res_constr.data[l] = _res_conv_63_conv;
11244 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11245 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11249 LDKCVec_NodeAnnouncementZ _res_constr;
11250 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11251 if (_res_constr.datalen > 0)
11252 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11254 _res_constr.data = NULL;
11255 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11256 for (size_t s = 0; s < _res_constr.datalen; s++) {
11257 int64_t _res_conv_18 = _res_vals[s];
11258 LDKNodeAnnouncement _res_conv_18_conv;
11259 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11260 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11261 _res_constr.data[s] = _res_conv_18_conv;
11263 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11264 CVec_NodeAnnouncementZ_free(_res_constr);
11267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11268 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11269 *ret_conv = CResult_NoneLightningErrorZ_ok();
11270 return (uint64_t)ret_conv;
11273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11274 LDKLightningError e_conv;
11275 e_conv.inner = (void*)(e & (~1));
11276 e_conv.is_owned = (e & 1) || (e == 0);
11277 e_conv = LightningError_clone(&e_conv);
11278 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11279 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11280 return (uint64_t)ret_conv;
11283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11284 if ((_res & 1) != 0) return;
11285 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11287 CResult_NoneLightningErrorZ_free(_res_conv);
11290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11291 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11292 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11293 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11294 return (uint64_t)ret_conv;
11297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11298 LDKCVec_PublicKeyZ _res_constr;
11299 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11300 if (_res_constr.datalen > 0)
11301 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11303 _res_constr.data = NULL;
11304 for (size_t i = 0; i < _res_constr.datalen; i++) {
11305 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11306 LDKPublicKey _res_conv_8_ref;
11307 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11308 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11309 _res_constr.data[i] = _res_conv_8_ref;
11311 CVec_PublicKeyZ_free(_res_constr);
11314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11316 o_ref.datalen = (*env)->GetArrayLength(env, o);
11317 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11318 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11319 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11320 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11321 return (uint64_t)ret_conv;
11324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11325 LDKPeerHandleError e_conv;
11326 e_conv.inner = (void*)(e & (~1));
11327 e_conv.is_owned = (e & 1) || (e == 0);
11328 e_conv = PeerHandleError_clone(&e_conv);
11329 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11330 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11331 return (uint64_t)ret_conv;
11334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11335 if ((_res & 1) != 0) return;
11336 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11338 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11342 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11343 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11344 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11345 return (uint64_t)ret_conv;
11348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11349 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11350 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11351 return (uint64_t)ret_conv;
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11355 LDKPeerHandleError e_conv;
11356 e_conv.inner = (void*)(e & (~1));
11357 e_conv.is_owned = (e & 1) || (e == 0);
11358 e_conv = PeerHandleError_clone(&e_conv);
11359 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11360 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11361 return (uint64_t)ret_conv;
11364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11365 if ((_res & 1) != 0) return;
11366 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11368 CResult_NonePeerHandleErrorZ_free(_res_conv);
11371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11372 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11373 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11374 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11375 return (uint64_t)ret_conv;
11378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11379 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11380 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11381 return (uint64_t)ret_conv;
11384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11385 LDKPeerHandleError e_conv;
11386 e_conv.inner = (void*)(e & (~1));
11387 e_conv.is_owned = (e & 1) || (e == 0);
11388 e_conv = PeerHandleError_clone(&e_conv);
11389 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11390 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11391 return (uint64_t)ret_conv;
11394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11395 if ((_res & 1) != 0) return;
11396 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11398 CResult_boolPeerHandleErrorZ_free(_res_conv);
11401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11402 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11403 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11404 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11405 return (uint64_t)ret_conv;
11408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11409 LDKDirectionalChannelInfo o_conv;
11410 o_conv.inner = (void*)(o & (~1));
11411 o_conv.is_owned = (o & 1) || (o == 0);
11412 o_conv = DirectionalChannelInfo_clone(&o_conv);
11413 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11414 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11415 return (uint64_t)ret_conv;
11418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11419 LDKDecodeError e_conv;
11420 e_conv.inner = (void*)(e & (~1));
11421 e_conv.is_owned = (e & 1) || (e == 0);
11422 e_conv = DecodeError_clone(&e_conv);
11423 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11424 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
11425 return (uint64_t)ret_conv;
11428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11429 if ((_res & 1) != 0) return;
11430 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11432 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
11435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11436 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
11437 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11438 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
11439 return (uint64_t)ret_conv;
11442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11443 LDKChannelInfo o_conv;
11444 o_conv.inner = (void*)(o & (~1));
11445 o_conv.is_owned = (o & 1) || (o == 0);
11446 o_conv = ChannelInfo_clone(&o_conv);
11447 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11448 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
11449 return (uint64_t)ret_conv;
11452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11453 LDKDecodeError e_conv;
11454 e_conv.inner = (void*)(e & (~1));
11455 e_conv.is_owned = (e & 1) || (e == 0);
11456 e_conv = DecodeError_clone(&e_conv);
11457 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11458 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
11459 return (uint64_t)ret_conv;
11462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11463 if ((_res & 1) != 0) return;
11464 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11466 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
11469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11470 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
11471 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
11472 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
11473 return (uint64_t)ret_conv;
11476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11477 LDKRoutingFees o_conv;
11478 o_conv.inner = (void*)(o & (~1));
11479 o_conv.is_owned = (o & 1) || (o == 0);
11480 o_conv = RoutingFees_clone(&o_conv);
11481 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11482 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
11483 return (uint64_t)ret_conv;
11486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11487 LDKDecodeError e_conv;
11488 e_conv.inner = (void*)(e & (~1));
11489 e_conv.is_owned = (e & 1) || (e == 0);
11490 e_conv = DecodeError_clone(&e_conv);
11491 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11492 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
11493 return (uint64_t)ret_conv;
11496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11497 if ((_res & 1) != 0) return;
11498 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11500 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
11503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11504 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
11505 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
11506 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
11507 return (uint64_t)ret_conv;
11510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11511 LDKNodeAnnouncementInfo o_conv;
11512 o_conv.inner = (void*)(o & (~1));
11513 o_conv.is_owned = (o & 1) || (o == 0);
11514 o_conv = NodeAnnouncementInfo_clone(&o_conv);
11515 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11516 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
11517 return (uint64_t)ret_conv;
11520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11521 LDKDecodeError e_conv;
11522 e_conv.inner = (void*)(e & (~1));
11523 e_conv.is_owned = (e & 1) || (e == 0);
11524 e_conv = DecodeError_clone(&e_conv);
11525 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11526 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
11527 return (uint64_t)ret_conv;
11530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11531 if ((_res & 1) != 0) return;
11532 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11534 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
11537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11538 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
11539 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
11540 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
11541 return (uint64_t)ret_conv;
11544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11545 LDKCVec_u64Z _res_constr;
11546 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11547 if (_res_constr.datalen > 0)
11548 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
11550 _res_constr.data = NULL;
11551 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11552 for (size_t g = 0; g < _res_constr.datalen; g++) {
11553 int64_t _res_conv_6 = _res_vals[g];
11554 _res_constr.data[g] = _res_conv_6;
11556 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11557 CVec_u64Z_free(_res_constr);
11560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11561 LDKNodeInfo o_conv;
11562 o_conv.inner = (void*)(o & (~1));
11563 o_conv.is_owned = (o & 1) || (o == 0);
11564 o_conv = NodeInfo_clone(&o_conv);
11565 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11566 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
11567 return (uint64_t)ret_conv;
11570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11571 LDKDecodeError e_conv;
11572 e_conv.inner = (void*)(e & (~1));
11573 e_conv.is_owned = (e & 1) || (e == 0);
11574 e_conv = DecodeError_clone(&e_conv);
11575 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11576 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
11577 return (uint64_t)ret_conv;
11580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11581 if ((_res & 1) != 0) return;
11582 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
11584 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
11587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11588 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
11589 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
11590 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
11591 return (uint64_t)ret_conv;
11594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11595 LDKNetworkGraph o_conv;
11596 o_conv.inner = (void*)(o & (~1));
11597 o_conv.is_owned = (o & 1) || (o == 0);
11598 o_conv = NetworkGraph_clone(&o_conv);
11599 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11600 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
11601 return (uint64_t)ret_conv;
11604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11605 LDKDecodeError e_conv;
11606 e_conv.inner = (void*)(e & (~1));
11607 e_conv.is_owned = (e & 1) || (e == 0);
11608 e_conv = DecodeError_clone(&e_conv);
11609 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11610 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
11611 return (uint64_t)ret_conv;
11614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11615 if ((_res & 1) != 0) return;
11616 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
11618 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
11621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11622 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
11623 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
11624 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
11625 return (uint64_t)ret_conv;
11628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
11629 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11630 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11631 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
11632 return (uint64_t)ret_conv;
11635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
11636 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11637 *ret_conv = CResult_NetAddressu8Z_err(e);
11638 return (uint64_t)ret_conv;
11641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
11642 if ((_res & 1) != 0) return;
11643 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
11645 CResult_NetAddressu8Z_free(_res_conv);
11648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11649 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
11650 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
11651 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
11652 return (uint64_t)ret_conv;
11655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11656 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
11657 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11658 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
11659 return (uint64_t)ret_conv;
11662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11663 LDKDecodeError e_conv;
11664 e_conv.inner = (void*)(e & (~1));
11665 e_conv.is_owned = (e & 1) || (e == 0);
11666 e_conv = DecodeError_clone(&e_conv);
11667 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11668 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
11669 return (uint64_t)ret_conv;
11672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11673 if ((_res & 1) != 0) return;
11674 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11676 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
11679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11680 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
11681 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11682 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
11683 return (uint64_t)ret_conv;
11686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11687 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
11688 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11689 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
11690 return (uint64_t)ret_conv;
11693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11694 LDKDecodeError e_conv;
11695 e_conv.inner = (void*)(e & (~1));
11696 e_conv.is_owned = (e & 1) || (e == 0);
11697 e_conv = DecodeError_clone(&e_conv);
11698 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11699 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
11700 return (uint64_t)ret_conv;
11703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11704 if ((_res & 1) != 0) return;
11705 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
11707 CResult_NetAddressDecodeErrorZ_free(_res_conv);
11710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11711 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
11712 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
11713 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
11714 return (uint64_t)ret_conv;
11717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11718 LDKCVec_UpdateAddHTLCZ _res_constr;
11719 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11720 if (_res_constr.datalen > 0)
11721 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11723 _res_constr.data = NULL;
11724 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11725 for (size_t p = 0; p < _res_constr.datalen; p++) {
11726 int64_t _res_conv_15 = _res_vals[p];
11727 LDKUpdateAddHTLC _res_conv_15_conv;
11728 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
11729 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
11730 _res_constr.data[p] = _res_conv_15_conv;
11732 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11733 CVec_UpdateAddHTLCZ_free(_res_constr);
11736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11737 LDKCVec_UpdateFulfillHTLCZ _res_constr;
11738 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11739 if (_res_constr.datalen > 0)
11740 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11742 _res_constr.data = NULL;
11743 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11744 for (size_t t = 0; t < _res_constr.datalen; t++) {
11745 int64_t _res_conv_19 = _res_vals[t];
11746 LDKUpdateFulfillHTLC _res_conv_19_conv;
11747 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
11748 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
11749 _res_constr.data[t] = _res_conv_19_conv;
11751 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11752 CVec_UpdateFulfillHTLCZ_free(_res_constr);
11755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11756 LDKCVec_UpdateFailHTLCZ _res_constr;
11757 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11758 if (_res_constr.datalen > 0)
11759 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11761 _res_constr.data = NULL;
11762 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11763 for (size_t q = 0; q < _res_constr.datalen; q++) {
11764 int64_t _res_conv_16 = _res_vals[q];
11765 LDKUpdateFailHTLC _res_conv_16_conv;
11766 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
11767 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
11768 _res_constr.data[q] = _res_conv_16_conv;
11770 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11771 CVec_UpdateFailHTLCZ_free(_res_constr);
11774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11775 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
11776 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11777 if (_res_constr.datalen > 0)
11778 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11780 _res_constr.data = NULL;
11781 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11782 for (size_t z = 0; z < _res_constr.datalen; z++) {
11783 int64_t _res_conv_25 = _res_vals[z];
11784 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
11785 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
11786 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
11787 _res_constr.data[z] = _res_conv_25_conv;
11789 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11790 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
11793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11794 LDKAcceptChannel o_conv;
11795 o_conv.inner = (void*)(o & (~1));
11796 o_conv.is_owned = (o & 1) || (o == 0);
11797 o_conv = AcceptChannel_clone(&o_conv);
11798 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11799 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
11800 return (uint64_t)ret_conv;
11803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11804 LDKDecodeError e_conv;
11805 e_conv.inner = (void*)(e & (~1));
11806 e_conv.is_owned = (e & 1) || (e == 0);
11807 e_conv = DecodeError_clone(&e_conv);
11808 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11809 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
11810 return (uint64_t)ret_conv;
11813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11814 if ((_res & 1) != 0) return;
11815 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
11817 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
11820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11821 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
11822 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
11823 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
11824 return (uint64_t)ret_conv;
11827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11828 LDKAnnouncementSignatures o_conv;
11829 o_conv.inner = (void*)(o & (~1));
11830 o_conv.is_owned = (o & 1) || (o == 0);
11831 o_conv = AnnouncementSignatures_clone(&o_conv);
11832 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11833 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
11834 return (uint64_t)ret_conv;
11837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11838 LDKDecodeError e_conv;
11839 e_conv.inner = (void*)(e & (~1));
11840 e_conv.is_owned = (e & 1) || (e == 0);
11841 e_conv = DecodeError_clone(&e_conv);
11842 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11843 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
11844 return (uint64_t)ret_conv;
11847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11848 if ((_res & 1) != 0) return;
11849 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
11851 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
11854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11855 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
11856 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
11857 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
11858 return (uint64_t)ret_conv;
11861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11862 LDKChannelReestablish o_conv;
11863 o_conv.inner = (void*)(o & (~1));
11864 o_conv.is_owned = (o & 1) || (o == 0);
11865 o_conv = ChannelReestablish_clone(&o_conv);
11866 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11867 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
11868 return (uint64_t)ret_conv;
11871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11872 LDKDecodeError e_conv;
11873 e_conv.inner = (void*)(e & (~1));
11874 e_conv.is_owned = (e & 1) || (e == 0);
11875 e_conv = DecodeError_clone(&e_conv);
11876 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11877 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
11878 return (uint64_t)ret_conv;
11881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11882 if ((_res & 1) != 0) return;
11883 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
11885 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
11888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11889 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
11890 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
11891 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
11892 return (uint64_t)ret_conv;
11895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11896 LDKClosingSigned o_conv;
11897 o_conv.inner = (void*)(o & (~1));
11898 o_conv.is_owned = (o & 1) || (o == 0);
11899 o_conv = ClosingSigned_clone(&o_conv);
11900 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11901 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
11902 return (uint64_t)ret_conv;
11905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11906 LDKDecodeError e_conv;
11907 e_conv.inner = (void*)(e & (~1));
11908 e_conv.is_owned = (e & 1) || (e == 0);
11909 e_conv = DecodeError_clone(&e_conv);
11910 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11911 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
11912 return (uint64_t)ret_conv;
11915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11916 if ((_res & 1) != 0) return;
11917 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11919 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
11922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11923 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
11924 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
11925 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
11926 return (uint64_t)ret_conv;
11929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11930 LDKCommitmentSigned o_conv;
11931 o_conv.inner = (void*)(o & (~1));
11932 o_conv.is_owned = (o & 1) || (o == 0);
11933 o_conv = CommitmentSigned_clone(&o_conv);
11934 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11935 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
11936 return (uint64_t)ret_conv;
11939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11940 LDKDecodeError e_conv;
11941 e_conv.inner = (void*)(e & (~1));
11942 e_conv.is_owned = (e & 1) || (e == 0);
11943 e_conv = DecodeError_clone(&e_conv);
11944 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11945 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
11946 return (uint64_t)ret_conv;
11949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11950 if ((_res & 1) != 0) return;
11951 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11953 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
11956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11957 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
11958 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
11959 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
11960 return (uint64_t)ret_conv;
11963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11964 LDKFundingCreated o_conv;
11965 o_conv.inner = (void*)(o & (~1));
11966 o_conv.is_owned = (o & 1) || (o == 0);
11967 o_conv = FundingCreated_clone(&o_conv);
11968 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11969 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
11970 return (uint64_t)ret_conv;
11973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11974 LDKDecodeError e_conv;
11975 e_conv.inner = (void*)(e & (~1));
11976 e_conv.is_owned = (e & 1) || (e == 0);
11977 e_conv = DecodeError_clone(&e_conv);
11978 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11979 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
11980 return (uint64_t)ret_conv;
11983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11984 if ((_res & 1) != 0) return;
11985 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
11987 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
11990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11991 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
11992 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
11993 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
11994 return (uint64_t)ret_conv;
11997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11998 LDKFundingSigned o_conv;
11999 o_conv.inner = (void*)(o & (~1));
12000 o_conv.is_owned = (o & 1) || (o == 0);
12001 o_conv = FundingSigned_clone(&o_conv);
12002 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12003 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12004 return (uint64_t)ret_conv;
12007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12008 LDKDecodeError e_conv;
12009 e_conv.inner = (void*)(e & (~1));
12010 e_conv.is_owned = (e & 1) || (e == 0);
12011 e_conv = DecodeError_clone(&e_conv);
12012 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12013 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12014 return (uint64_t)ret_conv;
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12018 if ((_res & 1) != 0) return;
12019 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12021 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12025 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12026 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12027 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12028 return (uint64_t)ret_conv;
12031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12032 LDKFundingLocked o_conv;
12033 o_conv.inner = (void*)(o & (~1));
12034 o_conv.is_owned = (o & 1) || (o == 0);
12035 o_conv = FundingLocked_clone(&o_conv);
12036 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12037 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12038 return (uint64_t)ret_conv;
12041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12042 LDKDecodeError e_conv;
12043 e_conv.inner = (void*)(e & (~1));
12044 e_conv.is_owned = (e & 1) || (e == 0);
12045 e_conv = DecodeError_clone(&e_conv);
12046 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12047 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12048 return (uint64_t)ret_conv;
12051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12052 if ((_res & 1) != 0) return;
12053 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12055 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12059 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12060 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12061 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12062 return (uint64_t)ret_conv;
12065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12067 o_conv.inner = (void*)(o & (~1));
12068 o_conv.is_owned = (o & 1) || (o == 0);
12069 o_conv = Init_clone(&o_conv);
12070 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12071 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12072 return (uint64_t)ret_conv;
12075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12076 LDKDecodeError e_conv;
12077 e_conv.inner = (void*)(e & (~1));
12078 e_conv.is_owned = (e & 1) || (e == 0);
12079 e_conv = DecodeError_clone(&e_conv);
12080 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12081 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12082 return (uint64_t)ret_conv;
12085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12086 if ((_res & 1) != 0) return;
12087 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12089 CResult_InitDecodeErrorZ_free(_res_conv);
12092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12093 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12094 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12095 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12096 return (uint64_t)ret_conv;
12099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12100 LDKOpenChannel o_conv;
12101 o_conv.inner = (void*)(o & (~1));
12102 o_conv.is_owned = (o & 1) || (o == 0);
12103 o_conv = OpenChannel_clone(&o_conv);
12104 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12105 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12106 return (uint64_t)ret_conv;
12109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12110 LDKDecodeError e_conv;
12111 e_conv.inner = (void*)(e & (~1));
12112 e_conv.is_owned = (e & 1) || (e == 0);
12113 e_conv = DecodeError_clone(&e_conv);
12114 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12115 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12116 return (uint64_t)ret_conv;
12119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12120 if ((_res & 1) != 0) return;
12121 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12123 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12127 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12128 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12129 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12130 return (uint64_t)ret_conv;
12133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12134 LDKRevokeAndACK o_conv;
12135 o_conv.inner = (void*)(o & (~1));
12136 o_conv.is_owned = (o & 1) || (o == 0);
12137 o_conv = RevokeAndACK_clone(&o_conv);
12138 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12139 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12140 return (uint64_t)ret_conv;
12143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12144 LDKDecodeError e_conv;
12145 e_conv.inner = (void*)(e & (~1));
12146 e_conv.is_owned = (e & 1) || (e == 0);
12147 e_conv = DecodeError_clone(&e_conv);
12148 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12149 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12150 return (uint64_t)ret_conv;
12153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12154 if ((_res & 1) != 0) return;
12155 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12157 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12161 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12162 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12163 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12164 return (uint64_t)ret_conv;
12167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12168 LDKShutdown o_conv;
12169 o_conv.inner = (void*)(o & (~1));
12170 o_conv.is_owned = (o & 1) || (o == 0);
12171 o_conv = Shutdown_clone(&o_conv);
12172 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12173 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12174 return (uint64_t)ret_conv;
12177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12178 LDKDecodeError e_conv;
12179 e_conv.inner = (void*)(e & (~1));
12180 e_conv.is_owned = (e & 1) || (e == 0);
12181 e_conv = DecodeError_clone(&e_conv);
12182 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12183 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12184 return (uint64_t)ret_conv;
12187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12188 if ((_res & 1) != 0) return;
12189 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12191 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12195 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12196 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12197 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12198 return (uint64_t)ret_conv;
12201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12202 LDKUpdateFailHTLC o_conv;
12203 o_conv.inner = (void*)(o & (~1));
12204 o_conv.is_owned = (o & 1) || (o == 0);
12205 o_conv = UpdateFailHTLC_clone(&o_conv);
12206 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12207 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12208 return (uint64_t)ret_conv;
12211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12212 LDKDecodeError e_conv;
12213 e_conv.inner = (void*)(e & (~1));
12214 e_conv.is_owned = (e & 1) || (e == 0);
12215 e_conv = DecodeError_clone(&e_conv);
12216 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12217 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12218 return (uint64_t)ret_conv;
12221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12222 if ((_res & 1) != 0) return;
12223 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12225 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12229 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12230 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12231 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12232 return (uint64_t)ret_conv;
12235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12236 LDKUpdateFailMalformedHTLC o_conv;
12237 o_conv.inner = (void*)(o & (~1));
12238 o_conv.is_owned = (o & 1) || (o == 0);
12239 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12240 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12241 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12242 return (uint64_t)ret_conv;
12245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12246 LDKDecodeError e_conv;
12247 e_conv.inner = (void*)(e & (~1));
12248 e_conv.is_owned = (e & 1) || (e == 0);
12249 e_conv = DecodeError_clone(&e_conv);
12250 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12251 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12252 return (uint64_t)ret_conv;
12255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12256 if ((_res & 1) != 0) return;
12257 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12259 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12263 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12264 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12265 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12266 return (uint64_t)ret_conv;
12269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12270 LDKUpdateFee o_conv;
12271 o_conv.inner = (void*)(o & (~1));
12272 o_conv.is_owned = (o & 1) || (o == 0);
12273 o_conv = UpdateFee_clone(&o_conv);
12274 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12275 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12276 return (uint64_t)ret_conv;
12279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12280 LDKDecodeError e_conv;
12281 e_conv.inner = (void*)(e & (~1));
12282 e_conv.is_owned = (e & 1) || (e == 0);
12283 e_conv = DecodeError_clone(&e_conv);
12284 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12285 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12286 return (uint64_t)ret_conv;
12289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12290 if ((_res & 1) != 0) return;
12291 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12293 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12297 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12298 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12299 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12300 return (uint64_t)ret_conv;
12303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12304 LDKUpdateFulfillHTLC o_conv;
12305 o_conv.inner = (void*)(o & (~1));
12306 o_conv.is_owned = (o & 1) || (o == 0);
12307 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12308 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12309 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12310 return (uint64_t)ret_conv;
12313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12314 LDKDecodeError e_conv;
12315 e_conv.inner = (void*)(e & (~1));
12316 e_conv.is_owned = (e & 1) || (e == 0);
12317 e_conv = DecodeError_clone(&e_conv);
12318 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12319 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12320 return (uint64_t)ret_conv;
12323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12324 if ((_res & 1) != 0) return;
12325 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12327 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12331 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12332 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12333 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12334 return (uint64_t)ret_conv;
12337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12338 LDKUpdateAddHTLC o_conv;
12339 o_conv.inner = (void*)(o & (~1));
12340 o_conv.is_owned = (o & 1) || (o == 0);
12341 o_conv = UpdateAddHTLC_clone(&o_conv);
12342 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12343 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12344 return (uint64_t)ret_conv;
12347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12348 LDKDecodeError e_conv;
12349 e_conv.inner = (void*)(e & (~1));
12350 e_conv.is_owned = (e & 1) || (e == 0);
12351 e_conv = DecodeError_clone(&e_conv);
12352 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12353 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12354 return (uint64_t)ret_conv;
12357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12358 if ((_res & 1) != 0) return;
12359 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12361 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12365 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12366 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12367 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12368 return (uint64_t)ret_conv;
12371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12373 o_conv.inner = (void*)(o & (~1));
12374 o_conv.is_owned = (o & 1) || (o == 0);
12375 o_conv = Ping_clone(&o_conv);
12376 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12377 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12378 return (uint64_t)ret_conv;
12381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12382 LDKDecodeError e_conv;
12383 e_conv.inner = (void*)(e & (~1));
12384 e_conv.is_owned = (e & 1) || (e == 0);
12385 e_conv = DecodeError_clone(&e_conv);
12386 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12387 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12388 return (uint64_t)ret_conv;
12391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12392 if ((_res & 1) != 0) return;
12393 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12395 CResult_PingDecodeErrorZ_free(_res_conv);
12398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12399 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12400 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12401 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12402 return (uint64_t)ret_conv;
12405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12407 o_conv.inner = (void*)(o & (~1));
12408 o_conv.is_owned = (o & 1) || (o == 0);
12409 o_conv = Pong_clone(&o_conv);
12410 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12411 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12412 return (uint64_t)ret_conv;
12415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12416 LDKDecodeError e_conv;
12417 e_conv.inner = (void*)(e & (~1));
12418 e_conv.is_owned = (e & 1) || (e == 0);
12419 e_conv = DecodeError_clone(&e_conv);
12420 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12421 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12422 return (uint64_t)ret_conv;
12425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12426 if ((_res & 1) != 0) return;
12427 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
12429 CResult_PongDecodeErrorZ_free(_res_conv);
12432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12433 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
12434 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12435 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
12436 return (uint64_t)ret_conv;
12439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12440 LDKUnsignedChannelAnnouncement o_conv;
12441 o_conv.inner = (void*)(o & (~1));
12442 o_conv.is_owned = (o & 1) || (o == 0);
12443 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
12444 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12445 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
12446 return (uint64_t)ret_conv;
12449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12450 LDKDecodeError e_conv;
12451 e_conv.inner = (void*)(e & (~1));
12452 e_conv.is_owned = (e & 1) || (e == 0);
12453 e_conv = DecodeError_clone(&e_conv);
12454 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12455 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
12456 return (uint64_t)ret_conv;
12459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12460 if ((_res & 1) != 0) return;
12461 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12463 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
12466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12467 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12468 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
12469 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12470 return (uint64_t)ret_conv;
12473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12474 LDKChannelAnnouncement o_conv;
12475 o_conv.inner = (void*)(o & (~1));
12476 o_conv.is_owned = (o & 1) || (o == 0);
12477 o_conv = ChannelAnnouncement_clone(&o_conv);
12478 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12479 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
12480 return (uint64_t)ret_conv;
12483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12484 LDKDecodeError e_conv;
12485 e_conv.inner = (void*)(e & (~1));
12486 e_conv.is_owned = (e & 1) || (e == 0);
12487 e_conv = DecodeError_clone(&e_conv);
12488 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12489 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
12490 return (uint64_t)ret_conv;
12493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12494 if ((_res & 1) != 0) return;
12495 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12497 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
12500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12501 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
12502 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
12503 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
12504 return (uint64_t)ret_conv;
12507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12508 LDKUnsignedChannelUpdate o_conv;
12509 o_conv.inner = (void*)(o & (~1));
12510 o_conv.is_owned = (o & 1) || (o == 0);
12511 o_conv = UnsignedChannelUpdate_clone(&o_conv);
12512 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12513 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
12514 return (uint64_t)ret_conv;
12517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12518 LDKDecodeError e_conv;
12519 e_conv.inner = (void*)(e & (~1));
12520 e_conv.is_owned = (e & 1) || (e == 0);
12521 e_conv = DecodeError_clone(&e_conv);
12522 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12523 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
12524 return (uint64_t)ret_conv;
12527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12528 if ((_res & 1) != 0) return;
12529 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12531 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
12534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12535 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
12536 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
12537 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
12538 return (uint64_t)ret_conv;
12541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12542 LDKChannelUpdate o_conv;
12543 o_conv.inner = (void*)(o & (~1));
12544 o_conv.is_owned = (o & 1) || (o == 0);
12545 o_conv = ChannelUpdate_clone(&o_conv);
12546 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12547 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
12548 return (uint64_t)ret_conv;
12551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12552 LDKDecodeError e_conv;
12553 e_conv.inner = (void*)(e & (~1));
12554 e_conv.is_owned = (e & 1) || (e == 0);
12555 e_conv = DecodeError_clone(&e_conv);
12556 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12557 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
12558 return (uint64_t)ret_conv;
12561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12562 if ((_res & 1) != 0) return;
12563 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
12565 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
12568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12569 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
12570 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
12571 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
12572 return (uint64_t)ret_conv;
12575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12576 LDKErrorMessage o_conv;
12577 o_conv.inner = (void*)(o & (~1));
12578 o_conv.is_owned = (o & 1) || (o == 0);
12579 o_conv = ErrorMessage_clone(&o_conv);
12580 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12581 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
12582 return (uint64_t)ret_conv;
12585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12586 LDKDecodeError e_conv;
12587 e_conv.inner = (void*)(e & (~1));
12588 e_conv.is_owned = (e & 1) || (e == 0);
12589 e_conv = DecodeError_clone(&e_conv);
12590 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12591 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
12592 return (uint64_t)ret_conv;
12595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12596 if ((_res & 1) != 0) return;
12597 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
12599 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
12602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12603 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
12604 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
12605 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
12606 return (uint64_t)ret_conv;
12609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12610 LDKUnsignedNodeAnnouncement o_conv;
12611 o_conv.inner = (void*)(o & (~1));
12612 o_conv.is_owned = (o & 1) || (o == 0);
12613 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
12614 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12615 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
12616 return (uint64_t)ret_conv;
12619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12620 LDKDecodeError e_conv;
12621 e_conv.inner = (void*)(e & (~1));
12622 e_conv.is_owned = (e & 1) || (e == 0);
12623 e_conv = DecodeError_clone(&e_conv);
12624 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12625 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
12626 return (uint64_t)ret_conv;
12629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12630 if ((_res & 1) != 0) return;
12631 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12633 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
12636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12637 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
12638 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
12639 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
12640 return (uint64_t)ret_conv;
12643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12644 LDKNodeAnnouncement o_conv;
12645 o_conv.inner = (void*)(o & (~1));
12646 o_conv.is_owned = (o & 1) || (o == 0);
12647 o_conv = NodeAnnouncement_clone(&o_conv);
12648 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12649 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
12650 return (uint64_t)ret_conv;
12653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12654 LDKDecodeError e_conv;
12655 e_conv.inner = (void*)(e & (~1));
12656 e_conv.is_owned = (e & 1) || (e == 0);
12657 e_conv = DecodeError_clone(&e_conv);
12658 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12659 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
12660 return (uint64_t)ret_conv;
12663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12664 if ((_res & 1) != 0) return;
12665 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
12667 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
12670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12671 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
12672 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
12673 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
12674 return (uint64_t)ret_conv;
12677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12678 LDKQueryShortChannelIds o_conv;
12679 o_conv.inner = (void*)(o & (~1));
12680 o_conv.is_owned = (o & 1) || (o == 0);
12681 o_conv = QueryShortChannelIds_clone(&o_conv);
12682 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12683 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
12684 return (uint64_t)ret_conv;
12687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12688 LDKDecodeError e_conv;
12689 e_conv.inner = (void*)(e & (~1));
12690 e_conv.is_owned = (e & 1) || (e == 0);
12691 e_conv = DecodeError_clone(&e_conv);
12692 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12693 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
12694 return (uint64_t)ret_conv;
12697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12698 if ((_res & 1) != 0) return;
12699 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
12701 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
12704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12705 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
12706 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
12707 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
12708 return (uint64_t)ret_conv;
12711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12712 LDKReplyShortChannelIdsEnd o_conv;
12713 o_conv.inner = (void*)(o & (~1));
12714 o_conv.is_owned = (o & 1) || (o == 0);
12715 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
12716 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12717 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
12718 return (uint64_t)ret_conv;
12721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12722 LDKDecodeError e_conv;
12723 e_conv.inner = (void*)(e & (~1));
12724 e_conv.is_owned = (e & 1) || (e == 0);
12725 e_conv = DecodeError_clone(&e_conv);
12726 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12727 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
12728 return (uint64_t)ret_conv;
12731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12732 if ((_res & 1) != 0) return;
12733 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
12735 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
12738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12739 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
12740 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
12741 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
12742 return (uint64_t)ret_conv;
12745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12746 LDKQueryChannelRange o_conv;
12747 o_conv.inner = (void*)(o & (~1));
12748 o_conv.is_owned = (o & 1) || (o == 0);
12749 o_conv = QueryChannelRange_clone(&o_conv);
12750 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12751 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
12752 return (uint64_t)ret_conv;
12755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12756 LDKDecodeError e_conv;
12757 e_conv.inner = (void*)(e & (~1));
12758 e_conv.is_owned = (e & 1) || (e == 0);
12759 e_conv = DecodeError_clone(&e_conv);
12760 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12761 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
12762 return (uint64_t)ret_conv;
12765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12766 if ((_res & 1) != 0) return;
12767 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12769 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
12772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12773 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
12774 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
12775 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
12776 return (uint64_t)ret_conv;
12779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12780 LDKReplyChannelRange o_conv;
12781 o_conv.inner = (void*)(o & (~1));
12782 o_conv.is_owned = (o & 1) || (o == 0);
12783 o_conv = ReplyChannelRange_clone(&o_conv);
12784 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12785 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
12786 return (uint64_t)ret_conv;
12789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12790 LDKDecodeError e_conv;
12791 e_conv.inner = (void*)(e & (~1));
12792 e_conv.is_owned = (e & 1) || (e == 0);
12793 e_conv = DecodeError_clone(&e_conv);
12794 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12795 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
12796 return (uint64_t)ret_conv;
12799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12800 if ((_res & 1) != 0) return;
12801 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12803 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
12806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12807 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
12808 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
12809 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
12810 return (uint64_t)ret_conv;
12813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12814 LDKGossipTimestampFilter o_conv;
12815 o_conv.inner = (void*)(o & (~1));
12816 o_conv.is_owned = (o & 1) || (o == 0);
12817 o_conv = GossipTimestampFilter_clone(&o_conv);
12818 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12819 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
12820 return (uint64_t)ret_conv;
12823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12824 LDKDecodeError e_conv;
12825 e_conv.inner = (void*)(e & (~1));
12826 e_conv.is_owned = (e & 1) || (e == 0);
12827 e_conv = DecodeError_clone(&e_conv);
12828 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12829 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
12830 return (uint64_t)ret_conv;
12833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12834 if ((_res & 1) != 0) return;
12835 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
12837 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
12840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12841 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
12842 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
12843 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
12844 return (uint64_t)ret_conv;
12847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12849 o_conv.inner = (void*)(o & (~1));
12850 o_conv.is_owned = (o & 1) || (o == 0);
12851 o_conv = Invoice_clone(&o_conv);
12852 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12853 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
12854 return (uint64_t)ret_conv;
12857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12858 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
12859 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12860 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
12861 return (uint64_t)ret_conv;
12864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12865 if ((_res & 1) != 0) return;
12866 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
12868 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
12871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12872 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
12873 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
12874 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
12875 return (uint64_t)ret_conv;
12878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12879 if ((this_ptr & 1) != 0) return;
12880 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
12881 FREE((void*)this_ptr);
12882 Event_free(this_ptr_conv);
12885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12886 LDKEvent* orig_conv = (LDKEvent*)orig;
12887 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
12888 *ret_copy = Event_clone(orig_conv);
12889 uint64_t ret_ref = (uint64_t)ret_copy;
12893 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
12894 LDKEvent* obj_conv = (LDKEvent*)obj;
12895 LDKCVec_u8Z ret_var = Event_write(obj_conv);
12896 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
12897 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
12898 CVec_u8Z_free(ret_var);
12902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12903 if ((this_ptr & 1) != 0) return;
12904 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
12905 FREE((void*)this_ptr);
12906 MessageSendEvent_free(this_ptr_conv);
12909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12910 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
12911 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
12912 *ret_copy = MessageSendEvent_clone(orig_conv);
12913 uint64_t ret_ref = (uint64_t)ret_copy;
12917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12918 if ((this_ptr & 1) != 0) return;
12919 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
12920 FREE((void*)this_ptr);
12921 MessageSendEventsProvider_free(this_ptr_conv);
12924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12925 if ((this_ptr & 1) != 0) return;
12926 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
12927 FREE((void*)this_ptr);
12928 EventsProvider_free(this_ptr_conv);
12931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12932 if ((this_ptr & 1) != 0) return;
12933 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
12934 FREE((void*)this_ptr);
12935 EventHandler_free(this_ptr_conv);
12938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12939 if ((this_ptr & 1) != 0) return;
12940 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
12941 FREE((void*)this_ptr);
12942 APIError_free(this_ptr_conv);
12945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12946 LDKAPIError* orig_conv = (LDKAPIError*)orig;
12947 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
12948 *ret_copy = APIError_clone(orig_conv);
12949 uint64_t ret_ref = (uint64_t)ret_copy;
12953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
12954 LDKu8slice msg_ref;
12955 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12956 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12957 LDKSecretKey sk_ref;
12958 CHECK((*env)->GetArrayLength(env, sk) == 32);
12959 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_ref.bytes);
12960 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
12961 *ret_conv = sign(msg_ref, sk_ref);
12962 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12963 return (uint64_t)ret_conv;
12966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
12967 LDKu8slice msg_ref;
12968 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12969 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12970 LDKStr sig_conv = java_to_owned_str(env, sig);
12971 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
12972 *ret_conv = recover_pk(msg_ref, sig_conv);
12973 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12974 return (uint64_t)ret_conv;
12977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
12978 LDKu8slice msg_ref;
12979 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
12980 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
12981 LDKStr sig_conv = java_to_owned_str(env, sig);
12982 LDKPublicKey pk_ref;
12983 CHECK((*env)->GetArrayLength(env, pk) == 33);
12984 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
12985 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
12986 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
12990 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12991 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
12992 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
12996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
12997 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
12998 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
12999 jboolean ret_val = Level_eq(a_conv, b_conv);
13003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13004 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13005 int64_t ret_val = Level_hash(o_conv);
13009 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13010 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13015 if ((this_ptr & 1) != 0) return;
13016 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13017 FREE((void*)this_ptr);
13018 Logger_free(this_ptr_conv);
13021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13022 LDKChannelHandshakeConfig this_obj_conv;
13023 this_obj_conv.inner = (void*)(this_obj & (~1));
13024 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13025 ChannelHandshakeConfig_free(this_obj_conv);
13028 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13029 LDKChannelHandshakeConfig this_ptr_conv;
13030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13031 this_ptr_conv.is_owned = false;
13032 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13037 LDKChannelHandshakeConfig this_ptr_conv;
13038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13039 this_ptr_conv.is_owned = false;
13040 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13043 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13044 LDKChannelHandshakeConfig this_ptr_conv;
13045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13046 this_ptr_conv.is_owned = false;
13047 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13051 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) {
13052 LDKChannelHandshakeConfig this_ptr_conv;
13053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13054 this_ptr_conv.is_owned = false;
13055 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13059 LDKChannelHandshakeConfig this_ptr_conv;
13060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13061 this_ptr_conv.is_owned = false;
13062 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13066 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) {
13067 LDKChannelHandshakeConfig this_ptr_conv;
13068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13069 this_ptr_conv.is_owned = false;
13070 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13073 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) {
13074 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13075 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13076 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13077 uint64_t ret_ref = (uint64_t)ret_var.inner;
13078 if (ret_var.is_owned) {
13084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13085 LDKChannelHandshakeConfig orig_conv;
13086 orig_conv.inner = (void*)(orig & (~1));
13087 orig_conv.is_owned = false;
13088 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13089 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13090 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13091 uint64_t ret_ref = (uint64_t)ret_var.inner;
13092 if (ret_var.is_owned) {
13098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13099 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13100 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13101 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13102 uint64_t ret_ref = (uint64_t)ret_var.inner;
13103 if (ret_var.is_owned) {
13109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13110 LDKChannelHandshakeLimits this_obj_conv;
13111 this_obj_conv.inner = (void*)(this_obj & (~1));
13112 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13113 ChannelHandshakeLimits_free(this_obj_conv);
13116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13117 LDKChannelHandshakeLimits this_ptr_conv;
13118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13119 this_ptr_conv.is_owned = false;
13120 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13125 LDKChannelHandshakeLimits this_ptr_conv;
13126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13127 this_ptr_conv.is_owned = false;
13128 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13132 LDKChannelHandshakeLimits this_ptr_conv;
13133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13134 this_ptr_conv.is_owned = false;
13135 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13139 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) {
13140 LDKChannelHandshakeLimits this_ptr_conv;
13141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13142 this_ptr_conv.is_owned = false;
13143 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13146 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) {
13147 LDKChannelHandshakeLimits this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = false;
13150 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13154 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) {
13155 LDKChannelHandshakeLimits this_ptr_conv;
13156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13157 this_ptr_conv.is_owned = false;
13158 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13162 LDKChannelHandshakeLimits this_ptr_conv;
13163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13164 this_ptr_conv.is_owned = false;
13165 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13169 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) {
13170 LDKChannelHandshakeLimits this_ptr_conv;
13171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13172 this_ptr_conv.is_owned = false;
13173 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13176 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13177 LDKChannelHandshakeLimits this_ptr_conv;
13178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13179 this_ptr_conv.is_owned = false;
13180 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13184 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) {
13185 LDKChannelHandshakeLimits this_ptr_conv;
13186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13187 this_ptr_conv.is_owned = false;
13188 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13191 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13192 LDKChannelHandshakeLimits this_ptr_conv;
13193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13194 this_ptr_conv.is_owned = false;
13195 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13200 LDKChannelHandshakeLimits this_ptr_conv;
13201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13202 this_ptr_conv.is_owned = false;
13203 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13207 LDKChannelHandshakeLimits this_ptr_conv;
13208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13209 this_ptr_conv.is_owned = false;
13210 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13215 LDKChannelHandshakeLimits this_ptr_conv;
13216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13217 this_ptr_conv.is_owned = false;
13218 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13221 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13222 LDKChannelHandshakeLimits this_ptr_conv;
13223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13224 this_ptr_conv.is_owned = false;
13225 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13229 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) {
13230 LDKChannelHandshakeLimits this_ptr_conv;
13231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13232 this_ptr_conv.is_owned = false;
13233 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13236 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) {
13237 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);
13238 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13239 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13240 uint64_t ret_ref = (uint64_t)ret_var.inner;
13241 if (ret_var.is_owned) {
13247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13248 LDKChannelHandshakeLimits orig_conv;
13249 orig_conv.inner = (void*)(orig & (~1));
13250 orig_conv.is_owned = false;
13251 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13252 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13253 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13254 uint64_t ret_ref = (uint64_t)ret_var.inner;
13255 if (ret_var.is_owned) {
13261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13262 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13263 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13264 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13265 uint64_t ret_ref = (uint64_t)ret_var.inner;
13266 if (ret_var.is_owned) {
13272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13273 LDKChannelConfig this_obj_conv;
13274 this_obj_conv.inner = (void*)(this_obj & (~1));
13275 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13276 ChannelConfig_free(this_obj_conv);
13279 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13280 LDKChannelConfig this_ptr_conv;
13281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13282 this_ptr_conv.is_owned = false;
13283 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
13287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13288 LDKChannelConfig this_ptr_conv;
13289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13290 this_ptr_conv.is_owned = false;
13291 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
13294 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13295 LDKChannelConfig this_ptr_conv;
13296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13297 this_ptr_conv.is_owned = false;
13298 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13303 LDKChannelConfig this_ptr_conv;
13304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13305 this_ptr_conv.is_owned = false;
13306 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13310 LDKChannelConfig this_ptr_conv;
13311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13312 this_ptr_conv.is_owned = false;
13313 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13318 LDKChannelConfig this_ptr_conv;
13319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13320 this_ptr_conv.is_owned = false;
13321 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13325 LDKChannelConfig this_ptr_conv;
13326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13327 this_ptr_conv.is_owned = false;
13328 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13333 LDKChannelConfig this_ptr_conv;
13334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13335 this_ptr_conv.is_owned = false;
13336 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13340 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13343 uint64_t ret_ref = (uint64_t)ret_var.inner;
13344 if (ret_var.is_owned) {
13350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13351 LDKChannelConfig orig_conv;
13352 orig_conv.inner = (void*)(orig & (~1));
13353 orig_conv.is_owned = false;
13354 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13357 uint64_t ret_ref = (uint64_t)ret_var.inner;
13358 if (ret_var.is_owned) {
13364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13365 LDKChannelConfig ret_var = ChannelConfig_default();
13366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13368 uint64_t ret_ref = (uint64_t)ret_var.inner;
13369 if (ret_var.is_owned) {
13375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13376 LDKChannelConfig obj_conv;
13377 obj_conv.inner = (void*)(obj & (~1));
13378 obj_conv.is_owned = false;
13379 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13380 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13381 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13382 CVec_u8Z_free(ret_var);
13386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13387 LDKu8slice ser_ref;
13388 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13389 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13390 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13391 *ret_conv = ChannelConfig_read(ser_ref);
13392 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13393 return (uint64_t)ret_conv;
13396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13397 LDKUserConfig this_obj_conv;
13398 this_obj_conv.inner = (void*)(this_obj & (~1));
13399 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13400 UserConfig_free(this_obj_conv);
13403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
13404 LDKUserConfig this_ptr_conv;
13405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13406 this_ptr_conv.is_owned = false;
13407 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
13408 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13409 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13410 uint64_t ret_ref = (uint64_t)ret_var.inner;
13411 if (ret_var.is_owned) {
13417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13418 LDKUserConfig this_ptr_conv;
13419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13420 this_ptr_conv.is_owned = false;
13421 LDKChannelHandshakeConfig val_conv;
13422 val_conv.inner = (void*)(val & (~1));
13423 val_conv.is_owned = (val & 1) || (val == 0);
13424 val_conv = ChannelHandshakeConfig_clone(&val_conv);
13425 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
13428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
13429 LDKUserConfig this_ptr_conv;
13430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13431 this_ptr_conv.is_owned = false;
13432 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
13433 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13434 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13435 uint64_t ret_ref = (uint64_t)ret_var.inner;
13436 if (ret_var.is_owned) {
13442 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) {
13443 LDKUserConfig this_ptr_conv;
13444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13445 this_ptr_conv.is_owned = false;
13446 LDKChannelHandshakeLimits val_conv;
13447 val_conv.inner = (void*)(val & (~1));
13448 val_conv.is_owned = (val & 1) || (val == 0);
13449 val_conv = ChannelHandshakeLimits_clone(&val_conv);
13450 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
13453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
13454 LDKUserConfig this_ptr_conv;
13455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13456 this_ptr_conv.is_owned = false;
13457 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
13458 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13459 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13460 uint64_t ret_ref = (uint64_t)ret_var.inner;
13461 if (ret_var.is_owned) {
13467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13468 LDKUserConfig this_ptr_conv;
13469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13470 this_ptr_conv.is_owned = false;
13471 LDKChannelConfig val_conv;
13472 val_conv.inner = (void*)(val & (~1));
13473 val_conv.is_owned = (val & 1) || (val == 0);
13474 val_conv = ChannelConfig_clone(&val_conv);
13475 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
13478 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) {
13479 LDKChannelHandshakeConfig own_channel_config_arg_conv;
13480 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
13481 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
13482 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
13483 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
13484 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
13485 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
13486 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
13487 LDKChannelConfig channel_options_arg_conv;
13488 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
13489 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
13490 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
13491 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
13492 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13493 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13494 uint64_t ret_ref = (uint64_t)ret_var.inner;
13495 if (ret_var.is_owned) {
13501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13502 LDKUserConfig orig_conv;
13503 orig_conv.inner = (void*)(orig & (~1));
13504 orig_conv.is_owned = false;
13505 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
13506 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13507 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13508 uint64_t ret_ref = (uint64_t)ret_var.inner;
13509 if (ret_var.is_owned) {
13515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
13516 LDKUserConfig ret_var = UserConfig_default();
13517 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13518 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13519 uint64_t ret_ref = (uint64_t)ret_var.inner;
13520 if (ret_var.is_owned) {
13526 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13527 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
13528 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
13532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13533 if ((this_ptr & 1) != 0) return;
13534 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
13535 FREE((void*)this_ptr);
13536 Access_free(this_ptr_conv);
13539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13540 if ((this_ptr & 1) != 0) return;
13541 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
13542 FREE((void*)this_ptr);
13543 Listen_free(this_ptr_conv);
13546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13547 if ((this_ptr & 1) != 0) return;
13548 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
13549 FREE((void*)this_ptr);
13550 Confirm_free(this_ptr_conv);
13553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13554 if ((this_ptr & 1) != 0) return;
13555 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
13556 FREE((void*)this_ptr);
13557 Watch_free(this_ptr_conv);
13560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13561 if ((this_ptr & 1) != 0) return;
13562 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
13563 FREE((void*)this_ptr);
13564 Filter_free(this_ptr_conv);
13567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13568 LDKWatchedOutput this_obj_conv;
13569 this_obj_conv.inner = (void*)(this_obj & (~1));
13570 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13571 WatchedOutput_free(this_obj_conv);
13574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
13575 LDKWatchedOutput this_ptr_conv;
13576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13577 this_ptr_conv.is_owned = false;
13578 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
13579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
13583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13584 LDKWatchedOutput this_ptr_conv;
13585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13586 this_ptr_conv.is_owned = false;
13587 LDKThirtyTwoBytes val_ref;
13588 CHECK((*env)->GetArrayLength(env, val) == 32);
13589 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
13590 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
13593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
13594 LDKWatchedOutput this_ptr_conv;
13595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13596 this_ptr_conv.is_owned = false;
13597 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
13598 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13599 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13600 uint64_t ret_ref = (uint64_t)ret_var.inner;
13601 if (ret_var.is_owned) {
13607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13608 LDKWatchedOutput this_ptr_conv;
13609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13610 this_ptr_conv.is_owned = false;
13611 LDKOutPoint val_conv;
13612 val_conv.inner = (void*)(val & (~1));
13613 val_conv.is_owned = (val & 1) || (val == 0);
13614 val_conv = OutPoint_clone(&val_conv);
13615 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
13618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13619 LDKWatchedOutput this_ptr_conv;
13620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13621 this_ptr_conv.is_owned = false;
13622 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
13623 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13624 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
13629 LDKWatchedOutput this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = false;
13632 LDKCVec_u8Z val_ref;
13633 val_ref.datalen = (*env)->GetArrayLength(env, val);
13634 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
13635 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
13636 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
13639 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) {
13640 LDKThirtyTwoBytes block_hash_arg_ref;
13641 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
13642 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
13643 LDKOutPoint outpoint_arg_conv;
13644 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
13645 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
13646 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
13647 LDKCVec_u8Z script_pubkey_arg_ref;
13648 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
13649 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13650 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
13651 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
13652 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13653 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13654 uint64_t ret_ref = (uint64_t)ret_var.inner;
13655 if (ret_var.is_owned) {
13661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13662 LDKWatchedOutput orig_conv;
13663 orig_conv.inner = (void*)(orig & (~1));
13664 orig_conv.is_owned = false;
13665 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
13666 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13667 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13668 uint64_t ret_ref = (uint64_t)ret_var.inner;
13669 if (ret_var.is_owned) {
13675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
13676 LDKWatchedOutput o_conv;
13677 o_conv.inner = (void*)(o & (~1));
13678 o_conv.is_owned = false;
13679 int64_t ret_val = WatchedOutput_hash(&o_conv);
13683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13684 if ((this_ptr & 1) != 0) return;
13685 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
13686 FREE((void*)this_ptr);
13687 BroadcasterInterface_free(this_ptr_conv);
13690 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13691 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
13692 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
13696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13697 if ((this_ptr & 1) != 0) return;
13698 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
13699 FREE((void*)this_ptr);
13700 FeeEstimator_free(this_ptr_conv);
13703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13704 LDKChainMonitor this_obj_conv;
13705 this_obj_conv.inner = (void*)(this_obj & (~1));
13706 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13707 ChainMonitor_free(this_obj_conv);
13710 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) {
13711 LDKFilter *chain_source_conv_ptr = NULL;
13712 if (chain_source != 0) {
13713 LDKFilter chain_source_conv;
13714 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
13715 if (chain_source_conv.free == LDKFilter_JCalls_free) {
13716 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13717 LDKFilter_JCalls_clone(chain_source_conv.this_arg);
13719 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
13720 *chain_source_conv_ptr = chain_source_conv;
13722 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13723 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
13724 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13725 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
13727 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
13728 if (logger_conv.free == LDKLogger_JCalls_free) {
13729 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13730 LDKLogger_JCalls_clone(logger_conv.this_arg);
13732 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
13733 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
13734 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13735 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
13737 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
13738 if (persister_conv.free == LDKPersist_JCalls_free) {
13739 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13740 LDKPersist_JCalls_clone(persister_conv.this_arg);
13742 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
13743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13745 uint64_t ret_ref = (uint64_t)ret_var.inner;
13746 if (ret_var.is_owned) {
13752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
13753 LDKChainMonitor this_arg_conv;
13754 this_arg_conv.inner = (void*)(this_arg & (~1));
13755 this_arg_conv.is_owned = false;
13756 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
13757 *ret = ChainMonitor_as_Listen(&this_arg_conv);
13758 return (uint64_t)ret;
13761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
13762 LDKChainMonitor this_arg_conv;
13763 this_arg_conv.inner = (void*)(this_arg & (~1));
13764 this_arg_conv.is_owned = false;
13765 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
13766 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
13767 return (uint64_t)ret;
13770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13771 LDKChainMonitor this_arg_conv;
13772 this_arg_conv.inner = (void*)(this_arg & (~1));
13773 this_arg_conv.is_owned = false;
13774 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
13775 *ret = ChainMonitor_as_Watch(&this_arg_conv);
13776 return (uint64_t)ret;
13779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
13780 LDKChainMonitor this_arg_conv;
13781 this_arg_conv.inner = (void*)(this_arg & (~1));
13782 this_arg_conv.is_owned = false;
13783 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
13784 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
13785 return (uint64_t)ret;
13788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13789 LDKChannelMonitorUpdate this_obj_conv;
13790 this_obj_conv.inner = (void*)(this_obj & (~1));
13791 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13792 ChannelMonitorUpdate_free(this_obj_conv);
13795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
13796 LDKChannelMonitorUpdate this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = false;
13799 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
13803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13804 LDKChannelMonitorUpdate this_ptr_conv;
13805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13806 this_ptr_conv.is_owned = false;
13807 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
13810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13811 LDKChannelMonitorUpdate orig_conv;
13812 orig_conv.inner = (void*)(orig & (~1));
13813 orig_conv.is_owned = false;
13814 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
13815 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13816 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13817 uint64_t ret_ref = (uint64_t)ret_var.inner;
13818 if (ret_var.is_owned) {
13824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13825 LDKChannelMonitorUpdate obj_conv;
13826 obj_conv.inner = (void*)(obj & (~1));
13827 obj_conv.is_owned = false;
13828 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
13829 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13830 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13831 CVec_u8Z_free(ret_var);
13835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13836 LDKu8slice ser_ref;
13837 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13838 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13839 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
13840 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
13841 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13842 return (uint64_t)ret_conv;
13845 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13846 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
13847 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
13851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13852 LDKMonitorUpdateError this_obj_conv;
13853 this_obj_conv.inner = (void*)(this_obj & (~1));
13854 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13855 MonitorUpdateError_free(this_obj_conv);
13858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13859 LDKMonitorUpdateError orig_conv;
13860 orig_conv.inner = (void*)(orig & (~1));
13861 orig_conv.is_owned = false;
13862 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
13863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13865 uint64_t ret_ref = (uint64_t)ret_var.inner;
13866 if (ret_var.is_owned) {
13872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13873 if ((this_ptr & 1) != 0) return;
13874 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
13875 FREE((void*)this_ptr);
13876 MonitorEvent_free(this_ptr_conv);
13879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13880 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
13881 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
13882 *ret_copy = MonitorEvent_clone(orig_conv);
13883 uint64_t ret_ref = (uint64_t)ret_copy;
13887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13888 LDKHTLCUpdate this_obj_conv;
13889 this_obj_conv.inner = (void*)(this_obj & (~1));
13890 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13891 HTLCUpdate_free(this_obj_conv);
13894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13895 LDKHTLCUpdate orig_conv;
13896 orig_conv.inner = (void*)(orig & (~1));
13897 orig_conv.is_owned = false;
13898 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
13899 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13900 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13901 uint64_t ret_ref = (uint64_t)ret_var.inner;
13902 if (ret_var.is_owned) {
13908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13909 LDKHTLCUpdate obj_conv;
13910 obj_conv.inner = (void*)(obj & (~1));
13911 obj_conv.is_owned = false;
13912 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
13913 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13914 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13915 CVec_u8Z_free(ret_var);
13919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13920 LDKu8slice ser_ref;
13921 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13922 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13923 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
13924 *ret_conv = HTLCUpdate_read(ser_ref);
13925 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13926 return (uint64_t)ret_conv;
13929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13930 LDKChannelMonitor this_obj_conv;
13931 this_obj_conv.inner = (void*)(this_obj & (~1));
13932 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13933 ChannelMonitor_free(this_obj_conv);
13936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13937 LDKChannelMonitor orig_conv;
13938 orig_conv.inner = (void*)(orig & (~1));
13939 orig_conv.is_owned = false;
13940 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
13941 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13942 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13943 uint64_t ret_ref = (uint64_t)ret_var.inner;
13944 if (ret_var.is_owned) {
13950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
13951 LDKChannelMonitor obj_conv;
13952 obj_conv.inner = (void*)(obj & (~1));
13953 obj_conv.is_owned = false;
13954 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
13955 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13956 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13957 CVec_u8Z_free(ret_var);
13961 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) {
13962 LDKChannelMonitor this_arg_conv;
13963 this_arg_conv.inner = (void*)(this_arg & (~1));
13964 this_arg_conv.is_owned = false;
13965 LDKChannelMonitorUpdate updates_conv;
13966 updates_conv.inner = (void*)(updates & (~1));
13967 updates_conv.is_owned = false;
13968 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
13969 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
13970 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
13971 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
13972 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
13973 return (uint64_t)ret_conv;
13976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
13977 LDKChannelMonitor this_arg_conv;
13978 this_arg_conv.inner = (void*)(this_arg & (~1));
13979 this_arg_conv.is_owned = false;
13980 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
13984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
13985 LDKChannelMonitor this_arg_conv;
13986 this_arg_conv.inner = (void*)(this_arg & (~1));
13987 this_arg_conv.is_owned = false;
13988 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
13989 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
13990 return (uint64_t)ret_ref;
13993 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
13994 LDKChannelMonitor this_arg_conv;
13995 this_arg_conv.inner = (void*)(this_arg & (~1));
13996 this_arg_conv.is_owned = false;
13997 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
13998 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
13999 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14000 for (size_t v = 0; v < ret_var.datalen; v++) {
14001 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14002 *ret_conv_47_ref = ret_var.data[v];
14003 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14005 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14006 FREE(ret_var.data);
14010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14011 LDKChannelMonitor this_arg_conv;
14012 this_arg_conv.inner = (void*)(this_arg & (~1));
14013 this_arg_conv.is_owned = false;
14014 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14015 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14018 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14019 LDKChannelMonitor this_arg_conv;
14020 this_arg_conv.inner = (void*)(this_arg & (~1));
14021 this_arg_conv.is_owned = false;
14022 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14023 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14024 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14025 for (size_t o = 0; o < ret_var.datalen; o++) {
14026 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14027 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14028 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14029 ret_arr_ptr[o] = ret_conv_14_ref;
14031 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14032 FREE(ret_var.data);
14036 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14037 LDKChannelMonitor this_arg_conv;
14038 this_arg_conv.inner = (void*)(this_arg & (~1));
14039 this_arg_conv.is_owned = false;
14040 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14041 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14042 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14043 for (size_t h = 0; h < ret_var.datalen; h++) {
14044 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14045 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14046 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14047 ret_arr_ptr[h] = ret_conv_7_ref;
14049 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14050 FREE(ret_var.data);
14054 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) {
14055 LDKChannelMonitor this_arg_conv;
14056 this_arg_conv.inner = (void*)(this_arg & (~1));
14057 this_arg_conv.is_owned = false;
14058 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14059 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14060 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14062 for (size_t i = 0; i < ret_var.datalen; i++) {
14063 LDKTransaction ret_conv_8_var = ret_var.data[i];
14064 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14065 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14066 Transaction_free(ret_conv_8_var);
14067 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14069 FREE(ret_var.data);
14073 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) {
14074 LDKChannelMonitor this_arg_conv;
14075 this_arg_conv.inner = (void*)(this_arg & (~1));
14076 this_arg_conv.is_owned = false;
14077 unsigned char header_arr[80];
14078 CHECK((*env)->GetArrayLength(env, header) == 80);
14079 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14080 unsigned char (*header_ref)[80] = &header_arr;
14081 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14082 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14083 if (txdata_constr.datalen > 0)
14084 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14086 txdata_constr.data = NULL;
14087 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14088 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14089 int64_t txdata_conv_24 = txdata_vals[y];
14090 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14091 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14092 txdata_constr.data[y] = txdata_conv_24_conv;
14094 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14095 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14096 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14097 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14098 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14100 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14101 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14103 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14105 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14106 if (logger_conv.free == LDKLogger_JCalls_free) {
14107 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14108 LDKLogger_JCalls_clone(logger_conv.this_arg);
14110 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);
14111 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14112 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14113 for (size_t u = 0; u < ret_var.datalen; u++) {
14114 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14115 *ret_conv_46_ref = ret_var.data[u];
14116 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14118 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14119 FREE(ret_var.data);
14123 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) {
14124 LDKChannelMonitor this_arg_conv;
14125 this_arg_conv.inner = (void*)(this_arg & (~1));
14126 this_arg_conv.is_owned = false;
14127 unsigned char header_arr[80];
14128 CHECK((*env)->GetArrayLength(env, header) == 80);
14129 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14130 unsigned char (*header_ref)[80] = &header_arr;
14131 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14132 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14133 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14134 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14136 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14137 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14138 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14139 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14141 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14142 if (logger_conv.free == LDKLogger_JCalls_free) {
14143 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14144 LDKLogger_JCalls_clone(logger_conv.this_arg);
14146 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14149 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) {
14150 LDKChannelMonitor this_arg_conv;
14151 this_arg_conv.inner = (void*)(this_arg & (~1));
14152 this_arg_conv.is_owned = false;
14153 unsigned char header_arr[80];
14154 CHECK((*env)->GetArrayLength(env, header) == 80);
14155 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14156 unsigned char (*header_ref)[80] = &header_arr;
14157 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14158 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14159 if (txdata_constr.datalen > 0)
14160 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14162 txdata_constr.data = NULL;
14163 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14164 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14165 int64_t txdata_conv_24 = txdata_vals[y];
14166 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14167 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14168 txdata_constr.data[y] = txdata_conv_24_conv;
14170 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14171 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14172 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14173 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14174 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14176 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14177 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14179 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14181 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14182 if (logger_conv.free == LDKLogger_JCalls_free) {
14183 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14184 LDKLogger_JCalls_clone(logger_conv.this_arg);
14186 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);
14187 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14188 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14189 for (size_t u = 0; u < ret_var.datalen; u++) {
14190 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14191 *ret_conv_46_ref = ret_var.data[u];
14192 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14194 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14195 FREE(ret_var.data);
14199 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) {
14200 LDKChannelMonitor this_arg_conv;
14201 this_arg_conv.inner = (void*)(this_arg & (~1));
14202 this_arg_conv.is_owned = false;
14203 unsigned char txid_arr[32];
14204 CHECK((*env)->GetArrayLength(env, txid) == 32);
14205 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14206 unsigned char (*txid_ref)[32] = &txid_arr;
14207 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14208 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14209 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14210 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14212 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14213 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14215 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14217 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14218 if (logger_conv.free == LDKLogger_JCalls_free) {
14219 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14220 LDKLogger_JCalls_clone(logger_conv.this_arg);
14222 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14225 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) {
14226 LDKChannelMonitor this_arg_conv;
14227 this_arg_conv.inner = (void*)(this_arg & (~1));
14228 this_arg_conv.is_owned = false;
14229 unsigned char header_arr[80];
14230 CHECK((*env)->GetArrayLength(env, header) == 80);
14231 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14232 unsigned char (*header_ref)[80] = &header_arr;
14233 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14234 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14235 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14236 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
14238 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14239 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14241 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
14243 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14244 if (logger_conv.free == LDKLogger_JCalls_free) {
14245 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14246 LDKLogger_JCalls_clone(logger_conv.this_arg);
14248 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14249 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14250 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14251 for (size_t u = 0; u < ret_var.datalen; u++) {
14252 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14253 *ret_conv_46_ref = ret_var.data[u];
14254 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14256 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14257 FREE(ret_var.data);
14261 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14262 LDKChannelMonitor this_arg_conv;
14263 this_arg_conv.inner = (void*)(this_arg & (~1));
14264 this_arg_conv.is_owned = false;
14265 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14266 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14268 for (size_t i = 0; i < ret_var.datalen; i++) {
14269 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14270 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14271 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14273 FREE(ret_var.data);
14277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14278 if ((this_ptr & 1) != 0) return;
14279 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14280 FREE((void*)this_ptr);
14281 Persist_free(this_ptr_conv);
14284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14285 LDKu8slice ser_ref;
14286 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14287 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14288 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14289 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14290 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14291 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14292 return (uint64_t)ret_conv;
14295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14296 LDKOutPoint this_obj_conv;
14297 this_obj_conv.inner = (void*)(this_obj & (~1));
14298 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14299 OutPoint_free(this_obj_conv);
14302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
14303 LDKOutPoint this_ptr_conv;
14304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14305 this_ptr_conv.is_owned = false;
14306 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14307 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
14311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14312 LDKOutPoint this_ptr_conv;
14313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14314 this_ptr_conv.is_owned = false;
14315 LDKThirtyTwoBytes val_ref;
14316 CHECK((*env)->GetArrayLength(env, val) == 32);
14317 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14318 OutPoint_set_txid(&this_ptr_conv, val_ref);
14321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
14322 LDKOutPoint this_ptr_conv;
14323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14324 this_ptr_conv.is_owned = false;
14325 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
14329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14330 LDKOutPoint this_ptr_conv;
14331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14332 this_ptr_conv.is_owned = false;
14333 OutPoint_set_index(&this_ptr_conv, val);
14336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
14337 LDKThirtyTwoBytes txid_arg_ref;
14338 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
14339 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
14340 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
14341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14343 uint64_t ret_ref = (uint64_t)ret_var.inner;
14344 if (ret_var.is_owned) {
14350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14351 LDKOutPoint orig_conv;
14352 orig_conv.inner = (void*)(orig & (~1));
14353 orig_conv.is_owned = false;
14354 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
14355 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14356 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14357 uint64_t ret_ref = (uint64_t)ret_var.inner;
14358 if (ret_var.is_owned) {
14364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
14365 LDKOutPoint a_conv;
14366 a_conv.inner = (void*)(a & (~1));
14367 a_conv.is_owned = false;
14368 LDKOutPoint b_conv;
14369 b_conv.inner = (void*)(b & (~1));
14370 b_conv.is_owned = false;
14371 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
14375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
14376 LDKOutPoint o_conv;
14377 o_conv.inner = (void*)(o & (~1));
14378 o_conv.is_owned = false;
14379 int64_t ret_val = OutPoint_hash(&o_conv);
14383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14384 LDKOutPoint this_arg_conv;
14385 this_arg_conv.inner = (void*)(this_arg & (~1));
14386 this_arg_conv.is_owned = false;
14387 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14388 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
14392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
14393 LDKOutPoint obj_conv;
14394 obj_conv.inner = (void*)(obj & (~1));
14395 obj_conv.is_owned = false;
14396 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
14397 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14398 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14399 CVec_u8Z_free(ret_var);
14403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14404 LDKu8slice ser_ref;
14405 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14406 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14407 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
14408 *ret_conv = OutPoint_read(ser_ref);
14409 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14410 return (uint64_t)ret_conv;
14413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14414 LDKDelayedPaymentOutputDescriptor this_obj_conv;
14415 this_obj_conv.inner = (void*)(this_obj & (~1));
14416 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14417 DelayedPaymentOutputDescriptor_free(this_obj_conv);
14420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14421 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14423 this_ptr_conv.is_owned = false;
14424 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14425 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14426 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14427 uint64_t ret_ref = (uint64_t)ret_var.inner;
14428 if (ret_var.is_owned) {
14434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14435 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14437 this_ptr_conv.is_owned = false;
14438 LDKOutPoint val_conv;
14439 val_conv.inner = (void*)(val & (~1));
14440 val_conv.is_owned = (val & 1) || (val == 0);
14441 val_conv = OutPoint_clone(&val_conv);
14442 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14446 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14448 this_ptr_conv.is_owned = false;
14449 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14450 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
14454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14455 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14457 this_ptr_conv.is_owned = false;
14458 LDKPublicKey val_ref;
14459 CHECK((*env)->GetArrayLength(env, val) == 33);
14460 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14461 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
14464 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14465 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14467 this_ptr_conv.is_owned = false;
14468 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
14472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14473 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14475 this_ptr_conv.is_owned = false;
14476 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
14479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14480 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14482 this_ptr_conv.is_owned = false;
14483 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14484 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14488 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14490 this_ptr_conv.is_owned = false;
14491 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
14492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
14496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14497 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14499 this_ptr_conv.is_owned = false;
14500 LDKPublicKey val_ref;
14501 CHECK((*env)->GetArrayLength(env, val) == 33);
14502 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14503 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
14506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14507 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14509 this_ptr_conv.is_owned = false;
14510 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14511 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14516 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14518 this_ptr_conv.is_owned = false;
14519 LDKThirtyTwoBytes val_ref;
14520 CHECK((*env)->GetArrayLength(env, val) == 32);
14521 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14522 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14526 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14528 this_ptr_conv.is_owned = false;
14529 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14534 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
14535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14536 this_ptr_conv.is_owned = false;
14537 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14540 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) {
14541 LDKOutPoint outpoint_arg_conv;
14542 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14543 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14544 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14545 LDKPublicKey per_commitment_point_arg_ref;
14546 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14547 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14548 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14549 LDKPublicKey revocation_pubkey_arg_ref;
14550 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
14551 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
14552 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14553 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14554 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14555 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);
14556 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14557 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14558 uint64_t ret_ref = (uint64_t)ret_var.inner;
14559 if (ret_var.is_owned) {
14565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14566 LDKDelayedPaymentOutputDescriptor orig_conv;
14567 orig_conv.inner = (void*)(orig & (~1));
14568 orig_conv.is_owned = false;
14569 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
14570 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14571 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14572 uint64_t ret_ref = (uint64_t)ret_var.inner;
14573 if (ret_var.is_owned) {
14579 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14580 LDKDelayedPaymentOutputDescriptor obj_conv;
14581 obj_conv.inner = (void*)(obj & (~1));
14582 obj_conv.is_owned = false;
14583 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
14584 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14585 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14586 CVec_u8Z_free(ret_var);
14590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14591 LDKu8slice ser_ref;
14592 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14593 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14594 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14595 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
14596 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14597 return (uint64_t)ret_conv;
14600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14601 LDKStaticPaymentOutputDescriptor this_obj_conv;
14602 this_obj_conv.inner = (void*)(this_obj & (~1));
14603 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14604 StaticPaymentOutputDescriptor_free(this_obj_conv);
14607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14608 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14610 this_ptr_conv.is_owned = false;
14611 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
14612 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14613 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14614 uint64_t ret_ref = (uint64_t)ret_var.inner;
14615 if (ret_var.is_owned) {
14621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14622 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14624 this_ptr_conv.is_owned = false;
14625 LDKOutPoint val_conv;
14626 val_conv.inner = (void*)(val & (~1));
14627 val_conv.is_owned = (val & 1) || (val == 0);
14628 val_conv = OutPoint_clone(&val_conv);
14629 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
14632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14633 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14635 this_ptr_conv.is_owned = false;
14636 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
14637 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
14640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14641 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14643 this_ptr_conv.is_owned = false;
14644 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14645 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
14649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14650 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14652 this_ptr_conv.is_owned = false;
14653 LDKThirtyTwoBytes val_ref;
14654 CHECK((*env)->GetArrayLength(env, val) == 32);
14655 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14656 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
14659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
14660 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14662 this_ptr_conv.is_owned = false;
14663 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
14667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14668 LDKStaticPaymentOutputDescriptor this_ptr_conv;
14669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14670 this_ptr_conv.is_owned = false;
14671 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
14674 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) {
14675 LDKOutPoint outpoint_arg_conv;
14676 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14677 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14678 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14679 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
14680 LDKThirtyTwoBytes channel_keys_id_arg_ref;
14681 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
14682 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
14683 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
14684 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14685 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14686 uint64_t ret_ref = (uint64_t)ret_var.inner;
14687 if (ret_var.is_owned) {
14693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14694 LDKStaticPaymentOutputDescriptor orig_conv;
14695 orig_conv.inner = (void*)(orig & (~1));
14696 orig_conv.is_owned = false;
14697 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
14698 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14699 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14700 uint64_t ret_ref = (uint64_t)ret_var.inner;
14701 if (ret_var.is_owned) {
14707 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14708 LDKStaticPaymentOutputDescriptor obj_conv;
14709 obj_conv.inner = (void*)(obj & (~1));
14710 obj_conv.is_owned = false;
14711 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
14712 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14713 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14714 CVec_u8Z_free(ret_var);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14719 LDKu8slice ser_ref;
14720 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14721 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14722 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14723 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
14724 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14725 return (uint64_t)ret_conv;
14728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14729 if ((this_ptr & 1) != 0) return;
14730 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
14731 FREE((void*)this_ptr);
14732 SpendableOutputDescriptor_free(this_ptr_conv);
14735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14736 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
14737 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
14738 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
14739 uint64_t ret_ref = (uint64_t)ret_copy;
14743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14744 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
14745 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
14746 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14747 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14748 CVec_u8Z_free(ret_var);
14752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14753 LDKu8slice ser_ref;
14754 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14755 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14756 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14757 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
14758 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14759 return (uint64_t)ret_conv;
14762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14763 if ((this_ptr & 1) != 0) return;
14764 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
14765 FREE((void*)this_ptr);
14766 BaseSign_free(this_ptr_conv);
14769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14770 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
14771 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
14772 *ret = Sign_clone(orig_conv);
14773 return (uint64_t)ret;
14776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14777 if ((this_ptr & 1) != 0) return;
14778 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
14779 FREE((void*)this_ptr);
14780 Sign_free(this_ptr_conv);
14783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14784 if ((this_ptr & 1) != 0) return;
14785 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
14786 FREE((void*)this_ptr);
14787 KeysInterface_free(this_ptr_conv);
14790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14791 LDKInMemorySigner this_obj_conv;
14792 this_obj_conv.inner = (void*)(this_obj & (~1));
14793 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14794 InMemorySigner_free(this_obj_conv);
14797 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14798 LDKInMemorySigner this_ptr_conv;
14799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14800 this_ptr_conv.is_owned = false;
14801 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14802 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
14806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14807 LDKInMemorySigner this_ptr_conv;
14808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14809 this_ptr_conv.is_owned = false;
14810 LDKSecretKey val_ref;
14811 CHECK((*env)->GetArrayLength(env, val) == 32);
14812 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14813 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
14816 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14817 LDKInMemorySigner this_ptr_conv;
14818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14819 this_ptr_conv.is_owned = false;
14820 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14821 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
14825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14826 LDKInMemorySigner this_ptr_conv;
14827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14828 this_ptr_conv.is_owned = false;
14829 LDKSecretKey val_ref;
14830 CHECK((*env)->GetArrayLength(env, val) == 32);
14831 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14832 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
14835 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14836 LDKInMemorySigner 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, *InMemorySigner_get_payment_key(&this_ptr_conv));
14844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14845 LDKInMemorySigner this_ptr_conv;
14846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14847 this_ptr_conv.is_owned = false;
14848 LDKSecretKey val_ref;
14849 CHECK((*env)->GetArrayLength(env, val) == 32);
14850 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14851 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
14854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14855 LDKInMemorySigner this_ptr_conv;
14856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14857 this_ptr_conv.is_owned = false;
14858 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14859 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
14863 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) {
14864 LDKInMemorySigner this_ptr_conv;
14865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14866 this_ptr_conv.is_owned = false;
14867 LDKSecretKey val_ref;
14868 CHECK((*env)->GetArrayLength(env, val) == 32);
14869 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14870 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
14873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14874 LDKInMemorySigner this_ptr_conv;
14875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14876 this_ptr_conv.is_owned = false;
14877 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14878 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
14882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14883 LDKInMemorySigner this_ptr_conv;
14884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14885 this_ptr_conv.is_owned = false;
14886 LDKSecretKey val_ref;
14887 CHECK((*env)->GetArrayLength(env, val) == 32);
14888 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
14889 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
14892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
14893 LDKInMemorySigner this_ptr_conv;
14894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14895 this_ptr_conv.is_owned = false;
14896 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14897 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
14901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14902 LDKInMemorySigner this_ptr_conv;
14903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14904 this_ptr_conv.is_owned = false;
14905 LDKThirtyTwoBytes val_ref;
14906 CHECK((*env)->GetArrayLength(env, val) == 32);
14907 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14908 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
14911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14912 LDKInMemorySigner orig_conv;
14913 orig_conv.inner = (void*)(orig & (~1));
14914 orig_conv.is_owned = false;
14915 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
14916 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14917 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14918 uint64_t ret_ref = (uint64_t)ret_var.inner;
14919 if (ret_var.is_owned) {
14925 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) {
14926 LDKSecretKey funding_key_ref;
14927 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
14928 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
14929 LDKSecretKey revocation_base_key_ref;
14930 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
14931 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
14932 LDKSecretKey payment_key_ref;
14933 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
14934 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
14935 LDKSecretKey delayed_payment_base_key_ref;
14936 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
14937 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
14938 LDKSecretKey htlc_base_key_ref;
14939 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
14940 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
14941 LDKThirtyTwoBytes commitment_seed_ref;
14942 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14943 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
14944 LDKThirtyTwoBytes channel_keys_id_ref;
14945 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
14946 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
14947 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);
14948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14950 uint64_t ret_ref = (uint64_t)ret_var.inner;
14951 if (ret_var.is_owned) {
14957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
14958 LDKInMemorySigner this_arg_conv;
14959 this_arg_conv.inner = (void*)(this_arg & (~1));
14960 this_arg_conv.is_owned = false;
14961 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
14962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14964 uint64_t ret_ref = (uint64_t)ret_var.inner;
14965 if (ret_var.is_owned) {
14971 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14972 LDKInMemorySigner this_arg_conv;
14973 this_arg_conv.inner = (void*)(this_arg & (~1));
14974 this_arg_conv.is_owned = false;
14975 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
14979 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
14980 LDKInMemorySigner this_arg_conv;
14981 this_arg_conv.inner = (void*)(this_arg & (~1));
14982 this_arg_conv.is_owned = false;
14983 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
14987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
14988 LDKInMemorySigner this_arg_conv;
14989 this_arg_conv.inner = (void*)(this_arg & (~1));
14990 this_arg_conv.is_owned = false;
14991 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
14995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
14996 LDKInMemorySigner this_arg_conv;
14997 this_arg_conv.inner = (void*)(this_arg & (~1));
14998 this_arg_conv.is_owned = false;
14999 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15002 uint64_t ret_ref = (uint64_t)ret_var.inner;
15003 if (ret_var.is_owned) {
15009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15010 LDKInMemorySigner this_arg_conv;
15011 this_arg_conv.inner = (void*)(this_arg & (~1));
15012 this_arg_conv.is_owned = false;
15013 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15016 uint64_t ret_ref = (uint64_t)ret_var.inner;
15017 if (ret_var.is_owned) {
15023 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) {
15024 LDKInMemorySigner this_arg_conv;
15025 this_arg_conv.inner = (void*)(this_arg & (~1));
15026 this_arg_conv.is_owned = false;
15027 LDKTransaction spend_tx_ref;
15028 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15029 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15030 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15031 spend_tx_ref.data_is_owned = true;
15032 LDKStaticPaymentOutputDescriptor descriptor_conv;
15033 descriptor_conv.inner = (void*)(descriptor & (~1));
15034 descriptor_conv.is_owned = false;
15035 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15036 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15037 return (uint64_t)ret_conv;
15040 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) {
15041 LDKInMemorySigner this_arg_conv;
15042 this_arg_conv.inner = (void*)(this_arg & (~1));
15043 this_arg_conv.is_owned = false;
15044 LDKTransaction spend_tx_ref;
15045 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15046 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15047 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15048 spend_tx_ref.data_is_owned = true;
15049 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15050 descriptor_conv.inner = (void*)(descriptor & (~1));
15051 descriptor_conv.is_owned = false;
15052 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15053 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15054 return (uint64_t)ret_conv;
15057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15058 LDKInMemorySigner this_arg_conv;
15059 this_arg_conv.inner = (void*)(this_arg & (~1));
15060 this_arg_conv.is_owned = false;
15061 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15062 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15063 return (uint64_t)ret;
15066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15067 LDKInMemorySigner this_arg_conv;
15068 this_arg_conv.inner = (void*)(this_arg & (~1));
15069 this_arg_conv.is_owned = false;
15070 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15071 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15072 return (uint64_t)ret;
15075 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15076 LDKInMemorySigner obj_conv;
15077 obj_conv.inner = (void*)(obj & (~1));
15078 obj_conv.is_owned = false;
15079 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15080 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15081 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15082 CVec_u8Z_free(ret_var);
15086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15087 LDKu8slice ser_ref;
15088 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15089 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15090 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15091 *ret_conv = InMemorySigner_read(ser_ref);
15092 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15093 return (uint64_t)ret_conv;
15096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15097 LDKKeysManager this_obj_conv;
15098 this_obj_conv.inner = (void*)(this_obj & (~1));
15099 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15100 KeysManager_free(this_obj_conv);
15103 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) {
15104 unsigned char seed_arr[32];
15105 CHECK((*env)->GetArrayLength(env, seed) == 32);
15106 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15107 unsigned char (*seed_ref)[32] = &seed_arr;
15108 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15109 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15110 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15111 uint64_t ret_ref = (uint64_t)ret_var.inner;
15112 if (ret_var.is_owned) {
15118 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) {
15119 LDKKeysManager this_arg_conv;
15120 this_arg_conv.inner = (void*)(this_arg & (~1));
15121 this_arg_conv.is_owned = false;
15122 unsigned char params_arr[32];
15123 CHECK((*env)->GetArrayLength(env, params) == 32);
15124 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15125 unsigned char (*params_ref)[32] = ¶ms_arr;
15126 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15127 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15128 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15129 uint64_t ret_ref = (uint64_t)ret_var.inner;
15130 if (ret_var.is_owned) {
15136 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) {
15137 LDKKeysManager this_arg_conv;
15138 this_arg_conv.inner = (void*)(this_arg & (~1));
15139 this_arg_conv.is_owned = false;
15140 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15141 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15142 if (descriptors_constr.datalen > 0)
15143 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15145 descriptors_constr.data = NULL;
15146 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15147 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15148 int64_t descriptors_conv_27 = descriptors_vals[b];
15149 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15150 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15151 descriptors_constr.data[b] = descriptors_conv_27_conv;
15153 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15154 LDKCVec_TxOutZ outputs_constr;
15155 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15156 if (outputs_constr.datalen > 0)
15157 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15159 outputs_constr.data = NULL;
15160 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15161 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15162 int64_t outputs_conv_7 = outputs_vals[h];
15163 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15164 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15165 outputs_constr.data[h] = outputs_conv_7_conv;
15167 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15168 LDKCVec_u8Z change_destination_script_ref;
15169 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15170 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15171 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15172 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15173 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15174 return (uint64_t)ret_conv;
15177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15178 LDKKeysManager this_arg_conv;
15179 this_arg_conv.inner = (void*)(this_arg & (~1));
15180 this_arg_conv.is_owned = false;
15181 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15182 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15183 return (uint64_t)ret;
15186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15187 LDKChannelManager this_obj_conv;
15188 this_obj_conv.inner = (void*)(this_obj & (~1));
15189 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15190 ChannelManager_free(this_obj_conv);
15193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15194 LDKChainParameters this_obj_conv;
15195 this_obj_conv.inner = (void*)(this_obj & (~1));
15196 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15197 ChainParameters_free(this_obj_conv);
15200 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15201 LDKChainParameters this_ptr_conv;
15202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15203 this_ptr_conv.is_owned = false;
15204 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15209 LDKChainParameters this_ptr_conv;
15210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15211 this_ptr_conv.is_owned = false;
15212 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15213 ChainParameters_set_network(&this_ptr_conv, val_conv);
15216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15217 LDKChainParameters this_ptr_conv;
15218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15219 this_ptr_conv.is_owned = false;
15220 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15221 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15222 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15223 uint64_t ret_ref = (uint64_t)ret_var.inner;
15224 if (ret_var.is_owned) {
15230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15231 LDKChainParameters this_ptr_conv;
15232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15233 this_ptr_conv.is_owned = false;
15234 LDKBestBlock val_conv;
15235 val_conv.inner = (void*)(val & (~1));
15236 val_conv.is_owned = (val & 1) || (val == 0);
15237 val_conv = BestBlock_clone(&val_conv);
15238 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15242 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15243 LDKBestBlock best_block_arg_conv;
15244 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15245 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15246 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15247 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15250 uint64_t ret_ref = (uint64_t)ret_var.inner;
15251 if (ret_var.is_owned) {
15257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15258 LDKChainParameters orig_conv;
15259 orig_conv.inner = (void*)(orig & (~1));
15260 orig_conv.is_owned = false;
15261 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15264 uint64_t ret_ref = (uint64_t)ret_var.inner;
15265 if (ret_var.is_owned) {
15271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15272 LDKBestBlock this_obj_conv;
15273 this_obj_conv.inner = (void*)(this_obj & (~1));
15274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15275 BestBlock_free(this_obj_conv);
15278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15279 LDKBestBlock orig_conv;
15280 orig_conv.inner = (void*)(orig & (~1));
15281 orig_conv.is_owned = false;
15282 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
15283 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15284 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15285 uint64_t ret_ref = (uint64_t)ret_var.inner;
15286 if (ret_var.is_owned) {
15292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
15293 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
15294 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
15295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15297 uint64_t ret_ref = (uint64_t)ret_var.inner;
15298 if (ret_var.is_owned) {
15304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
15305 LDKThirtyTwoBytes block_hash_ref;
15306 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
15307 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
15308 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
15309 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15310 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15311 uint64_t ret_ref = (uint64_t)ret_var.inner;
15312 if (ret_var.is_owned) {
15318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
15319 LDKBestBlock this_arg_conv;
15320 this_arg_conv.inner = (void*)(this_arg & (~1));
15321 this_arg_conv.is_owned = false;
15322 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15323 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
15327 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
15328 LDKBestBlock this_arg_conv;
15329 this_arg_conv.inner = (void*)(this_arg & (~1));
15330 this_arg_conv.is_owned = false;
15331 int32_t ret_val = BestBlock_height(&this_arg_conv);
15335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15336 LDKChannelDetails this_obj_conv;
15337 this_obj_conv.inner = (void*)(this_obj & (~1));
15338 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15339 ChannelDetails_free(this_obj_conv);
15342 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15343 LDKChannelDetails this_ptr_conv;
15344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15345 this_ptr_conv.is_owned = false;
15346 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15347 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
15351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15352 LDKChannelDetails this_ptr_conv;
15353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15354 this_ptr_conv.is_owned = false;
15355 LDKThirtyTwoBytes val_ref;
15356 CHECK((*env)->GetArrayLength(env, val) == 32);
15357 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15358 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
15361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
15362 LDKChannelDetails this_ptr_conv;
15363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15364 this_ptr_conv.is_owned = false;
15365 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
15366 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15367 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15368 uint64_t ret_ref = (uint64_t)ret_var.inner;
15369 if (ret_var.is_owned) {
15375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15376 LDKChannelDetails this_ptr_conv;
15377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15378 this_ptr_conv.is_owned = false;
15379 LDKOutPoint val_conv;
15380 val_conv.inner = (void*)(val & (~1));
15381 val_conv.is_owned = (val & 1) || (val == 0);
15382 val_conv = OutPoint_clone(&val_conv);
15383 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
15386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15387 LDKChannelDetails this_ptr_conv;
15388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15389 this_ptr_conv.is_owned = false;
15390 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
15391 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
15392 uint64_t ret_ref = (uint64_t)ret_copy;
15396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15397 LDKChannelDetails this_ptr_conv;
15398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15399 this_ptr_conv.is_owned = false;
15400 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
15401 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
15404 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15405 LDKChannelDetails this_ptr_conv;
15406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15407 this_ptr_conv.is_owned = false;
15408 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15409 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
15413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15414 LDKChannelDetails this_ptr_conv;
15415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15416 this_ptr_conv.is_owned = false;
15417 LDKPublicKey val_ref;
15418 CHECK((*env)->GetArrayLength(env, val) == 33);
15419 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15420 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
15423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15424 LDKChannelDetails this_ptr_conv;
15425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15426 this_ptr_conv.is_owned = false;
15427 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
15428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15430 uint64_t ret_ref = (uint64_t)ret_var.inner;
15431 if (ret_var.is_owned) {
15437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15438 LDKChannelDetails this_ptr_conv;
15439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15440 this_ptr_conv.is_owned = false;
15441 LDKInitFeatures val_conv;
15442 val_conv.inner = (void*)(val & (~1));
15443 val_conv.is_owned = (val & 1) || (val == 0);
15444 val_conv = InitFeatures_clone(&val_conv);
15445 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
15448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15449 LDKChannelDetails this_ptr_conv;
15450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15451 this_ptr_conv.is_owned = false;
15452 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
15456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15457 LDKChannelDetails this_ptr_conv;
15458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15459 this_ptr_conv.is_owned = false;
15460 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
15463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15464 LDKChannelDetails this_ptr_conv;
15465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15466 this_ptr_conv.is_owned = false;
15467 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
15471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15472 LDKChannelDetails this_ptr_conv;
15473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15474 this_ptr_conv.is_owned = false;
15475 ChannelDetails_set_user_id(&this_ptr_conv, val);
15478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15479 LDKChannelDetails this_ptr_conv;
15480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15481 this_ptr_conv.is_owned = false;
15482 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
15486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15487 LDKChannelDetails this_ptr_conv;
15488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15489 this_ptr_conv.is_owned = false;
15490 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
15493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15494 LDKChannelDetails this_ptr_conv;
15495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15496 this_ptr_conv.is_owned = false;
15497 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
15501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15502 LDKChannelDetails this_ptr_conv;
15503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15504 this_ptr_conv.is_owned = false;
15505 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
15508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
15509 LDKChannelDetails this_ptr_conv;
15510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15511 this_ptr_conv.is_owned = false;
15512 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
15516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15517 LDKChannelDetails this_ptr_conv;
15518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15519 this_ptr_conv.is_owned = false;
15520 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
15523 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
15524 LDKChannelDetails this_ptr_conv;
15525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15526 this_ptr_conv.is_owned = false;
15527 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
15531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15532 LDKChannelDetails this_ptr_conv;
15533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15534 this_ptr_conv.is_owned = false;
15535 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
15538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
15539 LDKChannelDetails this_ptr_conv;
15540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15541 this_ptr_conv.is_owned = false;
15542 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
15546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15547 LDKChannelDetails this_ptr_conv;
15548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15549 this_ptr_conv.is_owned = false;
15550 ChannelDetails_set_is_usable(&this_ptr_conv, val);
15553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
15554 LDKChannelDetails this_ptr_conv;
15555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15556 this_ptr_conv.is_owned = false;
15557 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
15561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
15562 LDKChannelDetails this_ptr_conv;
15563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15564 this_ptr_conv.is_owned = false;
15565 ChannelDetails_set_is_public(&this_ptr_conv, val);
15568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15569 LDKChannelDetails orig_conv;
15570 orig_conv.inner = (void*)(orig & (~1));
15571 orig_conv.is_owned = false;
15572 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
15573 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15574 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15575 uint64_t ret_ref = (uint64_t)ret_var.inner;
15576 if (ret_var.is_owned) {
15582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15583 if ((this_ptr & 1) != 0) return;
15584 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
15585 FREE((void*)this_ptr);
15586 PaymentSendFailure_free(this_ptr_conv);
15589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15590 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
15591 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
15592 *ret_copy = PaymentSendFailure_clone(orig_conv);
15593 uint64_t ret_ref = (uint64_t)ret_copy;
15597 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) {
15598 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
15599 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
15600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15601 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
15603 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
15604 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
15605 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15606 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
15608 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
15609 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
15610 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15611 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
15613 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
15614 if (logger_conv.free == LDKLogger_JCalls_free) {
15615 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15616 LDKLogger_JCalls_clone(logger_conv.this_arg);
15618 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
15619 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
15620 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15621 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
15623 LDKUserConfig config_conv;
15624 config_conv.inner = (void*)(config & (~1));
15625 config_conv.is_owned = (config & 1) || (config == 0);
15626 config_conv = UserConfig_clone(&config_conv);
15627 LDKChainParameters params_conv;
15628 params_conv.inner = (void*)(params & (~1));
15629 params_conv.is_owned = (params & 1) || (params == 0);
15630 params_conv = ChainParameters_clone(¶ms_conv);
15631 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
15632 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15633 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15634 uint64_t ret_ref = (uint64_t)ret_var.inner;
15635 if (ret_var.is_owned) {
15641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
15642 LDKChannelManager this_arg_conv;
15643 this_arg_conv.inner = (void*)(this_arg & (~1));
15644 this_arg_conv.is_owned = false;
15645 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
15646 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15647 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15648 uint64_t ret_ref = (uint64_t)ret_var.inner;
15649 if (ret_var.is_owned) {
15655 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) {
15656 LDKChannelManager this_arg_conv;
15657 this_arg_conv.inner = (void*)(this_arg & (~1));
15658 this_arg_conv.is_owned = false;
15659 LDKPublicKey their_network_key_ref;
15660 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
15661 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
15662 LDKUserConfig override_config_conv;
15663 override_config_conv.inner = (void*)(override_config & (~1));
15664 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
15665 override_config_conv = UserConfig_clone(&override_config_conv);
15666 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15667 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
15668 return (uint64_t)ret_conv;
15671 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15672 LDKChannelManager this_arg_conv;
15673 this_arg_conv.inner = (void*)(this_arg & (~1));
15674 this_arg_conv.is_owned = false;
15675 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
15676 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15677 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15678 for (size_t q = 0; q < ret_var.datalen; q++) {
15679 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15680 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15681 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15682 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15683 if (ret_conv_16_var.is_owned) {
15684 ret_conv_16_ref |= 1;
15686 ret_arr_ptr[q] = ret_conv_16_ref;
15688 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15689 FREE(ret_var.data);
15693 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15694 LDKChannelManager this_arg_conv;
15695 this_arg_conv.inner = (void*)(this_arg & (~1));
15696 this_arg_conv.is_owned = false;
15697 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
15698 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
15699 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
15700 for (size_t q = 0; q < ret_var.datalen; q++) {
15701 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
15702 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15703 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15704 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
15705 if (ret_conv_16_var.is_owned) {
15706 ret_conv_16_ref |= 1;
15708 ret_arr_ptr[q] = ret_conv_16_ref;
15710 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
15711 FREE(ret_var.data);
15715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
15716 LDKChannelManager this_arg_conv;
15717 this_arg_conv.inner = (void*)(this_arg & (~1));
15718 this_arg_conv.is_owned = false;
15719 unsigned char channel_id_arr[32];
15720 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15721 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15722 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15723 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15724 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
15725 return (uint64_t)ret_conv;
15728 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) {
15729 LDKChannelManager this_arg_conv;
15730 this_arg_conv.inner = (void*)(this_arg & (~1));
15731 this_arg_conv.is_owned = false;
15732 unsigned char channel_id_arr[32];
15733 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
15734 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
15735 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
15736 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15737 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
15738 return (uint64_t)ret_conv;
15741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
15742 LDKChannelManager this_arg_conv;
15743 this_arg_conv.inner = (void*)(this_arg & (~1));
15744 this_arg_conv.is_owned = false;
15745 ChannelManager_force_close_all_channels(&this_arg_conv);
15748 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) {
15749 LDKChannelManager this_arg_conv;
15750 this_arg_conv.inner = (void*)(this_arg & (~1));
15751 this_arg_conv.is_owned = false;
15752 LDKRoute route_conv;
15753 route_conv.inner = (void*)(route & (~1));
15754 route_conv.is_owned = false;
15755 LDKThirtyTwoBytes payment_hash_ref;
15756 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15757 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15758 LDKThirtyTwoBytes payment_secret_ref;
15759 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
15760 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
15761 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15762 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
15763 return (uint64_t)ret_conv;
15766 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) {
15767 LDKChannelManager this_arg_conv;
15768 this_arg_conv.inner = (void*)(this_arg & (~1));
15769 this_arg_conv.is_owned = false;
15770 unsigned char temporary_channel_id_arr[32];
15771 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
15772 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
15773 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
15774 LDKTransaction funding_transaction_ref;
15775 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
15776 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
15777 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
15778 funding_transaction_ref.data_is_owned = true;
15779 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15780 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
15781 return (uint64_t)ret_conv;
15784 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) {
15785 LDKChannelManager this_arg_conv;
15786 this_arg_conv.inner = (void*)(this_arg & (~1));
15787 this_arg_conv.is_owned = false;
15788 LDKThreeBytes rgb_ref;
15789 CHECK((*env)->GetArrayLength(env, rgb) == 3);
15790 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
15791 LDKThirtyTwoBytes alias_ref;
15792 CHECK((*env)->GetArrayLength(env, alias) == 32);
15793 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
15794 LDKCVec_NetAddressZ addresses_constr;
15795 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
15796 if (addresses_constr.datalen > 0)
15797 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15799 addresses_constr.data = NULL;
15800 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
15801 for (size_t m = 0; m < addresses_constr.datalen; m++) {
15802 int64_t addresses_conv_12 = addresses_vals[m];
15803 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
15804 addresses_constr.data[m] = addresses_conv_12_conv;
15806 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
15807 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
15810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
15811 LDKChannelManager this_arg_conv;
15812 this_arg_conv.inner = (void*)(this_arg & (~1));
15813 this_arg_conv.is_owned = false;
15814 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
15817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
15818 LDKChannelManager this_arg_conv;
15819 this_arg_conv.inner = (void*)(this_arg & (~1));
15820 this_arg_conv.is_owned = false;
15821 ChannelManager_timer_tick_occurred(&this_arg_conv);
15824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
15825 LDKChannelManager this_arg_conv;
15826 this_arg_conv.inner = (void*)(this_arg & (~1));
15827 this_arg_conv.is_owned = false;
15828 unsigned char payment_hash_arr[32];
15829 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15830 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
15831 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
15832 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
15836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
15837 LDKChannelManager this_arg_conv;
15838 this_arg_conv.inner = (void*)(this_arg & (~1));
15839 this_arg_conv.is_owned = false;
15840 LDKThirtyTwoBytes payment_preimage_ref;
15841 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
15842 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
15843 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
15847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15848 LDKChannelManager this_arg_conv;
15849 this_arg_conv.inner = (void*)(this_arg & (~1));
15850 this_arg_conv.is_owned = false;
15851 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15852 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
15856 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) {
15857 LDKChannelManager this_arg_conv;
15858 this_arg_conv.inner = (void*)(this_arg & (~1));
15859 this_arg_conv.is_owned = false;
15860 LDKOutPoint funding_txo_conv;
15861 funding_txo_conv.inner = (void*)(funding_txo & (~1));
15862 funding_txo_conv.is_owned = false;
15863 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
15866 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) {
15867 LDKChannelManager this_arg_conv;
15868 this_arg_conv.inner = (void*)(this_arg & (~1));
15869 this_arg_conv.is_owned = false;
15870 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15871 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
15872 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
15873 return (uint64_t)ret_ref;
15876 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) {
15877 LDKChannelManager this_arg_conv;
15878 this_arg_conv.inner = (void*)(this_arg & (~1));
15879 this_arg_conv.is_owned = false;
15880 LDKThirtyTwoBytes payment_hash_ref;
15881 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
15882 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
15883 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
15884 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
15885 *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);
15886 return (uint64_t)ret_conv;
15889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15890 LDKChannelManager this_arg_conv;
15891 this_arg_conv.inner = (void*)(this_arg & (~1));
15892 this_arg_conv.is_owned = false;
15893 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
15894 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
15895 return (uint64_t)ret;
15898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
15899 LDKChannelManager this_arg_conv;
15900 this_arg_conv.inner = (void*)(this_arg & (~1));
15901 this_arg_conv.is_owned = false;
15902 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
15903 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
15904 return (uint64_t)ret;
15907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
15908 LDKChannelManager this_arg_conv;
15909 this_arg_conv.inner = (void*)(this_arg & (~1));
15910 this_arg_conv.is_owned = false;
15911 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
15912 *ret = ChannelManager_as_Listen(&this_arg_conv);
15913 return (uint64_t)ret;
15916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
15917 LDKChannelManager this_arg_conv;
15918 this_arg_conv.inner = (void*)(this_arg & (~1));
15919 this_arg_conv.is_owned = false;
15920 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
15921 *ret = ChannelManager_as_Confirm(&this_arg_conv);
15922 return (uint64_t)ret;
15925 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) {
15926 LDKChannelManager this_arg_conv;
15927 this_arg_conv.inner = (void*)(this_arg & (~1));
15928 this_arg_conv.is_owned = false;
15929 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
15933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
15934 LDKChannelManager this_arg_conv;
15935 this_arg_conv.inner = (void*)(this_arg & (~1));
15936 this_arg_conv.is_owned = false;
15937 ChannelManager_await_persistable_update(&this_arg_conv);
15940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
15941 LDKChannelManager this_arg_conv;
15942 this_arg_conv.inner = (void*)(this_arg & (~1));
15943 this_arg_conv.is_owned = false;
15944 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
15945 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
15946 return (uint64_t)ret;
15949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
15950 LDKChannelManager obj_conv;
15951 obj_conv.inner = (void*)(obj & (~1));
15952 obj_conv.is_owned = false;
15953 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
15954 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15955 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15956 CVec_u8Z_free(ret_var);
15960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15961 LDKChannelManagerReadArgs this_obj_conv;
15962 this_obj_conv.inner = (void*)(this_obj & (~1));
15963 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15964 ChannelManagerReadArgs_free(this_obj_conv);
15967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
15968 LDKChannelManagerReadArgs this_ptr_conv;
15969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15970 this_ptr_conv.is_owned = false;
15971 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
15975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15976 LDKChannelManagerReadArgs this_ptr_conv;
15977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15978 this_ptr_conv.is_owned = false;
15979 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
15980 if (val_conv.free == LDKKeysInterface_JCalls_free) {
15981 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15982 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
15984 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
15987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
15988 LDKChannelManagerReadArgs this_ptr_conv;
15989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15990 this_ptr_conv.is_owned = false;
15991 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
15995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15996 LDKChannelManagerReadArgs this_ptr_conv;
15997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15998 this_ptr_conv.is_owned = false;
15999 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16000 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
16001 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16002 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
16004 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16008 LDKChannelManagerReadArgs this_ptr_conv;
16009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16010 this_ptr_conv.is_owned = false;
16011 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16016 LDKChannelManagerReadArgs this_ptr_conv;
16017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16018 this_ptr_conv.is_owned = false;
16019 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16020 if (val_conv.free == LDKWatch_JCalls_free) {
16021 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16022 LDKWatch_JCalls_clone(val_conv.this_arg);
16024 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16028 LDKChannelManagerReadArgs this_ptr_conv;
16029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16030 this_ptr_conv.is_owned = false;
16031 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16036 LDKChannelManagerReadArgs this_ptr_conv;
16037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16038 this_ptr_conv.is_owned = false;
16039 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16040 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16041 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16042 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
16044 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16048 LDKChannelManagerReadArgs this_ptr_conv;
16049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16050 this_ptr_conv.is_owned = false;
16051 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16056 LDKChannelManagerReadArgs this_ptr_conv;
16057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16058 this_ptr_conv.is_owned = false;
16059 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16060 if (val_conv.free == LDKLogger_JCalls_free) {
16061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16062 LDKLogger_JCalls_clone(val_conv.this_arg);
16064 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16068 LDKChannelManagerReadArgs this_ptr_conv;
16069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16070 this_ptr_conv.is_owned = false;
16071 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16074 uint64_t ret_ref = (uint64_t)ret_var.inner;
16075 if (ret_var.is_owned) {
16081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16082 LDKChannelManagerReadArgs this_ptr_conv;
16083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16084 this_ptr_conv.is_owned = false;
16085 LDKUserConfig val_conv;
16086 val_conv.inner = (void*)(val & (~1));
16087 val_conv.is_owned = (val & 1) || (val == 0);
16088 val_conv = UserConfig_clone(&val_conv);
16089 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16092 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) {
16093 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16094 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16096 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
16098 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16099 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16101 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
16103 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16104 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16106 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
16108 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16109 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16111 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
16113 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16114 if (logger_conv.free == LDKLogger_JCalls_free) {
16115 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16116 LDKLogger_JCalls_clone(logger_conv.this_arg);
16118 LDKUserConfig default_config_conv;
16119 default_config_conv.inner = (void*)(default_config & (~1));
16120 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16121 default_config_conv = UserConfig_clone(&default_config_conv);
16122 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16123 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16124 if (channel_monitors_constr.datalen > 0)
16125 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16127 channel_monitors_constr.data = NULL;
16128 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16129 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16130 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16131 LDKChannelMonitor channel_monitors_conv_16_conv;
16132 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16133 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16134 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16136 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16137 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);
16138 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16139 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16140 uint64_t ret_ref = (uint64_t)ret_var.inner;
16141 if (ret_var.is_owned) {
16147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16148 LDKu8slice ser_ref;
16149 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16150 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16151 LDKChannelManagerReadArgs arg_conv;
16152 arg_conv.inner = (void*)(arg & (~1));
16153 arg_conv.is_owned = (arg & 1) || (arg == 0);
16154 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16155 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16156 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16157 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16158 return (uint64_t)ret_conv;
16161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16162 LDKDecodeError this_obj_conv;
16163 this_obj_conv.inner = (void*)(this_obj & (~1));
16164 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16165 DecodeError_free(this_obj_conv);
16168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16169 LDKDecodeError orig_conv;
16170 orig_conv.inner = (void*)(orig & (~1));
16171 orig_conv.is_owned = false;
16172 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16173 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16174 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16175 uint64_t ret_ref = (uint64_t)ret_var.inner;
16176 if (ret_var.is_owned) {
16182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16183 LDKInit this_obj_conv;
16184 this_obj_conv.inner = (void*)(this_obj & (~1));
16185 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16186 Init_free(this_obj_conv);
16189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16190 LDKInit this_ptr_conv;
16191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16192 this_ptr_conv.is_owned = false;
16193 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
16194 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16195 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16196 uint64_t ret_ref = (uint64_t)ret_var.inner;
16197 if (ret_var.is_owned) {
16203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16204 LDKInit this_ptr_conv;
16205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16206 this_ptr_conv.is_owned = false;
16207 LDKInitFeatures val_conv;
16208 val_conv.inner = (void*)(val & (~1));
16209 val_conv.is_owned = (val & 1) || (val == 0);
16210 val_conv = InitFeatures_clone(&val_conv);
16211 Init_set_features(&this_ptr_conv, val_conv);
16214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
16215 LDKInitFeatures features_arg_conv;
16216 features_arg_conv.inner = (void*)(features_arg & (~1));
16217 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16218 features_arg_conv = InitFeatures_clone(&features_arg_conv);
16219 LDKInit ret_var = Init_new(features_arg_conv);
16220 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16221 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16222 uint64_t ret_ref = (uint64_t)ret_var.inner;
16223 if (ret_var.is_owned) {
16229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16231 orig_conv.inner = (void*)(orig & (~1));
16232 orig_conv.is_owned = false;
16233 LDKInit ret_var = Init_clone(&orig_conv);
16234 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16235 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16236 uint64_t ret_ref = (uint64_t)ret_var.inner;
16237 if (ret_var.is_owned) {
16243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16244 LDKErrorMessage this_obj_conv;
16245 this_obj_conv.inner = (void*)(this_obj & (~1));
16246 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16247 ErrorMessage_free(this_obj_conv);
16250 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16251 LDKErrorMessage this_ptr_conv;
16252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16253 this_ptr_conv.is_owned = false;
16254 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16255 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
16259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16260 LDKErrorMessage this_ptr_conv;
16261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16262 this_ptr_conv.is_owned = false;
16263 LDKThirtyTwoBytes val_ref;
16264 CHECK((*env)->GetArrayLength(env, val) == 32);
16265 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16266 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
16269 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
16270 LDKErrorMessage this_ptr_conv;
16271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16272 this_ptr_conv.is_owned = false;
16273 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
16274 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
16279 LDKErrorMessage this_ptr_conv;
16280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16281 this_ptr_conv.is_owned = false;
16282 LDKStr val_conv = java_to_owned_str(env, val);
16283 ErrorMessage_set_data(&this_ptr_conv, val_conv);
16286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
16287 LDKThirtyTwoBytes channel_id_arg_ref;
16288 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16289 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16290 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
16291 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
16292 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16293 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16294 uint64_t ret_ref = (uint64_t)ret_var.inner;
16295 if (ret_var.is_owned) {
16301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16302 LDKErrorMessage orig_conv;
16303 orig_conv.inner = (void*)(orig & (~1));
16304 orig_conv.is_owned = false;
16305 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
16306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16308 uint64_t ret_ref = (uint64_t)ret_var.inner;
16309 if (ret_var.is_owned) {
16315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16316 LDKPing this_obj_conv;
16317 this_obj_conv.inner = (void*)(this_obj & (~1));
16318 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16319 Ping_free(this_obj_conv);
16322 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16323 LDKPing this_ptr_conv;
16324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16325 this_ptr_conv.is_owned = false;
16326 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
16330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16331 LDKPing this_ptr_conv;
16332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16333 this_ptr_conv.is_owned = false;
16334 Ping_set_ponglen(&this_ptr_conv, val);
16337 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16338 LDKPing this_ptr_conv;
16339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16340 this_ptr_conv.is_owned = false;
16341 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
16345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16346 LDKPing this_ptr_conv;
16347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16348 this_ptr_conv.is_owned = false;
16349 Ping_set_byteslen(&this_ptr_conv, val);
16352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
16353 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
16354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16356 uint64_t ret_ref = (uint64_t)ret_var.inner;
16357 if (ret_var.is_owned) {
16363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16365 orig_conv.inner = (void*)(orig & (~1));
16366 orig_conv.is_owned = false;
16367 LDKPing ret_var = Ping_clone(&orig_conv);
16368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16370 uint64_t ret_ref = (uint64_t)ret_var.inner;
16371 if (ret_var.is_owned) {
16377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16378 LDKPong this_obj_conv;
16379 this_obj_conv.inner = (void*)(this_obj & (~1));
16380 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16381 Pong_free(this_obj_conv);
16384 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
16385 LDKPong this_ptr_conv;
16386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16387 this_ptr_conv.is_owned = false;
16388 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
16392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16393 LDKPong this_ptr_conv;
16394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16395 this_ptr_conv.is_owned = false;
16396 Pong_set_byteslen(&this_ptr_conv, val);
16399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
16400 LDKPong ret_var = Pong_new(byteslen_arg);
16401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16403 uint64_t ret_ref = (uint64_t)ret_var.inner;
16404 if (ret_var.is_owned) {
16410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16412 orig_conv.inner = (void*)(orig & (~1));
16413 orig_conv.is_owned = false;
16414 LDKPong ret_var = Pong_clone(&orig_conv);
16415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16417 uint64_t ret_ref = (uint64_t)ret_var.inner;
16418 if (ret_var.is_owned) {
16424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16425 LDKOpenChannel this_obj_conv;
16426 this_obj_conv.inner = (void*)(this_obj & (~1));
16427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16428 OpenChannel_free(this_obj_conv);
16431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
16432 LDKOpenChannel this_ptr_conv;
16433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16434 this_ptr_conv.is_owned = false;
16435 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16436 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
16440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16441 LDKOpenChannel this_ptr_conv;
16442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16443 this_ptr_conv.is_owned = false;
16444 LDKThirtyTwoBytes val_ref;
16445 CHECK((*env)->GetArrayLength(env, val) == 32);
16446 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16447 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
16450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16451 LDKOpenChannel this_ptr_conv;
16452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16453 this_ptr_conv.is_owned = false;
16454 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16455 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
16459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16460 LDKOpenChannel this_ptr_conv;
16461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16462 this_ptr_conv.is_owned = false;
16463 LDKThirtyTwoBytes val_ref;
16464 CHECK((*env)->GetArrayLength(env, val) == 32);
16465 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16466 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16470 LDKOpenChannel this_ptr_conv;
16471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16472 this_ptr_conv.is_owned = false;
16473 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
16477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16478 LDKOpenChannel this_ptr_conv;
16479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16480 this_ptr_conv.is_owned = false;
16481 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
16484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16485 LDKOpenChannel this_ptr_conv;
16486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16487 this_ptr_conv.is_owned = false;
16488 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
16492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16493 LDKOpenChannel this_ptr_conv;
16494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16495 this_ptr_conv.is_owned = false;
16496 OpenChannel_set_push_msat(&this_ptr_conv, val);
16499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16500 LDKOpenChannel this_ptr_conv;
16501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16502 this_ptr_conv.is_owned = false;
16503 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
16507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16508 LDKOpenChannel this_ptr_conv;
16509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16510 this_ptr_conv.is_owned = false;
16511 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16514 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) {
16515 LDKOpenChannel this_ptr_conv;
16516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16517 this_ptr_conv.is_owned = false;
16518 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16522 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) {
16523 LDKOpenChannel this_ptr_conv;
16524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16525 this_ptr_conv.is_owned = false;
16526 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16530 LDKOpenChannel this_ptr_conv;
16531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16532 this_ptr_conv.is_owned = false;
16533 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16538 LDKOpenChannel this_ptr_conv;
16539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16540 this_ptr_conv.is_owned = false;
16541 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16545 LDKOpenChannel this_ptr_conv;
16546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16547 this_ptr_conv.is_owned = false;
16548 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
16552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16553 LDKOpenChannel this_ptr_conv;
16554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16555 this_ptr_conv.is_owned = false;
16556 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16559 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
16560 LDKOpenChannel this_ptr_conv;
16561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16562 this_ptr_conv.is_owned = false;
16563 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
16567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16568 LDKOpenChannel this_ptr_conv;
16569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16570 this_ptr_conv.is_owned = false;
16571 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
16574 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16575 LDKOpenChannel this_ptr_conv;
16576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16577 this_ptr_conv.is_owned = false;
16578 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
16582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16583 LDKOpenChannel this_ptr_conv;
16584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16585 this_ptr_conv.is_owned = false;
16586 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
16589 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16590 LDKOpenChannel this_ptr_conv;
16591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16592 this_ptr_conv.is_owned = false;
16593 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
16597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16598 LDKOpenChannel this_ptr_conv;
16599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16600 this_ptr_conv.is_owned = false;
16601 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16605 LDKOpenChannel this_ptr_conv;
16606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16607 this_ptr_conv.is_owned = false;
16608 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16609 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16614 LDKOpenChannel this_ptr_conv;
16615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16616 this_ptr_conv.is_owned = false;
16617 LDKPublicKey val_ref;
16618 CHECK((*env)->GetArrayLength(env, val) == 33);
16619 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16620 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16624 LDKOpenChannel this_ptr_conv;
16625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16626 this_ptr_conv.is_owned = false;
16627 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16628 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16633 LDKOpenChannel this_ptr_conv;
16634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16635 this_ptr_conv.is_owned = false;
16636 LDKPublicKey val_ref;
16637 CHECK((*env)->GetArrayLength(env, val) == 33);
16638 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16639 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16643 LDKOpenChannel this_ptr_conv;
16644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16645 this_ptr_conv.is_owned = false;
16646 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
16651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16652 LDKOpenChannel this_ptr_conv;
16653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16654 this_ptr_conv.is_owned = false;
16655 LDKPublicKey val_ref;
16656 CHECK((*env)->GetArrayLength(env, val) == 33);
16657 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16658 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
16661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16662 LDKOpenChannel this_ptr_conv;
16663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16664 this_ptr_conv.is_owned = false;
16665 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16666 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16671 LDKOpenChannel this_ptr_conv;
16672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16673 this_ptr_conv.is_owned = false;
16674 LDKPublicKey val_ref;
16675 CHECK((*env)->GetArrayLength(env, val) == 33);
16676 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16677 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16681 LDKOpenChannel this_ptr_conv;
16682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16683 this_ptr_conv.is_owned = false;
16684 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16690 LDKOpenChannel this_ptr_conv;
16691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16692 this_ptr_conv.is_owned = false;
16693 LDKPublicKey val_ref;
16694 CHECK((*env)->GetArrayLength(env, val) == 33);
16695 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16696 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16699 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16700 LDKOpenChannel this_ptr_conv;
16701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16702 this_ptr_conv.is_owned = false;
16703 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16704 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16708 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) {
16709 LDKOpenChannel this_ptr_conv;
16710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16711 this_ptr_conv.is_owned = false;
16712 LDKPublicKey val_ref;
16713 CHECK((*env)->GetArrayLength(env, val) == 33);
16714 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16715 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16718 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
16719 LDKOpenChannel this_ptr_conv;
16720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16721 this_ptr_conv.is_owned = false;
16722 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
16726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
16727 LDKOpenChannel this_ptr_conv;
16728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16729 this_ptr_conv.is_owned = false;
16730 OpenChannel_set_channel_flags(&this_ptr_conv, val);
16733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16734 LDKOpenChannel orig_conv;
16735 orig_conv.inner = (void*)(orig & (~1));
16736 orig_conv.is_owned = false;
16737 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
16738 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16739 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16740 uint64_t ret_ref = (uint64_t)ret_var.inner;
16741 if (ret_var.is_owned) {
16747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16748 LDKAcceptChannel this_obj_conv;
16749 this_obj_conv.inner = (void*)(this_obj & (~1));
16750 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16751 AcceptChannel_free(this_obj_conv);
16754 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16755 LDKAcceptChannel this_ptr_conv;
16756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16757 this_ptr_conv.is_owned = false;
16758 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16759 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
16763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16764 LDKAcceptChannel this_ptr_conv;
16765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16766 this_ptr_conv.is_owned = false;
16767 LDKThirtyTwoBytes val_ref;
16768 CHECK((*env)->GetArrayLength(env, val) == 32);
16769 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16770 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
16773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16774 LDKAcceptChannel this_ptr_conv;
16775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16776 this_ptr_conv.is_owned = false;
16777 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
16781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16782 LDKAcceptChannel this_ptr_conv;
16783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16784 this_ptr_conv.is_owned = false;
16785 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
16788 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) {
16789 LDKAcceptChannel this_ptr_conv;
16790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16791 this_ptr_conv.is_owned = false;
16792 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
16796 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) {
16797 LDKAcceptChannel this_ptr_conv;
16798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16799 this_ptr_conv.is_owned = false;
16800 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
16803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16804 LDKAcceptChannel this_ptr_conv;
16805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16806 this_ptr_conv.is_owned = false;
16807 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
16811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16812 LDKAcceptChannel this_ptr_conv;
16813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16814 this_ptr_conv.is_owned = false;
16815 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
16818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16819 LDKAcceptChannel this_ptr_conv;
16820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16821 this_ptr_conv.is_owned = false;
16822 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
16826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16827 LDKAcceptChannel this_ptr_conv;
16828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16829 this_ptr_conv.is_owned = false;
16830 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
16833 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
16834 LDKAcceptChannel this_ptr_conv;
16835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16836 this_ptr_conv.is_owned = false;
16837 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
16841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16842 LDKAcceptChannel this_ptr_conv;
16843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16844 this_ptr_conv.is_owned = false;
16845 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
16848 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16849 LDKAcceptChannel this_ptr_conv;
16850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16851 this_ptr_conv.is_owned = false;
16852 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
16856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16857 LDKAcceptChannel this_ptr_conv;
16858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16859 this_ptr_conv.is_owned = false;
16860 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
16863 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
16864 LDKAcceptChannel this_ptr_conv;
16865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16866 this_ptr_conv.is_owned = false;
16867 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
16871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16872 LDKAcceptChannel this_ptr_conv;
16873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16874 this_ptr_conv.is_owned = false;
16875 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
16878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
16879 LDKAcceptChannel this_ptr_conv;
16880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16881 this_ptr_conv.is_owned = false;
16882 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16883 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
16887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16888 LDKAcceptChannel this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 LDKPublicKey val_ref;
16892 CHECK((*env)->GetArrayLength(env, val) == 33);
16893 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16894 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
16897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16898 LDKAcceptChannel this_ptr_conv;
16899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16900 this_ptr_conv.is_owned = false;
16901 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16902 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
16906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16907 LDKAcceptChannel this_ptr_conv;
16908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16909 this_ptr_conv.is_owned = false;
16910 LDKPublicKey val_ref;
16911 CHECK((*env)->GetArrayLength(env, val) == 33);
16912 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16913 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
16916 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16917 LDKAcceptChannel this_ptr_conv;
16918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16919 this_ptr_conv.is_owned = false;
16920 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16921 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
16925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16926 LDKAcceptChannel this_ptr_conv;
16927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16928 this_ptr_conv.is_owned = false;
16929 LDKPublicKey val_ref;
16930 CHECK((*env)->GetArrayLength(env, val) == 33);
16931 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16932 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
16935 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16936 LDKAcceptChannel this_ptr_conv;
16937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16938 this_ptr_conv.is_owned = false;
16939 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16940 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
16944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16945 LDKAcceptChannel this_ptr_conv;
16946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16947 this_ptr_conv.is_owned = false;
16948 LDKPublicKey val_ref;
16949 CHECK((*env)->GetArrayLength(env, val) == 33);
16950 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16951 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
16954 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
16955 LDKAcceptChannel this_ptr_conv;
16956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16957 this_ptr_conv.is_owned = false;
16958 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16959 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
16963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16964 LDKAcceptChannel this_ptr_conv;
16965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16966 this_ptr_conv.is_owned = false;
16967 LDKPublicKey val_ref;
16968 CHECK((*env)->GetArrayLength(env, val) == 33);
16969 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16970 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
16973 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
16974 LDKAcceptChannel this_ptr_conv;
16975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16976 this_ptr_conv.is_owned = false;
16977 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16978 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
16982 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) {
16983 LDKAcceptChannel this_ptr_conv;
16984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16985 this_ptr_conv.is_owned = false;
16986 LDKPublicKey val_ref;
16987 CHECK((*env)->GetArrayLength(env, val) == 33);
16988 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16989 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
16992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16993 LDKAcceptChannel orig_conv;
16994 orig_conv.inner = (void*)(orig & (~1));
16995 orig_conv.is_owned = false;
16996 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
16997 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16998 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16999 uint64_t ret_ref = (uint64_t)ret_var.inner;
17000 if (ret_var.is_owned) {
17006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17007 LDKFundingCreated this_obj_conv;
17008 this_obj_conv.inner = (void*)(this_obj & (~1));
17009 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17010 FundingCreated_free(this_obj_conv);
17013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17014 LDKFundingCreated this_ptr_conv;
17015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17016 this_ptr_conv.is_owned = false;
17017 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17018 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17023 LDKFundingCreated this_ptr_conv;
17024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17025 this_ptr_conv.is_owned = false;
17026 LDKThirtyTwoBytes val_ref;
17027 CHECK((*env)->GetArrayLength(env, val) == 32);
17028 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17029 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17033 LDKFundingCreated this_ptr_conv;
17034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17035 this_ptr_conv.is_owned = false;
17036 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17037 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17042 LDKFundingCreated this_ptr_conv;
17043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17044 this_ptr_conv.is_owned = false;
17045 LDKThirtyTwoBytes val_ref;
17046 CHECK((*env)->GetArrayLength(env, val) == 32);
17047 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17048 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17051 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17052 LDKFundingCreated this_ptr_conv;
17053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17054 this_ptr_conv.is_owned = false;
17055 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17060 LDKFundingCreated this_ptr_conv;
17061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17062 this_ptr_conv.is_owned = false;
17063 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17066 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17067 LDKFundingCreated this_ptr_conv;
17068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17069 this_ptr_conv.is_owned = false;
17070 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17071 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17076 LDKFundingCreated this_ptr_conv;
17077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17078 this_ptr_conv.is_owned = false;
17079 LDKSignature val_ref;
17080 CHECK((*env)->GetArrayLength(env, val) == 64);
17081 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17082 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17085 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) {
17086 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17087 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17088 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17089 LDKThirtyTwoBytes funding_txid_arg_ref;
17090 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17091 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17092 LDKSignature signature_arg_ref;
17093 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17094 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17095 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17098 uint64_t ret_ref = (uint64_t)ret_var.inner;
17099 if (ret_var.is_owned) {
17105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17106 LDKFundingCreated orig_conv;
17107 orig_conv.inner = (void*)(orig & (~1));
17108 orig_conv.is_owned = false;
17109 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17110 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17111 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17112 uint64_t ret_ref = (uint64_t)ret_var.inner;
17113 if (ret_var.is_owned) {
17119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17120 LDKFundingSigned this_obj_conv;
17121 this_obj_conv.inner = (void*)(this_obj & (~1));
17122 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17123 FundingSigned_free(this_obj_conv);
17126 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17127 LDKFundingSigned this_ptr_conv;
17128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17129 this_ptr_conv.is_owned = false;
17130 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17131 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17136 LDKFundingSigned this_ptr_conv;
17137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17138 this_ptr_conv.is_owned = false;
17139 LDKThirtyTwoBytes val_ref;
17140 CHECK((*env)->GetArrayLength(env, val) == 32);
17141 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17142 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17146 LDKFundingSigned this_ptr_conv;
17147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17148 this_ptr_conv.is_owned = false;
17149 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17155 LDKFundingSigned this_ptr_conv;
17156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17157 this_ptr_conv.is_owned = false;
17158 LDKSignature val_ref;
17159 CHECK((*env)->GetArrayLength(env, val) == 64);
17160 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17161 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17165 LDKThirtyTwoBytes channel_id_arg_ref;
17166 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17167 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17168 LDKSignature signature_arg_ref;
17169 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17170 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17171 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17174 uint64_t ret_ref = (uint64_t)ret_var.inner;
17175 if (ret_var.is_owned) {
17181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17182 LDKFundingSigned orig_conv;
17183 orig_conv.inner = (void*)(orig & (~1));
17184 orig_conv.is_owned = false;
17185 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17188 uint64_t ret_ref = (uint64_t)ret_var.inner;
17189 if (ret_var.is_owned) {
17195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17196 LDKFundingLocked this_obj_conv;
17197 this_obj_conv.inner = (void*)(this_obj & (~1));
17198 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17199 FundingLocked_free(this_obj_conv);
17202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17203 LDKFundingLocked this_ptr_conv;
17204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17205 this_ptr_conv.is_owned = false;
17206 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17207 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
17211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17212 LDKFundingLocked this_ptr_conv;
17213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17214 this_ptr_conv.is_owned = false;
17215 LDKThirtyTwoBytes val_ref;
17216 CHECK((*env)->GetArrayLength(env, val) == 32);
17217 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17218 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
17221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17222 LDKFundingLocked this_ptr_conv;
17223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17224 this_ptr_conv.is_owned = false;
17225 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17226 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17230 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) {
17231 LDKFundingLocked this_ptr_conv;
17232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17233 this_ptr_conv.is_owned = false;
17234 LDKPublicKey val_ref;
17235 CHECK((*env)->GetArrayLength(env, val) == 33);
17236 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17237 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17240 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) {
17241 LDKThirtyTwoBytes channel_id_arg_ref;
17242 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17243 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17244 LDKPublicKey next_per_commitment_point_arg_ref;
17245 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17246 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17247 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
17248 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17249 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17250 uint64_t ret_ref = (uint64_t)ret_var.inner;
17251 if (ret_var.is_owned) {
17257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17258 LDKFundingLocked orig_conv;
17259 orig_conv.inner = (void*)(orig & (~1));
17260 orig_conv.is_owned = false;
17261 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
17262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17264 uint64_t ret_ref = (uint64_t)ret_var.inner;
17265 if (ret_var.is_owned) {
17271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17272 LDKShutdown this_obj_conv;
17273 this_obj_conv.inner = (void*)(this_obj & (~1));
17274 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17275 Shutdown_free(this_obj_conv);
17278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17279 LDKShutdown this_ptr_conv;
17280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17281 this_ptr_conv.is_owned = false;
17282 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17283 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
17287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17288 LDKShutdown this_ptr_conv;
17289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17290 this_ptr_conv.is_owned = false;
17291 LDKThirtyTwoBytes val_ref;
17292 CHECK((*env)->GetArrayLength(env, val) == 32);
17293 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17294 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
17297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17298 LDKShutdown this_ptr_conv;
17299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17300 this_ptr_conv.is_owned = false;
17301 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
17302 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
17303 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
17307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17308 LDKShutdown this_ptr_conv;
17309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17310 this_ptr_conv.is_owned = false;
17311 LDKCVec_u8Z val_ref;
17312 val_ref.datalen = (*env)->GetArrayLength(env, val);
17313 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
17314 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
17315 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
17318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
17319 LDKThirtyTwoBytes channel_id_arg_ref;
17320 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17321 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17322 LDKCVec_u8Z scriptpubkey_arg_ref;
17323 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
17324 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
17325 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
17326 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
17327 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17328 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17329 uint64_t ret_ref = (uint64_t)ret_var.inner;
17330 if (ret_var.is_owned) {
17336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17337 LDKShutdown orig_conv;
17338 orig_conv.inner = (void*)(orig & (~1));
17339 orig_conv.is_owned = false;
17340 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
17341 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17342 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17343 uint64_t ret_ref = (uint64_t)ret_var.inner;
17344 if (ret_var.is_owned) {
17350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17351 LDKClosingSigned this_obj_conv;
17352 this_obj_conv.inner = (void*)(this_obj & (~1));
17353 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17354 ClosingSigned_free(this_obj_conv);
17357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17358 LDKClosingSigned this_ptr_conv;
17359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17360 this_ptr_conv.is_owned = false;
17361 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17362 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
17366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17367 LDKClosingSigned this_ptr_conv;
17368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17369 this_ptr_conv.is_owned = false;
17370 LDKThirtyTwoBytes val_ref;
17371 CHECK((*env)->GetArrayLength(env, val) == 32);
17372 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17373 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
17376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17377 LDKClosingSigned this_ptr_conv;
17378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17379 this_ptr_conv.is_owned = false;
17380 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
17384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17385 LDKClosingSigned this_ptr_conv;
17386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17387 this_ptr_conv.is_owned = false;
17388 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
17391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17392 LDKClosingSigned this_ptr_conv;
17393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17394 this_ptr_conv.is_owned = false;
17395 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17396 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
17400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17401 LDKClosingSigned this_ptr_conv;
17402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17403 this_ptr_conv.is_owned = false;
17404 LDKSignature val_ref;
17405 CHECK((*env)->GetArrayLength(env, val) == 64);
17406 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17407 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
17410 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) {
17411 LDKThirtyTwoBytes channel_id_arg_ref;
17412 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17413 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17414 LDKSignature signature_arg_ref;
17415 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17416 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17417 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
17418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17420 uint64_t ret_ref = (uint64_t)ret_var.inner;
17421 if (ret_var.is_owned) {
17427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17428 LDKClosingSigned orig_conv;
17429 orig_conv.inner = (void*)(orig & (~1));
17430 orig_conv.is_owned = false;
17431 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
17432 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17433 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17434 uint64_t ret_ref = (uint64_t)ret_var.inner;
17435 if (ret_var.is_owned) {
17441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17442 LDKUpdateAddHTLC this_obj_conv;
17443 this_obj_conv.inner = (void*)(this_obj & (~1));
17444 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17445 UpdateAddHTLC_free(this_obj_conv);
17448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17449 LDKUpdateAddHTLC this_ptr_conv;
17450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17451 this_ptr_conv.is_owned = false;
17452 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
17457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17458 LDKUpdateAddHTLC this_ptr_conv;
17459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17460 this_ptr_conv.is_owned = false;
17461 LDKThirtyTwoBytes val_ref;
17462 CHECK((*env)->GetArrayLength(env, val) == 32);
17463 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17464 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
17467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17468 LDKUpdateAddHTLC this_ptr_conv;
17469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17470 this_ptr_conv.is_owned = false;
17471 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
17475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17476 LDKUpdateAddHTLC this_ptr_conv;
17477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17478 this_ptr_conv.is_owned = false;
17479 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
17482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17483 LDKUpdateAddHTLC this_ptr_conv;
17484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17485 this_ptr_conv.is_owned = false;
17486 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
17490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17491 LDKUpdateAddHTLC this_ptr_conv;
17492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17493 this_ptr_conv.is_owned = false;
17494 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
17497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17498 LDKUpdateAddHTLC this_ptr_conv;
17499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17500 this_ptr_conv.is_owned = false;
17501 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17502 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
17506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17507 LDKUpdateAddHTLC this_ptr_conv;
17508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17509 this_ptr_conv.is_owned = false;
17510 LDKThirtyTwoBytes val_ref;
17511 CHECK((*env)->GetArrayLength(env, val) == 32);
17512 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17513 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
17516 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
17517 LDKUpdateAddHTLC this_ptr_conv;
17518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17519 this_ptr_conv.is_owned = false;
17520 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
17524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17525 LDKUpdateAddHTLC this_ptr_conv;
17526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17527 this_ptr_conv.is_owned = false;
17528 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
17531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17532 LDKUpdateAddHTLC orig_conv;
17533 orig_conv.inner = (void*)(orig & (~1));
17534 orig_conv.is_owned = false;
17535 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
17536 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17537 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17538 uint64_t ret_ref = (uint64_t)ret_var.inner;
17539 if (ret_var.is_owned) {
17545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17546 LDKUpdateFulfillHTLC this_obj_conv;
17547 this_obj_conv.inner = (void*)(this_obj & (~1));
17548 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17549 UpdateFulfillHTLC_free(this_obj_conv);
17552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17553 LDKUpdateFulfillHTLC this_ptr_conv;
17554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17555 this_ptr_conv.is_owned = false;
17556 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17557 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
17561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17562 LDKUpdateFulfillHTLC this_ptr_conv;
17563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17564 this_ptr_conv.is_owned = false;
17565 LDKThirtyTwoBytes val_ref;
17566 CHECK((*env)->GetArrayLength(env, val) == 32);
17567 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17568 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
17571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17572 LDKUpdateFulfillHTLC this_ptr_conv;
17573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17574 this_ptr_conv.is_owned = false;
17575 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
17579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17580 LDKUpdateFulfillHTLC this_ptr_conv;
17581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17582 this_ptr_conv.is_owned = false;
17583 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
17586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
17587 LDKUpdateFulfillHTLC this_ptr_conv;
17588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17589 this_ptr_conv.is_owned = false;
17590 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17591 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
17595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17596 LDKUpdateFulfillHTLC this_ptr_conv;
17597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17598 this_ptr_conv.is_owned = false;
17599 LDKThirtyTwoBytes val_ref;
17600 CHECK((*env)->GetArrayLength(env, val) == 32);
17601 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17602 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
17605 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) {
17606 LDKThirtyTwoBytes channel_id_arg_ref;
17607 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17608 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17609 LDKThirtyTwoBytes payment_preimage_arg_ref;
17610 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
17611 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
17612 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
17613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17615 uint64_t ret_ref = (uint64_t)ret_var.inner;
17616 if (ret_var.is_owned) {
17622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17623 LDKUpdateFulfillHTLC orig_conv;
17624 orig_conv.inner = (void*)(orig & (~1));
17625 orig_conv.is_owned = false;
17626 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
17627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17629 uint64_t ret_ref = (uint64_t)ret_var.inner;
17630 if (ret_var.is_owned) {
17636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17637 LDKUpdateFailHTLC this_obj_conv;
17638 this_obj_conv.inner = (void*)(this_obj & (~1));
17639 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17640 UpdateFailHTLC_free(this_obj_conv);
17643 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17644 LDKUpdateFailHTLC this_ptr_conv;
17645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17646 this_ptr_conv.is_owned = false;
17647 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17648 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
17652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17653 LDKUpdateFailHTLC this_ptr_conv;
17654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17655 this_ptr_conv.is_owned = false;
17656 LDKThirtyTwoBytes val_ref;
17657 CHECK((*env)->GetArrayLength(env, val) == 32);
17658 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17659 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
17662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17663 LDKUpdateFailHTLC this_ptr_conv;
17664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17665 this_ptr_conv.is_owned = false;
17666 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
17670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17671 LDKUpdateFailHTLC this_ptr_conv;
17672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17673 this_ptr_conv.is_owned = false;
17674 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
17677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17678 LDKUpdateFailHTLC orig_conv;
17679 orig_conv.inner = (void*)(orig & (~1));
17680 orig_conv.is_owned = false;
17681 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
17682 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17683 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17684 uint64_t ret_ref = (uint64_t)ret_var.inner;
17685 if (ret_var.is_owned) {
17691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17692 LDKUpdateFailMalformedHTLC this_obj_conv;
17693 this_obj_conv.inner = (void*)(this_obj & (~1));
17694 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17695 UpdateFailMalformedHTLC_free(this_obj_conv);
17698 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17699 LDKUpdateFailMalformedHTLC this_ptr_conv;
17700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17701 this_ptr_conv.is_owned = false;
17702 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17703 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
17707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17708 LDKUpdateFailMalformedHTLC this_ptr_conv;
17709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17710 this_ptr_conv.is_owned = false;
17711 LDKThirtyTwoBytes val_ref;
17712 CHECK((*env)->GetArrayLength(env, val) == 32);
17713 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17714 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
17717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17718 LDKUpdateFailMalformedHTLC this_ptr_conv;
17719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17720 this_ptr_conv.is_owned = false;
17721 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
17725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17726 LDKUpdateFailMalformedHTLC this_ptr_conv;
17727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17728 this_ptr_conv.is_owned = false;
17729 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
17732 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
17733 LDKUpdateFailMalformedHTLC this_ptr_conv;
17734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17735 this_ptr_conv.is_owned = false;
17736 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
17740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17741 LDKUpdateFailMalformedHTLC this_ptr_conv;
17742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17743 this_ptr_conv.is_owned = false;
17744 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
17747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17748 LDKUpdateFailMalformedHTLC orig_conv;
17749 orig_conv.inner = (void*)(orig & (~1));
17750 orig_conv.is_owned = false;
17751 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
17752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17754 uint64_t ret_ref = (uint64_t)ret_var.inner;
17755 if (ret_var.is_owned) {
17761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17762 LDKCommitmentSigned this_obj_conv;
17763 this_obj_conv.inner = (void*)(this_obj & (~1));
17764 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17765 CommitmentSigned_free(this_obj_conv);
17768 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17769 LDKCommitmentSigned this_ptr_conv;
17770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17771 this_ptr_conv.is_owned = false;
17772 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17773 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
17777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17778 LDKCommitmentSigned this_ptr_conv;
17779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17780 this_ptr_conv.is_owned = false;
17781 LDKThirtyTwoBytes val_ref;
17782 CHECK((*env)->GetArrayLength(env, val) == 32);
17783 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17784 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
17787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17788 LDKCommitmentSigned this_ptr_conv;
17789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17790 this_ptr_conv.is_owned = false;
17791 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17792 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
17796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17797 LDKCommitmentSigned this_ptr_conv;
17798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17799 this_ptr_conv.is_owned = false;
17800 LDKSignature val_ref;
17801 CHECK((*env)->GetArrayLength(env, val) == 64);
17802 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17803 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
17806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
17807 LDKCommitmentSigned this_ptr_conv;
17808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17809 this_ptr_conv.is_owned = false;
17810 LDKCVec_SignatureZ val_constr;
17811 val_constr.datalen = (*env)->GetArrayLength(env, val);
17812 if (val_constr.datalen > 0)
17813 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17815 val_constr.data = NULL;
17816 for (size_t i = 0; i < val_constr.datalen; i++) {
17817 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
17818 LDKSignature val_conv_8_ref;
17819 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
17820 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
17821 val_constr.data[i] = val_conv_8_ref;
17823 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
17826 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) {
17827 LDKThirtyTwoBytes channel_id_arg_ref;
17828 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17829 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17830 LDKSignature signature_arg_ref;
17831 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17832 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17833 LDKCVec_SignatureZ htlc_signatures_arg_constr;
17834 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
17835 if (htlc_signatures_arg_constr.datalen > 0)
17836 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
17838 htlc_signatures_arg_constr.data = NULL;
17839 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
17840 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
17841 LDKSignature htlc_signatures_arg_conv_8_ref;
17842 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
17843 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
17844 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
17846 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
17847 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17848 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17849 uint64_t ret_ref = (uint64_t)ret_var.inner;
17850 if (ret_var.is_owned) {
17856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17857 LDKCommitmentSigned orig_conv;
17858 orig_conv.inner = (void*)(orig & (~1));
17859 orig_conv.is_owned = false;
17860 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
17861 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17862 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17863 uint64_t ret_ref = (uint64_t)ret_var.inner;
17864 if (ret_var.is_owned) {
17870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17871 LDKRevokeAndACK this_obj_conv;
17872 this_obj_conv.inner = (void*)(this_obj & (~1));
17873 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17874 RevokeAndACK_free(this_obj_conv);
17877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17878 LDKRevokeAndACK this_ptr_conv;
17879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17880 this_ptr_conv.is_owned = false;
17881 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17882 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
17886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17887 LDKRevokeAndACK this_ptr_conv;
17888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17889 this_ptr_conv.is_owned = false;
17890 LDKThirtyTwoBytes val_ref;
17891 CHECK((*env)->GetArrayLength(env, val) == 32);
17892 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17893 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
17896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
17897 LDKRevokeAndACK this_ptr_conv;
17898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17899 this_ptr_conv.is_owned = false;
17900 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17901 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
17905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17906 LDKRevokeAndACK this_ptr_conv;
17907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17908 this_ptr_conv.is_owned = false;
17909 LDKThirtyTwoBytes val_ref;
17910 CHECK((*env)->GetArrayLength(env, val) == 32);
17911 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17912 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
17915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17916 LDKRevokeAndACK this_ptr_conv;
17917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17918 this_ptr_conv.is_owned = false;
17919 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17920 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
17924 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) {
17925 LDKRevokeAndACK this_ptr_conv;
17926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17927 this_ptr_conv.is_owned = false;
17928 LDKPublicKey val_ref;
17929 CHECK((*env)->GetArrayLength(env, val) == 33);
17930 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17931 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
17934 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) {
17935 LDKThirtyTwoBytes channel_id_arg_ref;
17936 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17937 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17938 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
17939 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
17940 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
17941 LDKPublicKey next_per_commitment_point_arg_ref;
17942 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
17943 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
17944 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
17945 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17946 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17947 uint64_t ret_ref = (uint64_t)ret_var.inner;
17948 if (ret_var.is_owned) {
17954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17955 LDKRevokeAndACK orig_conv;
17956 orig_conv.inner = (void*)(orig & (~1));
17957 orig_conv.is_owned = false;
17958 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
17959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17961 uint64_t ret_ref = (uint64_t)ret_var.inner;
17962 if (ret_var.is_owned) {
17968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17969 LDKUpdateFee this_obj_conv;
17970 this_obj_conv.inner = (void*)(this_obj & (~1));
17971 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17972 UpdateFee_free(this_obj_conv);
17975 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17976 LDKUpdateFee this_ptr_conv;
17977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17978 this_ptr_conv.is_owned = false;
17979 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17980 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
17984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17985 LDKUpdateFee this_ptr_conv;
17986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17987 this_ptr_conv.is_owned = false;
17988 LDKThirtyTwoBytes val_ref;
17989 CHECK((*env)->GetArrayLength(env, val) == 32);
17990 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17991 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
17994 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
17995 LDKUpdateFee this_ptr_conv;
17996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17997 this_ptr_conv.is_owned = false;
17998 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18003 LDKUpdateFee this_ptr_conv;
18004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18005 this_ptr_conv.is_owned = false;
18006 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18009 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) {
18010 LDKThirtyTwoBytes channel_id_arg_ref;
18011 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18012 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18013 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18014 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18015 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18016 uint64_t ret_ref = (uint64_t)ret_var.inner;
18017 if (ret_var.is_owned) {
18023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18024 LDKUpdateFee orig_conv;
18025 orig_conv.inner = (void*)(orig & (~1));
18026 orig_conv.is_owned = false;
18027 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18028 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18029 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18030 uint64_t ret_ref = (uint64_t)ret_var.inner;
18031 if (ret_var.is_owned) {
18037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18038 LDKDataLossProtect this_obj_conv;
18039 this_obj_conv.inner = (void*)(this_obj & (~1));
18040 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18041 DataLossProtect_free(this_obj_conv);
18044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18045 LDKDataLossProtect this_ptr_conv;
18046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18047 this_ptr_conv.is_owned = false;
18048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18053 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) {
18054 LDKDataLossProtect this_ptr_conv;
18055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18056 this_ptr_conv.is_owned = false;
18057 LDKThirtyTwoBytes val_ref;
18058 CHECK((*env)->GetArrayLength(env, val) == 32);
18059 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18060 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18063 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18064 LDKDataLossProtect this_ptr_conv;
18065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18066 this_ptr_conv.is_owned = false;
18067 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18068 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18072 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) {
18073 LDKDataLossProtect this_ptr_conv;
18074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18075 this_ptr_conv.is_owned = false;
18076 LDKPublicKey val_ref;
18077 CHECK((*env)->GetArrayLength(env, val) == 33);
18078 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18079 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18082 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) {
18083 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18084 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18085 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18086 LDKPublicKey my_current_per_commitment_point_arg_ref;
18087 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18088 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18089 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18090 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18091 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18092 uint64_t ret_ref = (uint64_t)ret_var.inner;
18093 if (ret_var.is_owned) {
18099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18100 LDKDataLossProtect orig_conv;
18101 orig_conv.inner = (void*)(orig & (~1));
18102 orig_conv.is_owned = false;
18103 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18106 uint64_t ret_ref = (uint64_t)ret_var.inner;
18107 if (ret_var.is_owned) {
18113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18114 LDKChannelReestablish this_obj_conv;
18115 this_obj_conv.inner = (void*)(this_obj & (~1));
18116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18117 ChannelReestablish_free(this_obj_conv);
18120 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18121 LDKChannelReestablish this_ptr_conv;
18122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18123 this_ptr_conv.is_owned = false;
18124 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18125 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18130 LDKChannelReestablish this_ptr_conv;
18131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18132 this_ptr_conv.is_owned = false;
18133 LDKThirtyTwoBytes val_ref;
18134 CHECK((*env)->GetArrayLength(env, val) == 32);
18135 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18136 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18140 LDKChannelReestablish this_ptr_conv;
18141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18142 this_ptr_conv.is_owned = false;
18143 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18147 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) {
18148 LDKChannelReestablish this_ptr_conv;
18149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18150 this_ptr_conv.is_owned = false;
18151 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18155 LDKChannelReestablish this_ptr_conv;
18156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18157 this_ptr_conv.is_owned = false;
18158 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18162 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) {
18163 LDKChannelReestablish this_ptr_conv;
18164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18165 this_ptr_conv.is_owned = false;
18166 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18170 LDKChannelReestablish orig_conv;
18171 orig_conv.inner = (void*)(orig & (~1));
18172 orig_conv.is_owned = false;
18173 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18174 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18175 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18176 uint64_t ret_ref = (uint64_t)ret_var.inner;
18177 if (ret_var.is_owned) {
18183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18184 LDKAnnouncementSignatures this_obj_conv;
18185 this_obj_conv.inner = (void*)(this_obj & (~1));
18186 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18187 AnnouncementSignatures_free(this_obj_conv);
18190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18191 LDKAnnouncementSignatures this_ptr_conv;
18192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18193 this_ptr_conv.is_owned = false;
18194 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18195 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
18199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18200 LDKAnnouncementSignatures this_ptr_conv;
18201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18202 this_ptr_conv.is_owned = false;
18203 LDKThirtyTwoBytes val_ref;
18204 CHECK((*env)->GetArrayLength(env, val) == 32);
18205 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18206 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
18209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18210 LDKAnnouncementSignatures this_ptr_conv;
18211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18212 this_ptr_conv.is_owned = false;
18213 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
18217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18218 LDKAnnouncementSignatures this_ptr_conv;
18219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18220 this_ptr_conv.is_owned = false;
18221 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
18224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18225 LDKAnnouncementSignatures this_ptr_conv;
18226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18227 this_ptr_conv.is_owned = false;
18228 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18229 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
18233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18234 LDKAnnouncementSignatures this_ptr_conv;
18235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18236 this_ptr_conv.is_owned = false;
18237 LDKSignature val_ref;
18238 CHECK((*env)->GetArrayLength(env, val) == 64);
18239 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18240 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
18243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18244 LDKAnnouncementSignatures this_ptr_conv;
18245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18246 this_ptr_conv.is_owned = false;
18247 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18248 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
18252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18253 LDKAnnouncementSignatures this_ptr_conv;
18254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18255 this_ptr_conv.is_owned = false;
18256 LDKSignature val_ref;
18257 CHECK((*env)->GetArrayLength(env, val) == 64);
18258 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18259 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
18262 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) {
18263 LDKThirtyTwoBytes channel_id_arg_ref;
18264 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18265 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18266 LDKSignature node_signature_arg_ref;
18267 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
18268 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
18269 LDKSignature bitcoin_signature_arg_ref;
18270 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
18271 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
18272 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
18273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18275 uint64_t ret_ref = (uint64_t)ret_var.inner;
18276 if (ret_var.is_owned) {
18282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18283 LDKAnnouncementSignatures orig_conv;
18284 orig_conv.inner = (void*)(orig & (~1));
18285 orig_conv.is_owned = false;
18286 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
18287 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18288 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18289 uint64_t ret_ref = (uint64_t)ret_var.inner;
18290 if (ret_var.is_owned) {
18296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
18297 if ((this_ptr & 1) != 0) return;
18298 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
18299 FREE((void*)this_ptr);
18300 NetAddress_free(this_ptr_conv);
18303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18304 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
18305 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
18306 *ret_copy = NetAddress_clone(orig_conv);
18307 uint64_t ret_ref = (uint64_t)ret_copy;
18311 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
18312 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
18313 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
18314 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18315 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18316 CVec_u8Z_free(ret_var);
18320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18321 LDKu8slice ser_ref;
18322 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18323 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18324 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
18325 *ret_conv = Result_read(ser_ref);
18326 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18327 return (uint64_t)ret_conv;
18330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
18331 LDKu8slice ser_ref;
18332 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
18333 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
18334 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18335 *ret_conv = NetAddress_read(ser_ref);
18336 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
18337 return (uint64_t)ret_conv;
18340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18341 LDKUnsignedNodeAnnouncement this_obj_conv;
18342 this_obj_conv.inner = (void*)(this_obj & (~1));
18343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18344 UnsignedNodeAnnouncement_free(this_obj_conv);
18347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18348 LDKUnsignedNodeAnnouncement this_ptr_conv;
18349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18350 this_ptr_conv.is_owned = false;
18351 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
18352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18354 uint64_t ret_ref = (uint64_t)ret_var.inner;
18355 if (ret_var.is_owned) {
18361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18362 LDKUnsignedNodeAnnouncement this_ptr_conv;
18363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18364 this_ptr_conv.is_owned = false;
18365 LDKNodeFeatures val_conv;
18366 val_conv.inner = (void*)(val & (~1));
18367 val_conv.is_owned = (val & 1) || (val == 0);
18368 val_conv = NodeFeatures_clone(&val_conv);
18369 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
18372 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18373 LDKUnsignedNodeAnnouncement this_ptr_conv;
18374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18375 this_ptr_conv.is_owned = false;
18376 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
18380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18381 LDKUnsignedNodeAnnouncement this_ptr_conv;
18382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18383 this_ptr_conv.is_owned = false;
18384 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
18387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18388 LDKUnsignedNodeAnnouncement this_ptr_conv;
18389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18390 this_ptr_conv.is_owned = false;
18391 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18392 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
18396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18397 LDKUnsignedNodeAnnouncement this_ptr_conv;
18398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18399 this_ptr_conv.is_owned = false;
18400 LDKPublicKey val_ref;
18401 CHECK((*env)->GetArrayLength(env, val) == 33);
18402 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18403 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
18406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
18407 LDKUnsignedNodeAnnouncement this_ptr_conv;
18408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18409 this_ptr_conv.is_owned = false;
18410 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
18411 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
18415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18416 LDKUnsignedNodeAnnouncement this_ptr_conv;
18417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18418 this_ptr_conv.is_owned = false;
18419 LDKThreeBytes val_ref;
18420 CHECK((*env)->GetArrayLength(env, val) == 3);
18421 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
18422 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
18425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
18426 LDKUnsignedNodeAnnouncement this_ptr_conv;
18427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18428 this_ptr_conv.is_owned = false;
18429 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18430 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
18434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18435 LDKUnsignedNodeAnnouncement this_ptr_conv;
18436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18437 this_ptr_conv.is_owned = false;
18438 LDKThirtyTwoBytes val_ref;
18439 CHECK((*env)->GetArrayLength(env, val) == 32);
18440 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18441 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
18444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
18445 LDKUnsignedNodeAnnouncement this_ptr_conv;
18446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18447 this_ptr_conv.is_owned = false;
18448 LDKCVec_NetAddressZ val_constr;
18449 val_constr.datalen = (*env)->GetArrayLength(env, val);
18450 if (val_constr.datalen > 0)
18451 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
18453 val_constr.data = NULL;
18454 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
18455 for (size_t m = 0; m < val_constr.datalen; m++) {
18456 int64_t val_conv_12 = val_vals[m];
18457 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
18458 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
18459 val_constr.data[m] = val_conv_12_conv;
18461 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
18462 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
18465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18466 LDKUnsignedNodeAnnouncement orig_conv;
18467 orig_conv.inner = (void*)(orig & (~1));
18468 orig_conv.is_owned = false;
18469 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
18470 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18471 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18472 uint64_t ret_ref = (uint64_t)ret_var.inner;
18473 if (ret_var.is_owned) {
18479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18480 LDKNodeAnnouncement this_obj_conv;
18481 this_obj_conv.inner = (void*)(this_obj & (~1));
18482 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18483 NodeAnnouncement_free(this_obj_conv);
18486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18487 LDKNodeAnnouncement this_ptr_conv;
18488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18489 this_ptr_conv.is_owned = false;
18490 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18491 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
18495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18496 LDKNodeAnnouncement this_ptr_conv;
18497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18498 this_ptr_conv.is_owned = false;
18499 LDKSignature val_ref;
18500 CHECK((*env)->GetArrayLength(env, val) == 64);
18501 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18502 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
18505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18506 LDKNodeAnnouncement this_ptr_conv;
18507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18508 this_ptr_conv.is_owned = false;
18509 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
18510 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18511 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18512 uint64_t ret_ref = (uint64_t)ret_var.inner;
18513 if (ret_var.is_owned) {
18519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18520 LDKNodeAnnouncement this_ptr_conv;
18521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18522 this_ptr_conv.is_owned = false;
18523 LDKUnsignedNodeAnnouncement val_conv;
18524 val_conv.inner = (void*)(val & (~1));
18525 val_conv.is_owned = (val & 1) || (val == 0);
18526 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
18527 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
18530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
18531 LDKSignature signature_arg_ref;
18532 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18533 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18534 LDKUnsignedNodeAnnouncement contents_arg_conv;
18535 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18536 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18537 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
18538 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
18539 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18540 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18541 uint64_t ret_ref = (uint64_t)ret_var.inner;
18542 if (ret_var.is_owned) {
18548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18549 LDKNodeAnnouncement orig_conv;
18550 orig_conv.inner = (void*)(orig & (~1));
18551 orig_conv.is_owned = false;
18552 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
18553 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18554 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18555 uint64_t ret_ref = (uint64_t)ret_var.inner;
18556 if (ret_var.is_owned) {
18562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18563 LDKUnsignedChannelAnnouncement this_obj_conv;
18564 this_obj_conv.inner = (void*)(this_obj & (~1));
18565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18566 UnsignedChannelAnnouncement_free(this_obj_conv);
18569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
18570 LDKUnsignedChannelAnnouncement this_ptr_conv;
18571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18572 this_ptr_conv.is_owned = false;
18573 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
18574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18576 uint64_t ret_ref = (uint64_t)ret_var.inner;
18577 if (ret_var.is_owned) {
18583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18584 LDKUnsignedChannelAnnouncement this_ptr_conv;
18585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18586 this_ptr_conv.is_owned = false;
18587 LDKChannelFeatures val_conv;
18588 val_conv.inner = (void*)(val & (~1));
18589 val_conv.is_owned = (val & 1) || (val == 0);
18590 val_conv = ChannelFeatures_clone(&val_conv);
18591 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
18594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18595 LDKUnsignedChannelAnnouncement this_ptr_conv;
18596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18597 this_ptr_conv.is_owned = false;
18598 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18599 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
18603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18604 LDKUnsignedChannelAnnouncement this_ptr_conv;
18605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18606 this_ptr_conv.is_owned = false;
18607 LDKThirtyTwoBytes val_ref;
18608 CHECK((*env)->GetArrayLength(env, val) == 32);
18609 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18610 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
18613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18614 LDKUnsignedChannelAnnouncement this_ptr_conv;
18615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18616 this_ptr_conv.is_owned = false;
18617 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
18621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18622 LDKUnsignedChannelAnnouncement this_ptr_conv;
18623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18624 this_ptr_conv.is_owned = false;
18625 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
18628 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18629 LDKUnsignedChannelAnnouncement this_ptr_conv;
18630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18631 this_ptr_conv.is_owned = false;
18632 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18633 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
18637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18638 LDKUnsignedChannelAnnouncement this_ptr_conv;
18639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18640 this_ptr_conv.is_owned = false;
18641 LDKPublicKey val_ref;
18642 CHECK((*env)->GetArrayLength(env, val) == 33);
18643 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18644 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
18647 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18648 LDKUnsignedChannelAnnouncement this_ptr_conv;
18649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18650 this_ptr_conv.is_owned = false;
18651 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18652 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
18656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18657 LDKUnsignedChannelAnnouncement this_ptr_conv;
18658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18659 this_ptr_conv.is_owned = false;
18660 LDKPublicKey val_ref;
18661 CHECK((*env)->GetArrayLength(env, val) == 33);
18662 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18663 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
18666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18667 LDKUnsignedChannelAnnouncement this_ptr_conv;
18668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18669 this_ptr_conv.is_owned = false;
18670 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18671 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
18675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18676 LDKUnsignedChannelAnnouncement this_ptr_conv;
18677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18678 this_ptr_conv.is_owned = false;
18679 LDKPublicKey val_ref;
18680 CHECK((*env)->GetArrayLength(env, val) == 33);
18681 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18682 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
18685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18686 LDKUnsignedChannelAnnouncement this_ptr_conv;
18687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18688 this_ptr_conv.is_owned = false;
18689 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
18694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18695 LDKUnsignedChannelAnnouncement this_ptr_conv;
18696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18697 this_ptr_conv.is_owned = false;
18698 LDKPublicKey val_ref;
18699 CHECK((*env)->GetArrayLength(env, val) == 33);
18700 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18701 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
18704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18705 LDKUnsignedChannelAnnouncement orig_conv;
18706 orig_conv.inner = (void*)(orig & (~1));
18707 orig_conv.is_owned = false;
18708 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
18709 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18710 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18711 uint64_t ret_ref = (uint64_t)ret_var.inner;
18712 if (ret_var.is_owned) {
18718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18719 LDKChannelAnnouncement this_obj_conv;
18720 this_obj_conv.inner = (void*)(this_obj & (~1));
18721 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18722 ChannelAnnouncement_free(this_obj_conv);
18725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18726 LDKChannelAnnouncement this_ptr_conv;
18727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18728 this_ptr_conv.is_owned = false;
18729 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18730 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
18734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18735 LDKChannelAnnouncement this_ptr_conv;
18736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18737 this_ptr_conv.is_owned = false;
18738 LDKSignature val_ref;
18739 CHECK((*env)->GetArrayLength(env, val) == 64);
18740 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18741 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
18744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18745 LDKChannelAnnouncement this_ptr_conv;
18746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18747 this_ptr_conv.is_owned = false;
18748 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18749 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
18753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18754 LDKChannelAnnouncement this_ptr_conv;
18755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18756 this_ptr_conv.is_owned = false;
18757 LDKSignature val_ref;
18758 CHECK((*env)->GetArrayLength(env, val) == 64);
18759 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18760 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
18763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
18764 LDKChannelAnnouncement this_ptr_conv;
18765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18766 this_ptr_conv.is_owned = false;
18767 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18768 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
18772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18773 LDKChannelAnnouncement this_ptr_conv;
18774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18775 this_ptr_conv.is_owned = false;
18776 LDKSignature val_ref;
18777 CHECK((*env)->GetArrayLength(env, val) == 64);
18778 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18779 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
18782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
18783 LDKChannelAnnouncement this_ptr_conv;
18784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18785 this_ptr_conv.is_owned = false;
18786 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18787 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
18791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18792 LDKChannelAnnouncement this_ptr_conv;
18793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18794 this_ptr_conv.is_owned = false;
18795 LDKSignature val_ref;
18796 CHECK((*env)->GetArrayLength(env, val) == 64);
18797 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18798 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
18801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
18802 LDKChannelAnnouncement this_ptr_conv;
18803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18804 this_ptr_conv.is_owned = false;
18805 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
18806 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18807 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18808 uint64_t ret_ref = (uint64_t)ret_var.inner;
18809 if (ret_var.is_owned) {
18815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18816 LDKChannelAnnouncement this_ptr_conv;
18817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18818 this_ptr_conv.is_owned = false;
18819 LDKUnsignedChannelAnnouncement val_conv;
18820 val_conv.inner = (void*)(val & (~1));
18821 val_conv.is_owned = (val & 1) || (val == 0);
18822 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
18823 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
18826 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) {
18827 LDKSignature node_signature_1_arg_ref;
18828 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
18829 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
18830 LDKSignature node_signature_2_arg_ref;
18831 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
18832 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
18833 LDKSignature bitcoin_signature_1_arg_ref;
18834 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
18835 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
18836 LDKSignature bitcoin_signature_2_arg_ref;
18837 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
18838 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
18839 LDKUnsignedChannelAnnouncement contents_arg_conv;
18840 contents_arg_conv.inner = (void*)(contents_arg & (~1));
18841 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
18842 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
18843 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);
18844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18846 uint64_t ret_ref = (uint64_t)ret_var.inner;
18847 if (ret_var.is_owned) {
18853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18854 LDKChannelAnnouncement orig_conv;
18855 orig_conv.inner = (void*)(orig & (~1));
18856 orig_conv.is_owned = false;
18857 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
18858 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18859 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18860 uint64_t ret_ref = (uint64_t)ret_var.inner;
18861 if (ret_var.is_owned) {
18867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18868 LDKUnsignedChannelUpdate this_obj_conv;
18869 this_obj_conv.inner = (void*)(this_obj & (~1));
18870 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18871 UnsignedChannelUpdate_free(this_obj_conv);
18874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18875 LDKUnsignedChannelUpdate this_ptr_conv;
18876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18877 this_ptr_conv.is_owned = false;
18878 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18879 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
18883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18884 LDKUnsignedChannelUpdate this_ptr_conv;
18885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18886 this_ptr_conv.is_owned = false;
18887 LDKThirtyTwoBytes val_ref;
18888 CHECK((*env)->GetArrayLength(env, val) == 32);
18889 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18890 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
18893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18894 LDKUnsignedChannelUpdate this_ptr_conv;
18895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18896 this_ptr_conv.is_owned = false;
18897 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
18901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18902 LDKUnsignedChannelUpdate this_ptr_conv;
18903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18904 this_ptr_conv.is_owned = false;
18905 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
18908 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
18909 LDKUnsignedChannelUpdate this_ptr_conv;
18910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18911 this_ptr_conv.is_owned = false;
18912 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
18916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18917 LDKUnsignedChannelUpdate this_ptr_conv;
18918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18919 this_ptr_conv.is_owned = false;
18920 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
18923 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
18924 LDKUnsignedChannelUpdate this_ptr_conv;
18925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18926 this_ptr_conv.is_owned = false;
18927 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
18931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
18932 LDKUnsignedChannelUpdate this_ptr_conv;
18933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18934 this_ptr_conv.is_owned = false;
18935 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
18938 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
18939 LDKUnsignedChannelUpdate this_ptr_conv;
18940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18941 this_ptr_conv.is_owned = false;
18942 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
18946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18947 LDKUnsignedChannelUpdate this_ptr_conv;
18948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18949 this_ptr_conv.is_owned = false;
18950 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
18953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18954 LDKUnsignedChannelUpdate this_ptr_conv;
18955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18956 this_ptr_conv.is_owned = false;
18957 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
18961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18962 LDKUnsignedChannelUpdate this_ptr_conv;
18963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18964 this_ptr_conv.is_owned = false;
18965 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
18968 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18969 LDKUnsignedChannelUpdate this_ptr_conv;
18970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18971 this_ptr_conv.is_owned = false;
18972 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
18976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18977 LDKUnsignedChannelUpdate this_ptr_conv;
18978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18979 this_ptr_conv.is_owned = false;
18980 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
18983 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
18984 LDKUnsignedChannelUpdate this_ptr_conv;
18985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18986 this_ptr_conv.is_owned = false;
18987 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
18991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18992 LDKUnsignedChannelUpdate this_ptr_conv;
18993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18994 this_ptr_conv.is_owned = false;
18995 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
18998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18999 LDKUnsignedChannelUpdate orig_conv;
19000 orig_conv.inner = (void*)(orig & (~1));
19001 orig_conv.is_owned = false;
19002 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19003 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19004 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19005 uint64_t ret_ref = (uint64_t)ret_var.inner;
19006 if (ret_var.is_owned) {
19012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19013 LDKChannelUpdate this_obj_conv;
19014 this_obj_conv.inner = (void*)(this_obj & (~1));
19015 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19016 ChannelUpdate_free(this_obj_conv);
19019 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19020 LDKChannelUpdate this_ptr_conv;
19021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19022 this_ptr_conv.is_owned = false;
19023 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19024 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19029 LDKChannelUpdate this_ptr_conv;
19030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19031 this_ptr_conv.is_owned = false;
19032 LDKSignature val_ref;
19033 CHECK((*env)->GetArrayLength(env, val) == 64);
19034 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19035 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19039 LDKChannelUpdate this_ptr_conv;
19040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19041 this_ptr_conv.is_owned = false;
19042 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19043 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19044 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19045 uint64_t ret_ref = (uint64_t)ret_var.inner;
19046 if (ret_var.is_owned) {
19052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19053 LDKChannelUpdate this_ptr_conv;
19054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19055 this_ptr_conv.is_owned = false;
19056 LDKUnsignedChannelUpdate val_conv;
19057 val_conv.inner = (void*)(val & (~1));
19058 val_conv.is_owned = (val & 1) || (val == 0);
19059 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19060 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19064 LDKSignature signature_arg_ref;
19065 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19066 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19067 LDKUnsignedChannelUpdate contents_arg_conv;
19068 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19069 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19070 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19071 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19072 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19073 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19074 uint64_t ret_ref = (uint64_t)ret_var.inner;
19075 if (ret_var.is_owned) {
19081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19082 LDKChannelUpdate orig_conv;
19083 orig_conv.inner = (void*)(orig & (~1));
19084 orig_conv.is_owned = false;
19085 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19086 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19087 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19088 uint64_t ret_ref = (uint64_t)ret_var.inner;
19089 if (ret_var.is_owned) {
19095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19096 LDKQueryChannelRange this_obj_conv;
19097 this_obj_conv.inner = (void*)(this_obj & (~1));
19098 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19099 QueryChannelRange_free(this_obj_conv);
19102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19103 LDKQueryChannelRange this_ptr_conv;
19104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19105 this_ptr_conv.is_owned = false;
19106 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19107 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19112 LDKQueryChannelRange this_ptr_conv;
19113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19114 this_ptr_conv.is_owned = false;
19115 LDKThirtyTwoBytes val_ref;
19116 CHECK((*env)->GetArrayLength(env, val) == 32);
19117 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19118 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19121 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19122 LDKQueryChannelRange this_ptr_conv;
19123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19124 this_ptr_conv.is_owned = false;
19125 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19130 LDKQueryChannelRange this_ptr_conv;
19131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19132 this_ptr_conv.is_owned = false;
19133 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19136 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19137 LDKQueryChannelRange this_ptr_conv;
19138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19139 this_ptr_conv.is_owned = false;
19140 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19145 LDKQueryChannelRange this_ptr_conv;
19146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19147 this_ptr_conv.is_owned = false;
19148 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19151 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) {
19152 LDKThirtyTwoBytes chain_hash_arg_ref;
19153 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19154 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19155 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19156 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19157 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19158 uint64_t ret_ref = (uint64_t)ret_var.inner;
19159 if (ret_var.is_owned) {
19165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19166 LDKQueryChannelRange orig_conv;
19167 orig_conv.inner = (void*)(orig & (~1));
19168 orig_conv.is_owned = false;
19169 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19170 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19171 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19172 uint64_t ret_ref = (uint64_t)ret_var.inner;
19173 if (ret_var.is_owned) {
19179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19180 LDKReplyChannelRange this_obj_conv;
19181 this_obj_conv.inner = (void*)(this_obj & (~1));
19182 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19183 ReplyChannelRange_free(this_obj_conv);
19186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19187 LDKReplyChannelRange this_ptr_conv;
19188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19189 this_ptr_conv.is_owned = false;
19190 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19191 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
19195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19196 LDKReplyChannelRange this_ptr_conv;
19197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19198 this_ptr_conv.is_owned = false;
19199 LDKThirtyTwoBytes val_ref;
19200 CHECK((*env)->GetArrayLength(env, val) == 32);
19201 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19202 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19205 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19206 LDKReplyChannelRange this_ptr_conv;
19207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19208 this_ptr_conv.is_owned = false;
19209 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
19213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19214 LDKReplyChannelRange this_ptr_conv;
19215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19216 this_ptr_conv.is_owned = false;
19217 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
19220 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19221 LDKReplyChannelRange this_ptr_conv;
19222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19223 this_ptr_conv.is_owned = false;
19224 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
19228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19229 LDKReplyChannelRange this_ptr_conv;
19230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19231 this_ptr_conv.is_owned = false;
19232 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
19236 LDKReplyChannelRange this_ptr_conv;
19237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19238 this_ptr_conv.is_owned = false;
19239 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
19243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19244 LDKReplyChannelRange this_ptr_conv;
19245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19246 this_ptr_conv.is_owned = false;
19247 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
19250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19251 LDKReplyChannelRange this_ptr_conv;
19252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19253 this_ptr_conv.is_owned = false;
19254 LDKCVec_u64Z val_constr;
19255 val_constr.datalen = (*env)->GetArrayLength(env, val);
19256 if (val_constr.datalen > 0)
19257 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19259 val_constr.data = NULL;
19260 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19261 for (size_t g = 0; g < val_constr.datalen; g++) {
19262 int64_t val_conv_6 = val_vals[g];
19263 val_constr.data[g] = val_conv_6;
19265 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19266 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
19269 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) {
19270 LDKThirtyTwoBytes chain_hash_arg_ref;
19271 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19272 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19273 LDKCVec_u64Z short_channel_ids_arg_constr;
19274 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19275 if (short_channel_ids_arg_constr.datalen > 0)
19276 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19278 short_channel_ids_arg_constr.data = NULL;
19279 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19280 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19281 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19282 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19284 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19285 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
19286 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19287 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19288 uint64_t ret_ref = (uint64_t)ret_var.inner;
19289 if (ret_var.is_owned) {
19295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19296 LDKReplyChannelRange orig_conv;
19297 orig_conv.inner = (void*)(orig & (~1));
19298 orig_conv.is_owned = false;
19299 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
19300 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19301 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19302 uint64_t ret_ref = (uint64_t)ret_var.inner;
19303 if (ret_var.is_owned) {
19309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19310 LDKQueryShortChannelIds this_obj_conv;
19311 this_obj_conv.inner = (void*)(this_obj & (~1));
19312 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19313 QueryShortChannelIds_free(this_obj_conv);
19316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19317 LDKQueryShortChannelIds this_ptr_conv;
19318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19319 this_ptr_conv.is_owned = false;
19320 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19321 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
19325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19326 LDKQueryShortChannelIds this_ptr_conv;
19327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19328 this_ptr_conv.is_owned = false;
19329 LDKThirtyTwoBytes val_ref;
19330 CHECK((*env)->GetArrayLength(env, val) == 32);
19331 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19332 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
19335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19336 LDKQueryShortChannelIds this_ptr_conv;
19337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19338 this_ptr_conv.is_owned = false;
19339 LDKCVec_u64Z val_constr;
19340 val_constr.datalen = (*env)->GetArrayLength(env, val);
19341 if (val_constr.datalen > 0)
19342 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19344 val_constr.data = NULL;
19345 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19346 for (size_t g = 0; g < val_constr.datalen; g++) {
19347 int64_t val_conv_6 = val_vals[g];
19348 val_constr.data[g] = val_conv_6;
19350 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19351 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
19354 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) {
19355 LDKThirtyTwoBytes chain_hash_arg_ref;
19356 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19357 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19358 LDKCVec_u64Z short_channel_ids_arg_constr;
19359 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
19360 if (short_channel_ids_arg_constr.datalen > 0)
19361 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
19363 short_channel_ids_arg_constr.data = NULL;
19364 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
19365 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
19366 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
19367 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
19369 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
19370 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
19371 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19372 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19373 uint64_t ret_ref = (uint64_t)ret_var.inner;
19374 if (ret_var.is_owned) {
19380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19381 LDKQueryShortChannelIds orig_conv;
19382 orig_conv.inner = (void*)(orig & (~1));
19383 orig_conv.is_owned = false;
19384 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
19385 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19386 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19387 uint64_t ret_ref = (uint64_t)ret_var.inner;
19388 if (ret_var.is_owned) {
19394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19395 LDKReplyShortChannelIdsEnd this_obj_conv;
19396 this_obj_conv.inner = (void*)(this_obj & (~1));
19397 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19398 ReplyShortChannelIdsEnd_free(this_obj_conv);
19401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19402 LDKReplyShortChannelIdsEnd this_ptr_conv;
19403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19404 this_ptr_conv.is_owned = false;
19405 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19406 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
19410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19411 LDKReplyShortChannelIdsEnd this_ptr_conv;
19412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19413 this_ptr_conv.is_owned = false;
19414 LDKThirtyTwoBytes val_ref;
19415 CHECK((*env)->GetArrayLength(env, val) == 32);
19416 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19417 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
19420 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
19421 LDKReplyShortChannelIdsEnd this_ptr_conv;
19422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19423 this_ptr_conv.is_owned = false;
19424 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
19428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
19429 LDKReplyShortChannelIdsEnd this_ptr_conv;
19430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19431 this_ptr_conv.is_owned = false;
19432 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
19435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
19436 LDKThirtyTwoBytes chain_hash_arg_ref;
19437 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19438 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19439 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
19440 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19441 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19442 uint64_t ret_ref = (uint64_t)ret_var.inner;
19443 if (ret_var.is_owned) {
19449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19450 LDKReplyShortChannelIdsEnd orig_conv;
19451 orig_conv.inner = (void*)(orig & (~1));
19452 orig_conv.is_owned = false;
19453 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
19454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19456 uint64_t ret_ref = (uint64_t)ret_var.inner;
19457 if (ret_var.is_owned) {
19463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19464 LDKGossipTimestampFilter this_obj_conv;
19465 this_obj_conv.inner = (void*)(this_obj & (~1));
19466 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19467 GossipTimestampFilter_free(this_obj_conv);
19470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19471 LDKGossipTimestampFilter this_ptr_conv;
19472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19473 this_ptr_conv.is_owned = false;
19474 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19475 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
19479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19480 LDKGossipTimestampFilter this_ptr_conv;
19481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19482 this_ptr_conv.is_owned = false;
19483 LDKThirtyTwoBytes val_ref;
19484 CHECK((*env)->GetArrayLength(env, val) == 32);
19485 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19486 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
19489 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19490 LDKGossipTimestampFilter this_ptr_conv;
19491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19492 this_ptr_conv.is_owned = false;
19493 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
19497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19498 LDKGossipTimestampFilter this_ptr_conv;
19499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19500 this_ptr_conv.is_owned = false;
19501 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
19504 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
19505 LDKGossipTimestampFilter this_ptr_conv;
19506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19507 this_ptr_conv.is_owned = false;
19508 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
19512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19513 LDKGossipTimestampFilter this_ptr_conv;
19514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19515 this_ptr_conv.is_owned = false;
19516 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
19519 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) {
19520 LDKThirtyTwoBytes chain_hash_arg_ref;
19521 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19522 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19523 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
19524 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19525 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19526 uint64_t ret_ref = (uint64_t)ret_var.inner;
19527 if (ret_var.is_owned) {
19533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19534 LDKGossipTimestampFilter orig_conv;
19535 orig_conv.inner = (void*)(orig & (~1));
19536 orig_conv.is_owned = false;
19537 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
19538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19540 uint64_t ret_ref = (uint64_t)ret_var.inner;
19541 if (ret_var.is_owned) {
19547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19548 if ((this_ptr & 1) != 0) return;
19549 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
19550 FREE((void*)this_ptr);
19551 ErrorAction_free(this_ptr_conv);
19554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19555 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
19556 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19557 *ret_copy = ErrorAction_clone(orig_conv);
19558 uint64_t ret_ref = (uint64_t)ret_copy;
19562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19563 LDKLightningError this_obj_conv;
19564 this_obj_conv.inner = (void*)(this_obj & (~1));
19565 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19566 LightningError_free(this_obj_conv);
19569 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
19570 LDKLightningError this_ptr_conv;
19571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19572 this_ptr_conv.is_owned = false;
19573 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
19574 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
19578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
19579 LDKLightningError this_ptr_conv;
19580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19581 this_ptr_conv.is_owned = false;
19582 LDKStr val_conv = java_to_owned_str(env, val);
19583 LightningError_set_err(&this_ptr_conv, val_conv);
19586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
19587 LDKLightningError this_ptr_conv;
19588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19589 this_ptr_conv.is_owned = false;
19590 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
19591 *ret_copy = LightningError_get_action(&this_ptr_conv);
19592 uint64_t ret_ref = (uint64_t)ret_copy;
19596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19597 LDKLightningError this_ptr_conv;
19598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19599 this_ptr_conv.is_owned = false;
19600 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
19601 LightningError_set_action(&this_ptr_conv, val_conv);
19604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
19605 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
19606 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
19607 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
19608 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19609 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19610 uint64_t ret_ref = (uint64_t)ret_var.inner;
19611 if (ret_var.is_owned) {
19617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19618 LDKLightningError orig_conv;
19619 orig_conv.inner = (void*)(orig & (~1));
19620 orig_conv.is_owned = false;
19621 LDKLightningError ret_var = LightningError_clone(&orig_conv);
19622 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19623 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19624 uint64_t ret_ref = (uint64_t)ret_var.inner;
19625 if (ret_var.is_owned) {
19631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19632 LDKCommitmentUpdate this_obj_conv;
19633 this_obj_conv.inner = (void*)(this_obj & (~1));
19634 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19635 CommitmentUpdate_free(this_obj_conv);
19638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19639 LDKCommitmentUpdate this_ptr_conv;
19640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19641 this_ptr_conv.is_owned = false;
19642 LDKCVec_UpdateAddHTLCZ val_constr;
19643 val_constr.datalen = (*env)->GetArrayLength(env, val);
19644 if (val_constr.datalen > 0)
19645 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19647 val_constr.data = NULL;
19648 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19649 for (size_t p = 0; p < val_constr.datalen; p++) {
19650 int64_t val_conv_15 = val_vals[p];
19651 LDKUpdateAddHTLC val_conv_15_conv;
19652 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
19653 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
19654 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
19655 val_constr.data[p] = val_conv_15_conv;
19657 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19658 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
19661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19662 LDKCommitmentUpdate this_ptr_conv;
19663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19664 this_ptr_conv.is_owned = false;
19665 LDKCVec_UpdateFulfillHTLCZ val_constr;
19666 val_constr.datalen = (*env)->GetArrayLength(env, val);
19667 if (val_constr.datalen > 0)
19668 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19670 val_constr.data = NULL;
19671 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19672 for (size_t t = 0; t < val_constr.datalen; t++) {
19673 int64_t val_conv_19 = val_vals[t];
19674 LDKUpdateFulfillHTLC val_conv_19_conv;
19675 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
19676 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
19677 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
19678 val_constr.data[t] = val_conv_19_conv;
19680 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19681 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
19684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19685 LDKCommitmentUpdate this_ptr_conv;
19686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19687 this_ptr_conv.is_owned = false;
19688 LDKCVec_UpdateFailHTLCZ val_constr;
19689 val_constr.datalen = (*env)->GetArrayLength(env, val);
19690 if (val_constr.datalen > 0)
19691 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19693 val_constr.data = NULL;
19694 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19695 for (size_t q = 0; q < val_constr.datalen; q++) {
19696 int64_t val_conv_16 = val_vals[q];
19697 LDKUpdateFailHTLC val_conv_16_conv;
19698 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
19699 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
19700 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
19701 val_constr.data[q] = val_conv_16_conv;
19703 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19704 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
19707 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) {
19708 LDKCommitmentUpdate this_ptr_conv;
19709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19710 this_ptr_conv.is_owned = false;
19711 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
19712 val_constr.datalen = (*env)->GetArrayLength(env, val);
19713 if (val_constr.datalen > 0)
19714 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19716 val_constr.data = NULL;
19717 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19718 for (size_t z = 0; z < val_constr.datalen; z++) {
19719 int64_t val_conv_25 = val_vals[z];
19720 LDKUpdateFailMalformedHTLC val_conv_25_conv;
19721 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
19722 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
19723 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
19724 val_constr.data[z] = val_conv_25_conv;
19726 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19727 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
19730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
19731 LDKCommitmentUpdate this_ptr_conv;
19732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19733 this_ptr_conv.is_owned = false;
19734 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19745 LDKCommitmentUpdate this_ptr_conv;
19746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19747 this_ptr_conv.is_owned = false;
19748 LDKUpdateFee val_conv;
19749 val_conv.inner = (void*)(val & (~1));
19750 val_conv.is_owned = (val & 1) || (val == 0);
19751 val_conv = UpdateFee_clone(&val_conv);
19752 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
19755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
19756 LDKCommitmentUpdate this_ptr_conv;
19757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19758 this_ptr_conv.is_owned = false;
19759 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
19760 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19761 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19762 uint64_t ret_ref = (uint64_t)ret_var.inner;
19763 if (ret_var.is_owned) {
19769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19770 LDKCommitmentUpdate this_ptr_conv;
19771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19772 this_ptr_conv.is_owned = false;
19773 LDKCommitmentSigned val_conv;
19774 val_conv.inner = (void*)(val & (~1));
19775 val_conv.is_owned = (val & 1) || (val == 0);
19776 val_conv = CommitmentSigned_clone(&val_conv);
19777 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
19780 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) {
19781 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
19782 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
19783 if (update_add_htlcs_arg_constr.datalen > 0)
19784 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19786 update_add_htlcs_arg_constr.data = NULL;
19787 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
19788 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
19789 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
19790 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
19791 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
19792 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
19793 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
19794 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
19796 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
19797 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
19798 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
19799 if (update_fulfill_htlcs_arg_constr.datalen > 0)
19800 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19802 update_fulfill_htlcs_arg_constr.data = NULL;
19803 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
19804 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
19805 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
19806 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
19807 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
19808 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
19809 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
19810 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
19812 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
19813 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
19814 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
19815 if (update_fail_htlcs_arg_constr.datalen > 0)
19816 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19818 update_fail_htlcs_arg_constr.data = NULL;
19819 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
19820 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
19821 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
19822 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
19823 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
19824 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
19825 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
19826 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
19828 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
19829 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
19830 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
19831 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
19832 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19834 update_fail_malformed_htlcs_arg_constr.data = NULL;
19835 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
19836 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
19837 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
19838 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
19839 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
19840 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);
19841 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
19842 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
19844 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
19845 LDKUpdateFee update_fee_arg_conv;
19846 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
19847 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
19848 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
19849 LDKCommitmentSigned commitment_signed_arg_conv;
19850 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
19851 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
19852 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
19853 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);
19854 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19855 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19856 uint64_t ret_ref = (uint64_t)ret_var.inner;
19857 if (ret_var.is_owned) {
19863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19864 LDKCommitmentUpdate orig_conv;
19865 orig_conv.inner = (void*)(orig & (~1));
19866 orig_conv.is_owned = false;
19867 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
19868 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19869 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19870 uint64_t ret_ref = (uint64_t)ret_var.inner;
19871 if (ret_var.is_owned) {
19877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19878 if ((this_ptr & 1) != 0) return;
19879 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
19880 FREE((void*)this_ptr);
19881 HTLCFailChannelUpdate_free(this_ptr_conv);
19884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19885 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
19886 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
19887 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
19888 uint64_t ret_ref = (uint64_t)ret_copy;
19892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19893 if ((this_ptr & 1) != 0) return;
19894 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
19895 FREE((void*)this_ptr);
19896 ChannelMessageHandler_free(this_ptr_conv);
19899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19900 if ((this_ptr & 1) != 0) return;
19901 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
19902 FREE((void*)this_ptr);
19903 RoutingMessageHandler_free(this_ptr_conv);
19906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
19907 LDKAcceptChannel obj_conv;
19908 obj_conv.inner = (void*)(obj & (~1));
19909 obj_conv.is_owned = false;
19910 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
19911 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19912 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19913 CVec_u8Z_free(ret_var);
19917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19918 LDKu8slice ser_ref;
19919 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19920 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19921 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19922 *ret_conv = AcceptChannel_read(ser_ref);
19923 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19924 return (uint64_t)ret_conv;
19927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
19928 LDKAnnouncementSignatures obj_conv;
19929 obj_conv.inner = (void*)(obj & (~1));
19930 obj_conv.is_owned = false;
19931 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
19932 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19933 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19934 CVec_u8Z_free(ret_var);
19938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19939 LDKu8slice ser_ref;
19940 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19941 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19942 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19943 *ret_conv = AnnouncementSignatures_read(ser_ref);
19944 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19945 return (uint64_t)ret_conv;
19948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
19949 LDKChannelReestablish obj_conv;
19950 obj_conv.inner = (void*)(obj & (~1));
19951 obj_conv.is_owned = false;
19952 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
19953 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19954 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19955 CVec_u8Z_free(ret_var);
19959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19960 LDKu8slice ser_ref;
19961 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19962 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19963 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19964 *ret_conv = ChannelReestablish_read(ser_ref);
19965 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19966 return (uint64_t)ret_conv;
19969 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19970 LDKClosingSigned obj_conv;
19971 obj_conv.inner = (void*)(obj & (~1));
19972 obj_conv.is_owned = false;
19973 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
19974 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19975 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19976 CVec_u8Z_free(ret_var);
19980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19981 LDKu8slice ser_ref;
19982 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19983 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19984 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19985 *ret_conv = ClosingSigned_read(ser_ref);
19986 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19987 return (uint64_t)ret_conv;
19990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
19991 LDKCommitmentSigned obj_conv;
19992 obj_conv.inner = (void*)(obj & (~1));
19993 obj_conv.is_owned = false;
19994 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
19995 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19996 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19997 CVec_u8Z_free(ret_var);
20001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20002 LDKu8slice ser_ref;
20003 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20004 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20005 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20006 *ret_conv = CommitmentSigned_read(ser_ref);
20007 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20008 return (uint64_t)ret_conv;
20011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20012 LDKFundingCreated obj_conv;
20013 obj_conv.inner = (void*)(obj & (~1));
20014 obj_conv.is_owned = false;
20015 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20016 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20017 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20018 CVec_u8Z_free(ret_var);
20022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20023 LDKu8slice ser_ref;
20024 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20025 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20026 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20027 *ret_conv = FundingCreated_read(ser_ref);
20028 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20029 return (uint64_t)ret_conv;
20032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20033 LDKFundingSigned obj_conv;
20034 obj_conv.inner = (void*)(obj & (~1));
20035 obj_conv.is_owned = false;
20036 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20037 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20038 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20039 CVec_u8Z_free(ret_var);
20043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20044 LDKu8slice ser_ref;
20045 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20046 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20047 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20048 *ret_conv = FundingSigned_read(ser_ref);
20049 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20050 return (uint64_t)ret_conv;
20053 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20054 LDKFundingLocked obj_conv;
20055 obj_conv.inner = (void*)(obj & (~1));
20056 obj_conv.is_owned = false;
20057 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20058 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20059 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20060 CVec_u8Z_free(ret_var);
20064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20065 LDKu8slice ser_ref;
20066 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20067 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20068 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20069 *ret_conv = FundingLocked_read(ser_ref);
20070 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20071 return (uint64_t)ret_conv;
20074 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20076 obj_conv.inner = (void*)(obj & (~1));
20077 obj_conv.is_owned = false;
20078 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20079 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20080 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20081 CVec_u8Z_free(ret_var);
20085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20086 LDKu8slice ser_ref;
20087 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20088 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20089 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20090 *ret_conv = Init_read(ser_ref);
20091 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20092 return (uint64_t)ret_conv;
20095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20096 LDKOpenChannel obj_conv;
20097 obj_conv.inner = (void*)(obj & (~1));
20098 obj_conv.is_owned = false;
20099 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20100 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20101 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20102 CVec_u8Z_free(ret_var);
20106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20107 LDKu8slice ser_ref;
20108 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20109 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20110 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20111 *ret_conv = OpenChannel_read(ser_ref);
20112 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20113 return (uint64_t)ret_conv;
20116 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20117 LDKRevokeAndACK obj_conv;
20118 obj_conv.inner = (void*)(obj & (~1));
20119 obj_conv.is_owned = false;
20120 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20121 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20122 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20123 CVec_u8Z_free(ret_var);
20127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20128 LDKu8slice ser_ref;
20129 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20130 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20131 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20132 *ret_conv = RevokeAndACK_read(ser_ref);
20133 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20134 return (uint64_t)ret_conv;
20137 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20138 LDKShutdown obj_conv;
20139 obj_conv.inner = (void*)(obj & (~1));
20140 obj_conv.is_owned = false;
20141 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20142 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20143 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20144 CVec_u8Z_free(ret_var);
20148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20149 LDKu8slice ser_ref;
20150 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20151 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20152 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20153 *ret_conv = Shutdown_read(ser_ref);
20154 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20155 return (uint64_t)ret_conv;
20158 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20159 LDKUpdateFailHTLC obj_conv;
20160 obj_conv.inner = (void*)(obj & (~1));
20161 obj_conv.is_owned = false;
20162 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20163 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20164 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20165 CVec_u8Z_free(ret_var);
20169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20170 LDKu8slice ser_ref;
20171 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20172 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20173 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20174 *ret_conv = UpdateFailHTLC_read(ser_ref);
20175 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20176 return (uint64_t)ret_conv;
20179 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20180 LDKUpdateFailMalformedHTLC obj_conv;
20181 obj_conv.inner = (void*)(obj & (~1));
20182 obj_conv.is_owned = false;
20183 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20184 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20185 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20186 CVec_u8Z_free(ret_var);
20190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20191 LDKu8slice ser_ref;
20192 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20193 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20194 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20195 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
20196 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20197 return (uint64_t)ret_conv;
20200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
20201 LDKUpdateFee obj_conv;
20202 obj_conv.inner = (void*)(obj & (~1));
20203 obj_conv.is_owned = false;
20204 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
20205 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20206 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20207 CVec_u8Z_free(ret_var);
20211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20212 LDKu8slice ser_ref;
20213 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20214 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20215 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20216 *ret_conv = UpdateFee_read(ser_ref);
20217 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20218 return (uint64_t)ret_conv;
20221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20222 LDKUpdateFulfillHTLC obj_conv;
20223 obj_conv.inner = (void*)(obj & (~1));
20224 obj_conv.is_owned = false;
20225 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
20226 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20227 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20228 CVec_u8Z_free(ret_var);
20232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20233 LDKu8slice ser_ref;
20234 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20235 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20236 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20237 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
20238 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20239 return (uint64_t)ret_conv;
20242 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20243 LDKUpdateAddHTLC obj_conv;
20244 obj_conv.inner = (void*)(obj & (~1));
20245 obj_conv.is_owned = false;
20246 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
20247 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20248 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20249 CVec_u8Z_free(ret_var);
20253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20254 LDKu8slice ser_ref;
20255 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20256 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20257 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20258 *ret_conv = UpdateAddHTLC_read(ser_ref);
20259 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20260 return (uint64_t)ret_conv;
20263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
20265 obj_conv.inner = (void*)(obj & (~1));
20266 obj_conv.is_owned = false;
20267 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
20268 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20269 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20270 CVec_u8Z_free(ret_var);
20274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20275 LDKu8slice ser_ref;
20276 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20277 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20278 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20279 *ret_conv = Ping_read(ser_ref);
20280 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20281 return (uint64_t)ret_conv;
20284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
20286 obj_conv.inner = (void*)(obj & (~1));
20287 obj_conv.is_owned = false;
20288 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
20289 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20290 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20291 CVec_u8Z_free(ret_var);
20295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20296 LDKu8slice ser_ref;
20297 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20298 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20299 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20300 *ret_conv = Pong_read(ser_ref);
20301 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20302 return (uint64_t)ret_conv;
20305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20306 LDKUnsignedChannelAnnouncement obj_conv;
20307 obj_conv.inner = (void*)(obj & (~1));
20308 obj_conv.is_owned = false;
20309 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
20310 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20311 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20312 CVec_u8Z_free(ret_var);
20316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20317 LDKu8slice ser_ref;
20318 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20319 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20320 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20321 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
20322 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20323 return (uint64_t)ret_conv;
20326 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20327 LDKChannelAnnouncement obj_conv;
20328 obj_conv.inner = (void*)(obj & (~1));
20329 obj_conv.is_owned = false;
20330 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
20331 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20332 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20333 CVec_u8Z_free(ret_var);
20337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20338 LDKu8slice ser_ref;
20339 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20340 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20341 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20342 *ret_conv = ChannelAnnouncement_read(ser_ref);
20343 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20344 return (uint64_t)ret_conv;
20347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20348 LDKUnsignedChannelUpdate obj_conv;
20349 obj_conv.inner = (void*)(obj & (~1));
20350 obj_conv.is_owned = false;
20351 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
20352 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20353 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20354 CVec_u8Z_free(ret_var);
20358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20359 LDKu8slice ser_ref;
20360 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20361 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20362 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20363 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
20364 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20365 return (uint64_t)ret_conv;
20368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
20369 LDKChannelUpdate obj_conv;
20370 obj_conv.inner = (void*)(obj & (~1));
20371 obj_conv.is_owned = false;
20372 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
20373 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20374 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20375 CVec_u8Z_free(ret_var);
20379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20380 LDKu8slice ser_ref;
20381 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20382 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20383 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20384 *ret_conv = ChannelUpdate_read(ser_ref);
20385 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20386 return (uint64_t)ret_conv;
20389 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
20390 LDKErrorMessage obj_conv;
20391 obj_conv.inner = (void*)(obj & (~1));
20392 obj_conv.is_owned = false;
20393 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
20394 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20395 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20396 CVec_u8Z_free(ret_var);
20400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20401 LDKu8slice ser_ref;
20402 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20403 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20404 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20405 *ret_conv = ErrorMessage_read(ser_ref);
20406 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20407 return (uint64_t)ret_conv;
20410 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20411 LDKUnsignedNodeAnnouncement obj_conv;
20412 obj_conv.inner = (void*)(obj & (~1));
20413 obj_conv.is_owned = false;
20414 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
20415 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20416 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20417 CVec_u8Z_free(ret_var);
20421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20422 LDKu8slice ser_ref;
20423 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20424 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20425 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20426 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
20427 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20428 return (uint64_t)ret_conv;
20431 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
20432 LDKNodeAnnouncement obj_conv;
20433 obj_conv.inner = (void*)(obj & (~1));
20434 obj_conv.is_owned = false;
20435 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
20436 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20437 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20438 CVec_u8Z_free(ret_var);
20442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20443 LDKu8slice ser_ref;
20444 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20445 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20446 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20447 *ret_conv = NodeAnnouncement_read(ser_ref);
20448 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20449 return (uint64_t)ret_conv;
20452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20453 LDKu8slice ser_ref;
20454 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20455 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20456 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20457 *ret_conv = QueryShortChannelIds_read(ser_ref);
20458 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20459 return (uint64_t)ret_conv;
20462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
20463 LDKQueryShortChannelIds obj_conv;
20464 obj_conv.inner = (void*)(obj & (~1));
20465 obj_conv.is_owned = false;
20466 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
20467 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20468 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20469 CVec_u8Z_free(ret_var);
20473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20474 LDKu8slice ser_ref;
20475 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20476 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20477 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20478 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
20479 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20480 return (uint64_t)ret_conv;
20483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
20484 LDKReplyShortChannelIdsEnd obj_conv;
20485 obj_conv.inner = (void*)(obj & (~1));
20486 obj_conv.is_owned = false;
20487 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
20488 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20489 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20490 CVec_u8Z_free(ret_var);
20494 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
20495 LDKQueryChannelRange this_arg_conv;
20496 this_arg_conv.inner = (void*)(this_arg & (~1));
20497 this_arg_conv.is_owned = false;
20498 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
20502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20503 LDKu8slice ser_ref;
20504 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20505 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20506 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20507 *ret_conv = QueryChannelRange_read(ser_ref);
20508 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20509 return (uint64_t)ret_conv;
20512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20513 LDKQueryChannelRange obj_conv;
20514 obj_conv.inner = (void*)(obj & (~1));
20515 obj_conv.is_owned = false;
20516 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
20517 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20518 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20519 CVec_u8Z_free(ret_var);
20523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20524 LDKu8slice ser_ref;
20525 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20526 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20527 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20528 *ret_conv = ReplyChannelRange_read(ser_ref);
20529 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20530 return (uint64_t)ret_conv;
20533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
20534 LDKReplyChannelRange obj_conv;
20535 obj_conv.inner = (void*)(obj & (~1));
20536 obj_conv.is_owned = false;
20537 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
20538 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20539 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20540 CVec_u8Z_free(ret_var);
20544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20545 LDKu8slice ser_ref;
20546 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20547 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20548 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20549 *ret_conv = GossipTimestampFilter_read(ser_ref);
20550 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20551 return (uint64_t)ret_conv;
20554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
20555 LDKGossipTimestampFilter obj_conv;
20556 obj_conv.inner = (void*)(obj & (~1));
20557 obj_conv.is_owned = false;
20558 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
20559 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20560 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20561 CVec_u8Z_free(ret_var);
20565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20566 LDKIgnoringMessageHandler this_obj_conv;
20567 this_obj_conv.inner = (void*)(this_obj & (~1));
20568 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20569 IgnoringMessageHandler_free(this_obj_conv);
20572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
20573 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
20574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20576 uint64_t ret_ref = (uint64_t)ret_var.inner;
20577 if (ret_var.is_owned) {
20583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20584 LDKIgnoringMessageHandler this_arg_conv;
20585 this_arg_conv.inner = (void*)(this_arg & (~1));
20586 this_arg_conv.is_owned = false;
20587 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20588 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20589 return (uint64_t)ret;
20592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20593 LDKIgnoringMessageHandler this_arg_conv;
20594 this_arg_conv.inner = (void*)(this_arg & (~1));
20595 this_arg_conv.is_owned = false;
20596 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
20597 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
20598 return (uint64_t)ret;
20601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20602 LDKErroringMessageHandler this_obj_conv;
20603 this_obj_conv.inner = (void*)(this_obj & (~1));
20604 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20605 ErroringMessageHandler_free(this_obj_conv);
20608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
20609 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
20610 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20611 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20612 uint64_t ret_ref = (uint64_t)ret_var.inner;
20613 if (ret_var.is_owned) {
20619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
20620 LDKErroringMessageHandler this_arg_conv;
20621 this_arg_conv.inner = (void*)(this_arg & (~1));
20622 this_arg_conv.is_owned = false;
20623 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
20624 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
20625 return (uint64_t)ret;
20628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
20629 LDKErroringMessageHandler this_arg_conv;
20630 this_arg_conv.inner = (void*)(this_arg & (~1));
20631 this_arg_conv.is_owned = false;
20632 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20633 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
20634 return (uint64_t)ret;
20637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20638 LDKMessageHandler this_obj_conv;
20639 this_obj_conv.inner = (void*)(this_obj & (~1));
20640 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20641 MessageHandler_free(this_obj_conv);
20644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20645 LDKMessageHandler this_ptr_conv;
20646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20647 this_ptr_conv.is_owned = false;
20648 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
20652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20653 LDKMessageHandler this_ptr_conv;
20654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20655 this_ptr_conv.is_owned = false;
20656 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
20657 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
20658 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20659 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
20661 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
20664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
20665 LDKMessageHandler this_ptr_conv;
20666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20667 this_ptr_conv.is_owned = false;
20668 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
20672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20673 LDKMessageHandler this_ptr_conv;
20674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20675 this_ptr_conv.is_owned = false;
20676 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
20677 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20678 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20679 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
20681 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
20684 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) {
20685 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
20686 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
20687 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20688 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
20690 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
20691 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
20692 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20693 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
20695 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
20696 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20697 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20698 uint64_t ret_ref = (uint64_t)ret_var.inner;
20699 if (ret_var.is_owned) {
20705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20706 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
20707 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
20708 *ret = SocketDescriptor_clone(orig_conv);
20709 return (uint64_t)ret;
20712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20713 if ((this_ptr & 1) != 0) return;
20714 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
20715 FREE((void*)this_ptr);
20716 SocketDescriptor_free(this_ptr_conv);
20719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20720 LDKPeerHandleError this_obj_conv;
20721 this_obj_conv.inner = (void*)(this_obj & (~1));
20722 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20723 PeerHandleError_free(this_obj_conv);
20726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
20727 LDKPeerHandleError this_ptr_conv;
20728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20729 this_ptr_conv.is_owned = false;
20730 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
20734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20735 LDKPeerHandleError this_ptr_conv;
20736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20737 this_ptr_conv.is_owned = false;
20738 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
20741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
20742 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
20743 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20744 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20745 uint64_t ret_ref = (uint64_t)ret_var.inner;
20746 if (ret_var.is_owned) {
20752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20753 LDKPeerHandleError orig_conv;
20754 orig_conv.inner = (void*)(orig & (~1));
20755 orig_conv.is_owned = false;
20756 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_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 void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20767 LDKPeerManager this_obj_conv;
20768 this_obj_conv.inner = (void*)(this_obj & (~1));
20769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20770 PeerManager_free(this_obj_conv);
20773 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) {
20774 LDKMessageHandler message_handler_conv;
20775 message_handler_conv.inner = (void*)(message_handler & (~1));
20776 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
20777 // Warning: we need a move here but no clone is available for LDKMessageHandler
20778 LDKSecretKey our_node_secret_ref;
20779 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
20780 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
20781 unsigned char ephemeral_random_data_arr[32];
20782 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
20783 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
20784 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
20785 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
20786 if (logger_conv.free == LDKLogger_JCalls_free) {
20787 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20788 LDKLogger_JCalls_clone(logger_conv.this_arg);
20790 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
20791 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20792 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20793 uint64_t ret_ref = (uint64_t)ret_var.inner;
20794 if (ret_var.is_owned) {
20800 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
20801 LDKPeerManager this_arg_conv;
20802 this_arg_conv.inner = (void*)(this_arg & (~1));
20803 this_arg_conv.is_owned = false;
20804 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
20805 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
20807 for (size_t i = 0; i < ret_var.datalen; i++) {
20808 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
20809 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
20810 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
20812 FREE(ret_var.data);
20816 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) {
20817 LDKPeerManager this_arg_conv;
20818 this_arg_conv.inner = (void*)(this_arg & (~1));
20819 this_arg_conv.is_owned = false;
20820 LDKPublicKey their_node_id_ref;
20821 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20822 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20823 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20824 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20825 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20826 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20828 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
20829 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
20830 return (uint64_t)ret_conv;
20833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20834 LDKPeerManager this_arg_conv;
20835 this_arg_conv.inner = (void*)(this_arg & (~1));
20836 this_arg_conv.is_owned = false;
20837 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20838 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
20839 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20840 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
20842 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20843 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
20844 return (uint64_t)ret_conv;
20847 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) {
20848 LDKPeerManager this_arg_conv;
20849 this_arg_conv.inner = (void*)(this_arg & (~1));
20850 this_arg_conv.is_owned = false;
20851 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20852 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
20853 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
20854 return (uint64_t)ret_conv;
20857 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) {
20858 LDKPeerManager this_arg_conv;
20859 this_arg_conv.inner = (void*)(this_arg & (~1));
20860 this_arg_conv.is_owned = false;
20861 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
20862 LDKu8slice data_ref;
20863 data_ref.datalen = (*env)->GetArrayLength(env, data);
20864 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
20865 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
20866 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
20867 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
20868 return (uint64_t)ret_conv;
20871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
20872 LDKPeerManager this_arg_conv;
20873 this_arg_conv.inner = (void*)(this_arg & (~1));
20874 this_arg_conv.is_owned = false;
20875 PeerManager_process_events(&this_arg_conv);
20878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
20879 LDKPeerManager this_arg_conv;
20880 this_arg_conv.inner = (void*)(this_arg & (~1));
20881 this_arg_conv.is_owned = false;
20882 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
20883 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
20886 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) {
20887 LDKPeerManager this_arg_conv;
20888 this_arg_conv.inner = (void*)(this_arg & (~1));
20889 this_arg_conv.is_owned = false;
20890 LDKPublicKey node_id_ref;
20891 CHECK((*env)->GetArrayLength(env, node_id) == 33);
20892 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
20893 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
20896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
20897 LDKPeerManager this_arg_conv;
20898 this_arg_conv.inner = (void*)(this_arg & (~1));
20899 this_arg_conv.is_owned = false;
20900 PeerManager_timer_tick_occurred(&this_arg_conv);
20903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
20904 unsigned char commitment_seed_arr[32];
20905 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
20906 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
20907 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
20908 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20909 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
20913 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) {
20914 LDKPublicKey per_commitment_point_ref;
20915 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20916 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20917 unsigned char base_secret_arr[32];
20918 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
20919 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
20920 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
20921 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20922 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
20923 return (uint64_t)ret_conv;
20926 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) {
20927 LDKPublicKey per_commitment_point_ref;
20928 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20929 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20930 LDKPublicKey base_point_ref;
20931 CHECK((*env)->GetArrayLength(env, base_point) == 33);
20932 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
20933 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20934 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
20935 return (uint64_t)ret_conv;
20938 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) {
20939 unsigned char per_commitment_secret_arr[32];
20940 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
20941 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
20942 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
20943 unsigned char countersignatory_revocation_base_secret_arr[32];
20944 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
20945 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
20946 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
20947 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
20948 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
20949 return (uint64_t)ret_conv;
20952 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) {
20953 LDKPublicKey per_commitment_point_ref;
20954 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
20955 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
20956 LDKPublicKey countersignatory_revocation_base_point_ref;
20957 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
20958 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
20959 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
20960 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
20961 return (uint64_t)ret_conv;
20964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20965 LDKTxCreationKeys this_obj_conv;
20966 this_obj_conv.inner = (void*)(this_obj & (~1));
20967 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20968 TxCreationKeys_free(this_obj_conv);
20971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
20972 LDKTxCreationKeys this_ptr_conv;
20973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20974 this_ptr_conv.is_owned = false;
20975 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20976 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
20980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20981 LDKTxCreationKeys this_ptr_conv;
20982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20983 this_ptr_conv.is_owned = false;
20984 LDKPublicKey val_ref;
20985 CHECK((*env)->GetArrayLength(env, val) == 33);
20986 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
20987 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
20990 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
20991 LDKTxCreationKeys this_ptr_conv;
20992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20993 this_ptr_conv.is_owned = false;
20994 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20995 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
20999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21000 LDKTxCreationKeys this_ptr_conv;
21001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21002 this_ptr_conv.is_owned = false;
21003 LDKPublicKey val_ref;
21004 CHECK((*env)->GetArrayLength(env, val) == 33);
21005 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21006 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21010 LDKTxCreationKeys this_ptr_conv;
21011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21012 this_ptr_conv.is_owned = false;
21013 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21014 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21019 LDKTxCreationKeys this_ptr_conv;
21020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21021 this_ptr_conv.is_owned = false;
21022 LDKPublicKey val_ref;
21023 CHECK((*env)->GetArrayLength(env, val) == 33);
21024 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21025 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21029 LDKTxCreationKeys this_ptr_conv;
21030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21031 this_ptr_conv.is_owned = false;
21032 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21033 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21038 LDKTxCreationKeys this_ptr_conv;
21039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21040 this_ptr_conv.is_owned = false;
21041 LDKPublicKey val_ref;
21042 CHECK((*env)->GetArrayLength(env, val) == 33);
21043 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21044 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21048 LDKTxCreationKeys this_ptr_conv;
21049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21050 this_ptr_conv.is_owned = false;
21051 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21052 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21056 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) {
21057 LDKTxCreationKeys this_ptr_conv;
21058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21059 this_ptr_conv.is_owned = false;
21060 LDKPublicKey val_ref;
21061 CHECK((*env)->GetArrayLength(env, val) == 33);
21062 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21063 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21066 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) {
21067 LDKPublicKey per_commitment_point_arg_ref;
21068 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21069 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21070 LDKPublicKey revocation_key_arg_ref;
21071 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21072 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21073 LDKPublicKey broadcaster_htlc_key_arg_ref;
21074 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21075 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21076 LDKPublicKey countersignatory_htlc_key_arg_ref;
21077 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21078 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21079 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21080 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21081 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21082 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);
21083 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21084 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21085 uint64_t ret_ref = (uint64_t)ret_var.inner;
21086 if (ret_var.is_owned) {
21092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21093 LDKTxCreationKeys orig_conv;
21094 orig_conv.inner = (void*)(orig & (~1));
21095 orig_conv.is_owned = false;
21096 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21097 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21098 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21099 uint64_t ret_ref = (uint64_t)ret_var.inner;
21100 if (ret_var.is_owned) {
21106 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21107 LDKTxCreationKeys obj_conv;
21108 obj_conv.inner = (void*)(obj & (~1));
21109 obj_conv.is_owned = false;
21110 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21111 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21112 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21113 CVec_u8Z_free(ret_var);
21117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21118 LDKu8slice ser_ref;
21119 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21120 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21121 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21122 *ret_conv = TxCreationKeys_read(ser_ref);
21123 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21124 return (uint64_t)ret_conv;
21127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21128 LDKChannelPublicKeys this_obj_conv;
21129 this_obj_conv.inner = (void*)(this_obj & (~1));
21130 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21131 ChannelPublicKeys_free(this_obj_conv);
21134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21135 LDKChannelPublicKeys this_ptr_conv;
21136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21137 this_ptr_conv.is_owned = false;
21138 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21139 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21144 LDKChannelPublicKeys this_ptr_conv;
21145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21146 this_ptr_conv.is_owned = false;
21147 LDKPublicKey val_ref;
21148 CHECK((*env)->GetArrayLength(env, val) == 33);
21149 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21150 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21153 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21154 LDKChannelPublicKeys this_ptr_conv;
21155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21156 this_ptr_conv.is_owned = false;
21157 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21158 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21163 LDKChannelPublicKeys this_ptr_conv;
21164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21165 this_ptr_conv.is_owned = false;
21166 LDKPublicKey val_ref;
21167 CHECK((*env)->GetArrayLength(env, val) == 33);
21168 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21169 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21173 LDKChannelPublicKeys this_ptr_conv;
21174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21175 this_ptr_conv.is_owned = false;
21176 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21177 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21182 LDKChannelPublicKeys this_ptr_conv;
21183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21184 this_ptr_conv.is_owned = false;
21185 LDKPublicKey val_ref;
21186 CHECK((*env)->GetArrayLength(env, val) == 33);
21187 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21188 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21192 LDKChannelPublicKeys this_ptr_conv;
21193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21194 this_ptr_conv.is_owned = false;
21195 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21196 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
21200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21201 LDKChannelPublicKeys this_ptr_conv;
21202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21203 this_ptr_conv.is_owned = false;
21204 LDKPublicKey val_ref;
21205 CHECK((*env)->GetArrayLength(env, val) == 33);
21206 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21207 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
21210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21211 LDKChannelPublicKeys this_ptr_conv;
21212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21213 this_ptr_conv.is_owned = false;
21214 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21215 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
21219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21220 LDKChannelPublicKeys this_ptr_conv;
21221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21222 this_ptr_conv.is_owned = false;
21223 LDKPublicKey val_ref;
21224 CHECK((*env)->GetArrayLength(env, val) == 33);
21225 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21226 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
21229 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) {
21230 LDKPublicKey funding_pubkey_arg_ref;
21231 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
21232 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
21233 LDKPublicKey revocation_basepoint_arg_ref;
21234 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
21235 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
21236 LDKPublicKey payment_point_arg_ref;
21237 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
21238 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
21239 LDKPublicKey delayed_payment_basepoint_arg_ref;
21240 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
21241 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
21242 LDKPublicKey htlc_basepoint_arg_ref;
21243 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
21244 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
21245 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);
21246 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21247 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21248 uint64_t ret_ref = (uint64_t)ret_var.inner;
21249 if (ret_var.is_owned) {
21255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21256 LDKChannelPublicKeys orig_conv;
21257 orig_conv.inner = (void*)(orig & (~1));
21258 orig_conv.is_owned = false;
21259 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
21260 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21261 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21262 uint64_t ret_ref = (uint64_t)ret_var.inner;
21263 if (ret_var.is_owned) {
21269 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21270 LDKChannelPublicKeys obj_conv;
21271 obj_conv.inner = (void*)(obj & (~1));
21272 obj_conv.is_owned = false;
21273 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
21274 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21275 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21276 CVec_u8Z_free(ret_var);
21280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21281 LDKu8slice ser_ref;
21282 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21283 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21284 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
21285 *ret_conv = ChannelPublicKeys_read(ser_ref);
21286 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21287 return (uint64_t)ret_conv;
21290 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) {
21291 LDKPublicKey per_commitment_point_ref;
21292 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21293 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21294 LDKPublicKey broadcaster_delayed_payment_base_ref;
21295 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
21296 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
21297 LDKPublicKey broadcaster_htlc_base_ref;
21298 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
21299 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
21300 LDKPublicKey countersignatory_revocation_base_ref;
21301 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
21302 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
21303 LDKPublicKey countersignatory_htlc_base_ref;
21304 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
21305 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
21306 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21307 *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);
21308 return (uint64_t)ret_conv;
21311 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) {
21312 LDKPublicKey per_commitment_point_ref;
21313 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21314 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21315 LDKChannelPublicKeys broadcaster_keys_conv;
21316 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
21317 broadcaster_keys_conv.is_owned = false;
21318 LDKChannelPublicKeys countersignatory_keys_conv;
21319 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
21320 countersignatory_keys_conv.is_owned = false;
21321 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
21322 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
21323 return (uint64_t)ret_conv;
21326 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) {
21327 LDKPublicKey revocation_key_ref;
21328 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21329 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21330 LDKPublicKey broadcaster_delayed_payment_key_ref;
21331 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21332 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21333 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
21334 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21335 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21336 CVec_u8Z_free(ret_var);
21340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21341 LDKHTLCOutputInCommitment this_obj_conv;
21342 this_obj_conv.inner = (void*)(this_obj & (~1));
21343 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21344 HTLCOutputInCommitment_free(this_obj_conv);
21347 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
21348 LDKHTLCOutputInCommitment this_ptr_conv;
21349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21350 this_ptr_conv.is_owned = false;
21351 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
21355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21356 LDKHTLCOutputInCommitment this_ptr_conv;
21357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21358 this_ptr_conv.is_owned = false;
21359 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
21362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
21363 LDKHTLCOutputInCommitment this_ptr_conv;
21364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21365 this_ptr_conv.is_owned = false;
21366 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
21370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21371 LDKHTLCOutputInCommitment this_ptr_conv;
21372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21373 this_ptr_conv.is_owned = false;
21374 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
21377 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
21378 LDKHTLCOutputInCommitment this_ptr_conv;
21379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21380 this_ptr_conv.is_owned = false;
21381 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
21385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
21386 LDKHTLCOutputInCommitment this_ptr_conv;
21387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21388 this_ptr_conv.is_owned = false;
21389 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
21392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
21393 LDKHTLCOutputInCommitment this_ptr_conv;
21394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21395 this_ptr_conv.is_owned = false;
21396 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21397 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
21401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21402 LDKHTLCOutputInCommitment this_ptr_conv;
21403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21404 this_ptr_conv.is_owned = false;
21405 LDKThirtyTwoBytes val_ref;
21406 CHECK((*env)->GetArrayLength(env, val) == 32);
21407 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
21408 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
21411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
21412 LDKHTLCOutputInCommitment this_ptr_conv;
21413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21414 this_ptr_conv.is_owned = false;
21415 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
21416 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
21417 uint64_t ret_ref = (uint64_t)ret_copy;
21421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21422 LDKHTLCOutputInCommitment this_ptr_conv;
21423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21424 this_ptr_conv.is_owned = false;
21425 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
21426 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
21429 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) {
21430 LDKThirtyTwoBytes payment_hash_arg_ref;
21431 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
21432 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
21433 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
21434 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
21435 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21436 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21437 uint64_t ret_ref = (uint64_t)ret_var.inner;
21438 if (ret_var.is_owned) {
21444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21445 LDKHTLCOutputInCommitment orig_conv;
21446 orig_conv.inner = (void*)(orig & (~1));
21447 orig_conv.is_owned = false;
21448 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
21449 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21450 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21451 uint64_t ret_ref = (uint64_t)ret_var.inner;
21452 if (ret_var.is_owned) {
21458 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
21459 LDKHTLCOutputInCommitment obj_conv;
21460 obj_conv.inner = (void*)(obj & (~1));
21461 obj_conv.is_owned = false;
21462 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
21463 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21464 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21465 CVec_u8Z_free(ret_var);
21469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21470 LDKu8slice ser_ref;
21471 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21472 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21473 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
21474 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
21475 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21476 return (uint64_t)ret_conv;
21479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
21480 LDKHTLCOutputInCommitment htlc_conv;
21481 htlc_conv.inner = (void*)(htlc & (~1));
21482 htlc_conv.is_owned = false;
21483 LDKTxCreationKeys keys_conv;
21484 keys_conv.inner = (void*)(keys & (~1));
21485 keys_conv.is_owned = false;
21486 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
21487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21489 CVec_u8Z_free(ret_var);
21493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
21494 LDKPublicKey broadcaster_ref;
21495 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
21496 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
21497 LDKPublicKey countersignatory_ref;
21498 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
21499 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
21500 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
21501 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21502 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21503 CVec_u8Z_free(ret_var);
21507 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) {
21508 unsigned char commitment_txid_arr[32];
21509 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
21510 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
21511 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
21512 LDKHTLCOutputInCommitment htlc_conv;
21513 htlc_conv.inner = (void*)(htlc & (~1));
21514 htlc_conv.is_owned = false;
21515 LDKPublicKey broadcaster_delayed_payment_key_ref;
21516 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
21517 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
21518 LDKPublicKey revocation_key_ref;
21519 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
21520 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
21521 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
21522 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21523 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21524 Transaction_free(ret_var);
21528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21529 LDKChannelTransactionParameters this_obj_conv;
21530 this_obj_conv.inner = (void*)(this_obj & (~1));
21531 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21532 ChannelTransactionParameters_free(this_obj_conv);
21535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21536 LDKChannelTransactionParameters this_ptr_conv;
21537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21538 this_ptr_conv.is_owned = false;
21539 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
21540 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21541 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21542 uint64_t ret_ref = (uint64_t)ret_var.inner;
21543 if (ret_var.is_owned) {
21549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21550 LDKChannelTransactionParameters this_ptr_conv;
21551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21552 this_ptr_conv.is_owned = false;
21553 LDKChannelPublicKeys val_conv;
21554 val_conv.inner = (void*)(val & (~1));
21555 val_conv.is_owned = (val & 1) || (val == 0);
21556 val_conv = ChannelPublicKeys_clone(&val_conv);
21557 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
21560 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21561 LDKChannelTransactionParameters this_ptr_conv;
21562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21563 this_ptr_conv.is_owned = false;
21564 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
21568 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) {
21569 LDKChannelTransactionParameters this_ptr_conv;
21570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21571 this_ptr_conv.is_owned = false;
21572 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
21575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
21576 LDKChannelTransactionParameters this_ptr_conv;
21577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21578 this_ptr_conv.is_owned = false;
21579 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
21583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21584 LDKChannelTransactionParameters this_ptr_conv;
21585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21586 this_ptr_conv.is_owned = false;
21587 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
21590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
21591 LDKChannelTransactionParameters this_ptr_conv;
21592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21593 this_ptr_conv.is_owned = false;
21594 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
21595 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21596 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21597 uint64_t ret_ref = (uint64_t)ret_var.inner;
21598 if (ret_var.is_owned) {
21604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21605 LDKChannelTransactionParameters this_ptr_conv;
21606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21607 this_ptr_conv.is_owned = false;
21608 LDKCounterpartyChannelTransactionParameters val_conv;
21609 val_conv.inner = (void*)(val & (~1));
21610 val_conv.is_owned = (val & 1) || (val == 0);
21611 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
21612 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
21615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21616 LDKChannelTransactionParameters this_ptr_conv;
21617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21618 this_ptr_conv.is_owned = false;
21619 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
21620 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21621 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21622 uint64_t ret_ref = (uint64_t)ret_var.inner;
21623 if (ret_var.is_owned) {
21629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21630 LDKChannelTransactionParameters this_ptr_conv;
21631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21632 this_ptr_conv.is_owned = false;
21633 LDKOutPoint val_conv;
21634 val_conv.inner = (void*)(val & (~1));
21635 val_conv.is_owned = (val & 1) || (val == 0);
21636 val_conv = OutPoint_clone(&val_conv);
21637 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
21640 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) {
21641 LDKChannelPublicKeys holder_pubkeys_arg_conv;
21642 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
21643 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
21644 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
21645 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
21646 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
21647 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
21648 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
21649 LDKOutPoint funding_outpoint_arg_conv;
21650 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
21651 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
21652 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
21653 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);
21654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21656 uint64_t ret_ref = (uint64_t)ret_var.inner;
21657 if (ret_var.is_owned) {
21663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21664 LDKChannelTransactionParameters orig_conv;
21665 orig_conv.inner = (void*)(orig & (~1));
21666 orig_conv.is_owned = false;
21667 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
21668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21670 uint64_t ret_ref = (uint64_t)ret_var.inner;
21671 if (ret_var.is_owned) {
21677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21678 LDKCounterpartyChannelTransactionParameters this_obj_conv;
21679 this_obj_conv.inner = (void*)(this_obj & (~1));
21680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21681 CounterpartyChannelTransactionParameters_free(this_obj_conv);
21684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
21685 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21687 this_ptr_conv.is_owned = false;
21688 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
21689 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21690 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21691 uint64_t ret_ref = (uint64_t)ret_var.inner;
21692 if (ret_var.is_owned) {
21698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21699 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21701 this_ptr_conv.is_owned = false;
21702 LDKChannelPublicKeys val_conv;
21703 val_conv.inner = (void*)(val & (~1));
21704 val_conv.is_owned = (val & 1) || (val == 0);
21705 val_conv = ChannelPublicKeys_clone(&val_conv);
21706 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
21709 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
21710 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21712 this_ptr_conv.is_owned = false;
21713 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
21717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
21718 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
21719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21720 this_ptr_conv.is_owned = false;
21721 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
21724 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) {
21725 LDKChannelPublicKeys pubkeys_arg_conv;
21726 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
21727 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
21728 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
21729 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
21730 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21731 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21732 uint64_t ret_ref = (uint64_t)ret_var.inner;
21733 if (ret_var.is_owned) {
21739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21740 LDKCounterpartyChannelTransactionParameters orig_conv;
21741 orig_conv.inner = (void*)(orig & (~1));
21742 orig_conv.is_owned = false;
21743 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
21744 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21745 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21746 uint64_t ret_ref = (uint64_t)ret_var.inner;
21747 if (ret_var.is_owned) {
21753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
21754 LDKChannelTransactionParameters this_arg_conv;
21755 this_arg_conv.inner = (void*)(this_arg & (~1));
21756 this_arg_conv.is_owned = false;
21757 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
21761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21762 LDKChannelTransactionParameters this_arg_conv;
21763 this_arg_conv.inner = (void*)(this_arg & (~1));
21764 this_arg_conv.is_owned = false;
21765 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
21766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21768 uint64_t ret_ref = (uint64_t)ret_var.inner;
21769 if (ret_var.is_owned) {
21775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
21776 LDKChannelTransactionParameters this_arg_conv;
21777 this_arg_conv.inner = (void*)(this_arg & (~1));
21778 this_arg_conv.is_owned = false;
21779 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
21780 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21781 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21782 uint64_t ret_ref = (uint64_t)ret_var.inner;
21783 if (ret_var.is_owned) {
21789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21790 LDKCounterpartyChannelTransactionParameters obj_conv;
21791 obj_conv.inner = (void*)(obj & (~1));
21792 obj_conv.is_owned = false;
21793 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
21794 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21795 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21796 CVec_u8Z_free(ret_var);
21800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21801 LDKu8slice ser_ref;
21802 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21803 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21804 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
21805 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
21806 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21807 return (uint64_t)ret_conv;
21810 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
21811 LDKChannelTransactionParameters obj_conv;
21812 obj_conv.inner = (void*)(obj & (~1));
21813 obj_conv.is_owned = false;
21814 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
21815 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21816 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21817 CVec_u8Z_free(ret_var);
21821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21822 LDKu8slice ser_ref;
21823 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21824 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21825 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
21826 *ret_conv = ChannelTransactionParameters_read(ser_ref);
21827 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21828 return (uint64_t)ret_conv;
21831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21832 LDKDirectedChannelTransactionParameters this_obj_conv;
21833 this_obj_conv.inner = (void*)(this_obj & (~1));
21834 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21835 DirectedChannelTransactionParameters_free(this_obj_conv);
21838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21839 LDKDirectedChannelTransactionParameters this_arg_conv;
21840 this_arg_conv.inner = (void*)(this_arg & (~1));
21841 this_arg_conv.is_owned = false;
21842 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
21843 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21844 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21845 uint64_t ret_ref = (uint64_t)ret_var.inner;
21846 if (ret_var.is_owned) {
21852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
21853 LDKDirectedChannelTransactionParameters this_arg_conv;
21854 this_arg_conv.inner = (void*)(this_arg & (~1));
21855 this_arg_conv.is_owned = false;
21856 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
21857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21859 uint64_t ret_ref = (uint64_t)ret_var.inner;
21860 if (ret_var.is_owned) {
21866 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
21867 LDKDirectedChannelTransactionParameters this_arg_conv;
21868 this_arg_conv.inner = (void*)(this_arg & (~1));
21869 this_arg_conv.is_owned = false;
21870 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
21874 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
21875 LDKDirectedChannelTransactionParameters this_arg_conv;
21876 this_arg_conv.inner = (void*)(this_arg & (~1));
21877 this_arg_conv.is_owned = false;
21878 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
21882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
21883 LDKDirectedChannelTransactionParameters this_arg_conv;
21884 this_arg_conv.inner = (void*)(this_arg & (~1));
21885 this_arg_conv.is_owned = false;
21886 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
21887 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21888 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21889 uint64_t ret_ref = (uint64_t)ret_var.inner;
21890 if (ret_var.is_owned) {
21896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21897 LDKHolderCommitmentTransaction this_obj_conv;
21898 this_obj_conv.inner = (void*)(this_obj & (~1));
21899 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21900 HolderCommitmentTransaction_free(this_obj_conv);
21903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
21904 LDKHolderCommitmentTransaction this_ptr_conv;
21905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21906 this_ptr_conv.is_owned = false;
21907 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
21908 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
21912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21913 LDKHolderCommitmentTransaction this_ptr_conv;
21914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21915 this_ptr_conv.is_owned = false;
21916 LDKSignature val_ref;
21917 CHECK((*env)->GetArrayLength(env, val) == 64);
21918 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
21919 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
21922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
21923 LDKHolderCommitmentTransaction this_ptr_conv;
21924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21925 this_ptr_conv.is_owned = false;
21926 LDKCVec_SignatureZ val_constr;
21927 val_constr.datalen = (*env)->GetArrayLength(env, val);
21928 if (val_constr.datalen > 0)
21929 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21931 val_constr.data = NULL;
21932 for (size_t i = 0; i < val_constr.datalen; i++) {
21933 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
21934 LDKSignature val_conv_8_ref;
21935 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
21936 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
21937 val_constr.data[i] = val_conv_8_ref;
21939 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
21942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21943 LDKHolderCommitmentTransaction orig_conv;
21944 orig_conv.inner = (void*)(orig & (~1));
21945 orig_conv.is_owned = false;
21946 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
21947 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21948 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21949 uint64_t ret_ref = (uint64_t)ret_var.inner;
21950 if (ret_var.is_owned) {
21956 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
21957 LDKHolderCommitmentTransaction obj_conv;
21958 obj_conv.inner = (void*)(obj & (~1));
21959 obj_conv.is_owned = false;
21960 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
21961 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21962 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21963 CVec_u8Z_free(ret_var);
21967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21968 LDKu8slice ser_ref;
21969 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21970 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21971 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
21972 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
21973 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21974 return (uint64_t)ret_conv;
21977 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) {
21978 LDKCommitmentTransaction commitment_tx_conv;
21979 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
21980 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
21981 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
21982 LDKSignature counterparty_sig_ref;
21983 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
21984 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
21985 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
21986 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
21987 if (counterparty_htlc_sigs_constr.datalen > 0)
21988 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
21990 counterparty_htlc_sigs_constr.data = NULL;
21991 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
21992 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
21993 LDKSignature counterparty_htlc_sigs_conv_8_ref;
21994 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
21995 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
21996 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
21998 LDKPublicKey holder_funding_key_ref;
21999 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
22000 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
22001 LDKPublicKey counterparty_funding_key_ref;
22002 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22003 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22004 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22005 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22006 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22007 uint64_t ret_ref = (uint64_t)ret_var.inner;
22008 if (ret_var.is_owned) {
22014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22015 LDKBuiltCommitmentTransaction this_obj_conv;
22016 this_obj_conv.inner = (void*)(this_obj & (~1));
22017 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22018 BuiltCommitmentTransaction_free(this_obj_conv);
22021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22022 LDKBuiltCommitmentTransaction this_ptr_conv;
22023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22024 this_ptr_conv.is_owned = false;
22025 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22026 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22027 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22028 Transaction_free(ret_var);
22032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22033 LDKBuiltCommitmentTransaction this_ptr_conv;
22034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22035 this_ptr_conv.is_owned = false;
22036 LDKTransaction val_ref;
22037 val_ref.datalen = (*env)->GetArrayLength(env, val);
22038 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22039 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22040 val_ref.data_is_owned = true;
22041 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22044 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22045 LDKBuiltCommitmentTransaction this_ptr_conv;
22046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22047 this_ptr_conv.is_owned = false;
22048 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22049 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22054 LDKBuiltCommitmentTransaction this_ptr_conv;
22055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22056 this_ptr_conv.is_owned = false;
22057 LDKThirtyTwoBytes val_ref;
22058 CHECK((*env)->GetArrayLength(env, val) == 32);
22059 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22060 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22064 LDKTransaction transaction_arg_ref;
22065 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22066 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22067 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22068 transaction_arg_ref.data_is_owned = true;
22069 LDKThirtyTwoBytes txid_arg_ref;
22070 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22071 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22072 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22075 uint64_t ret_ref = (uint64_t)ret_var.inner;
22076 if (ret_var.is_owned) {
22082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22083 LDKBuiltCommitmentTransaction orig_conv;
22084 orig_conv.inner = (void*)(orig & (~1));
22085 orig_conv.is_owned = false;
22086 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22087 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22088 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22089 uint64_t ret_ref = (uint64_t)ret_var.inner;
22090 if (ret_var.is_owned) {
22096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22097 LDKBuiltCommitmentTransaction obj_conv;
22098 obj_conv.inner = (void*)(obj & (~1));
22099 obj_conv.is_owned = false;
22100 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22101 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22102 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22103 CVec_u8Z_free(ret_var);
22107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22108 LDKu8slice ser_ref;
22109 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22110 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22111 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22112 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22113 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22114 return (uint64_t)ret_conv;
22117 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) {
22118 LDKBuiltCommitmentTransaction this_arg_conv;
22119 this_arg_conv.inner = (void*)(this_arg & (~1));
22120 this_arg_conv.is_owned = false;
22121 LDKu8slice funding_redeemscript_ref;
22122 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22123 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22124 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22125 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22126 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22130 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) {
22131 LDKBuiltCommitmentTransaction this_arg_conv;
22132 this_arg_conv.inner = (void*)(this_arg & (~1));
22133 this_arg_conv.is_owned = false;
22134 unsigned char funding_key_arr[32];
22135 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22136 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22137 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22138 LDKu8slice funding_redeemscript_ref;
22139 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22140 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22141 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22142 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22143 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22148 LDKCommitmentTransaction this_obj_conv;
22149 this_obj_conv.inner = (void*)(this_obj & (~1));
22150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22151 CommitmentTransaction_free(this_obj_conv);
22154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22155 LDKCommitmentTransaction orig_conv;
22156 orig_conv.inner = (void*)(orig & (~1));
22157 orig_conv.is_owned = false;
22158 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22161 uint64_t ret_ref = (uint64_t)ret_var.inner;
22162 if (ret_var.is_owned) {
22168 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22169 LDKCommitmentTransaction obj_conv;
22170 obj_conv.inner = (void*)(obj & (~1));
22171 obj_conv.is_owned = false;
22172 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22173 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22174 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22175 CVec_u8Z_free(ret_var);
22179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22180 LDKu8slice ser_ref;
22181 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22182 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22183 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22184 *ret_conv = CommitmentTransaction_read(ser_ref);
22185 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22186 return (uint64_t)ret_conv;
22189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22190 LDKCommitmentTransaction this_arg_conv;
22191 this_arg_conv.inner = (void*)(this_arg & (~1));
22192 this_arg_conv.is_owned = false;
22193 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
22197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22198 LDKCommitmentTransaction this_arg_conv;
22199 this_arg_conv.inner = (void*)(this_arg & (~1));
22200 this_arg_conv.is_owned = false;
22201 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
22205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
22206 LDKCommitmentTransaction this_arg_conv;
22207 this_arg_conv.inner = (void*)(this_arg & (~1));
22208 this_arg_conv.is_owned = false;
22209 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
22213 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
22214 LDKCommitmentTransaction this_arg_conv;
22215 this_arg_conv.inner = (void*)(this_arg & (~1));
22216 this_arg_conv.is_owned = false;
22217 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
22221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
22222 LDKCommitmentTransaction this_arg_conv;
22223 this_arg_conv.inner = (void*)(this_arg & (~1));
22224 this_arg_conv.is_owned = false;
22225 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
22226 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22227 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22228 uint64_t ret_ref = (uint64_t)ret_var.inner;
22229 if (ret_var.is_owned) {
22235 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) {
22236 LDKCommitmentTransaction this_arg_conv;
22237 this_arg_conv.inner = (void*)(this_arg & (~1));
22238 this_arg_conv.is_owned = false;
22239 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22240 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22241 channel_parameters_conv.is_owned = false;
22242 LDKChannelPublicKeys broadcaster_keys_conv;
22243 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22244 broadcaster_keys_conv.is_owned = false;
22245 LDKChannelPublicKeys countersignatory_keys_conv;
22246 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22247 countersignatory_keys_conv.is_owned = false;
22248 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
22249 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
22250 return (uint64_t)ret_conv;
22253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22254 LDKTrustedCommitmentTransaction this_obj_conv;
22255 this_obj_conv.inner = (void*)(this_obj & (~1));
22256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22257 TrustedCommitmentTransaction_free(this_obj_conv);
22260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
22261 LDKTrustedCommitmentTransaction this_arg_conv;
22262 this_arg_conv.inner = (void*)(this_arg & (~1));
22263 this_arg_conv.is_owned = false;
22264 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22265 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
22269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
22270 LDKTrustedCommitmentTransaction this_arg_conv;
22271 this_arg_conv.inner = (void*)(this_arg & (~1));
22272 this_arg_conv.is_owned = false;
22273 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
22274 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22275 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22276 uint64_t ret_ref = (uint64_t)ret_var.inner;
22277 if (ret_var.is_owned) {
22283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
22284 LDKTrustedCommitmentTransaction this_arg_conv;
22285 this_arg_conv.inner = (void*)(this_arg & (~1));
22286 this_arg_conv.is_owned = false;
22287 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
22288 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22289 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22290 uint64_t ret_ref = (uint64_t)ret_var.inner;
22291 if (ret_var.is_owned) {
22297 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) {
22298 LDKTrustedCommitmentTransaction this_arg_conv;
22299 this_arg_conv.inner = (void*)(this_arg & (~1));
22300 this_arg_conv.is_owned = false;
22301 unsigned char htlc_base_key_arr[32];
22302 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
22303 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
22304 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
22305 LDKDirectedChannelTransactionParameters channel_parameters_conv;
22306 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
22307 channel_parameters_conv.is_owned = false;
22308 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
22309 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
22310 return (uint64_t)ret_conv;
22313 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) {
22314 LDKPublicKey broadcaster_payment_basepoint_ref;
22315 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
22316 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
22317 LDKPublicKey countersignatory_payment_basepoint_ref;
22318 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
22319 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
22320 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
22324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22325 LDKInitFeatures a_conv;
22326 a_conv.inner = (void*)(a & (~1));
22327 a_conv.is_owned = false;
22328 LDKInitFeatures b_conv;
22329 b_conv.inner = (void*)(b & (~1));
22330 b_conv.is_owned = false;
22331 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
22335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22336 LDKNodeFeatures a_conv;
22337 a_conv.inner = (void*)(a & (~1));
22338 a_conv.is_owned = false;
22339 LDKNodeFeatures b_conv;
22340 b_conv.inner = (void*)(b & (~1));
22341 b_conv.is_owned = false;
22342 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
22346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22347 LDKChannelFeatures a_conv;
22348 a_conv.inner = (void*)(a & (~1));
22349 a_conv.is_owned = false;
22350 LDKChannelFeatures b_conv;
22351 b_conv.inner = (void*)(b & (~1));
22352 b_conv.is_owned = false;
22353 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
22357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22358 LDKInvoiceFeatures a_conv;
22359 a_conv.inner = (void*)(a & (~1));
22360 a_conv.is_owned = false;
22361 LDKInvoiceFeatures b_conv;
22362 b_conv.inner = (void*)(b & (~1));
22363 b_conv.is_owned = false;
22364 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
22368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22369 LDKInitFeatures orig_conv;
22370 orig_conv.inner = (void*)(orig & (~1));
22371 orig_conv.is_owned = false;
22372 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
22373 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22374 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22375 uint64_t ret_ref = (uint64_t)ret_var.inner;
22376 if (ret_var.is_owned) {
22382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22383 LDKNodeFeatures orig_conv;
22384 orig_conv.inner = (void*)(orig & (~1));
22385 orig_conv.is_owned = false;
22386 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
22387 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22388 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22389 uint64_t ret_ref = (uint64_t)ret_var.inner;
22390 if (ret_var.is_owned) {
22396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22397 LDKChannelFeatures orig_conv;
22398 orig_conv.inner = (void*)(orig & (~1));
22399 orig_conv.is_owned = false;
22400 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
22401 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22402 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22403 uint64_t ret_ref = (uint64_t)ret_var.inner;
22404 if (ret_var.is_owned) {
22410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22411 LDKInvoiceFeatures orig_conv;
22412 orig_conv.inner = (void*)(orig & (~1));
22413 orig_conv.is_owned = false;
22414 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
22415 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22416 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22417 uint64_t ret_ref = (uint64_t)ret_var.inner;
22418 if (ret_var.is_owned) {
22424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22425 LDKInitFeatures this_obj_conv;
22426 this_obj_conv.inner = (void*)(this_obj & (~1));
22427 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22428 InitFeatures_free(this_obj_conv);
22431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22432 LDKNodeFeatures this_obj_conv;
22433 this_obj_conv.inner = (void*)(this_obj & (~1));
22434 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22435 NodeFeatures_free(this_obj_conv);
22438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22439 LDKChannelFeatures this_obj_conv;
22440 this_obj_conv.inner = (void*)(this_obj & (~1));
22441 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22442 ChannelFeatures_free(this_obj_conv);
22445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22446 LDKInvoiceFeatures this_obj_conv;
22447 this_obj_conv.inner = (void*)(this_obj & (~1));
22448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22449 InvoiceFeatures_free(this_obj_conv);
22452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
22453 LDKInitFeatures ret_var = InitFeatures_empty();
22454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22456 uint64_t ret_ref = (uint64_t)ret_var.inner;
22457 if (ret_var.is_owned) {
22463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
22464 LDKInitFeatures ret_var = InitFeatures_known();
22465 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22466 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22467 uint64_t ret_ref = (uint64_t)ret_var.inner;
22468 if (ret_var.is_owned) {
22474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
22475 LDKNodeFeatures ret_var = NodeFeatures_empty();
22476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22478 uint64_t ret_ref = (uint64_t)ret_var.inner;
22479 if (ret_var.is_owned) {
22485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
22486 LDKNodeFeatures ret_var = NodeFeatures_known();
22487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22489 uint64_t ret_ref = (uint64_t)ret_var.inner;
22490 if (ret_var.is_owned) {
22496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
22497 LDKChannelFeatures ret_var = ChannelFeatures_empty();
22498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22500 uint64_t ret_ref = (uint64_t)ret_var.inner;
22501 if (ret_var.is_owned) {
22507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
22508 LDKChannelFeatures ret_var = ChannelFeatures_known();
22509 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22510 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22511 uint64_t ret_ref = (uint64_t)ret_var.inner;
22512 if (ret_var.is_owned) {
22518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
22519 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
22520 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22521 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22522 uint64_t ret_ref = (uint64_t)ret_var.inner;
22523 if (ret_var.is_owned) {
22529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
22530 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
22531 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22532 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22533 uint64_t ret_ref = (uint64_t)ret_var.inner;
22534 if (ret_var.is_owned) {
22540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22541 LDKInitFeatures this_arg_conv;
22542 this_arg_conv.inner = (void*)(this_arg & (~1));
22543 this_arg_conv.is_owned = false;
22544 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
22548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22549 LDKNodeFeatures this_arg_conv;
22550 this_arg_conv.inner = (void*)(this_arg & (~1));
22551 this_arg_conv.is_owned = false;
22552 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
22556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
22557 LDKInvoiceFeatures this_arg_conv;
22558 this_arg_conv.inner = (void*)(this_arg & (~1));
22559 this_arg_conv.is_owned = false;
22560 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
22564 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22565 LDKInitFeatures obj_conv;
22566 obj_conv.inner = (void*)(obj & (~1));
22567 obj_conv.is_owned = false;
22568 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
22569 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22570 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22571 CVec_u8Z_free(ret_var);
22575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22576 LDKNodeFeatures obj_conv;
22577 obj_conv.inner = (void*)(obj & (~1));
22578 obj_conv.is_owned = false;
22579 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
22580 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22581 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22582 CVec_u8Z_free(ret_var);
22586 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22587 LDKChannelFeatures obj_conv;
22588 obj_conv.inner = (void*)(obj & (~1));
22589 obj_conv.is_owned = false;
22590 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
22591 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22592 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22593 CVec_u8Z_free(ret_var);
22597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
22598 LDKInvoiceFeatures obj_conv;
22599 obj_conv.inner = (void*)(obj & (~1));
22600 obj_conv.is_owned = false;
22601 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
22602 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22603 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22604 CVec_u8Z_free(ret_var);
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22609 LDKu8slice ser_ref;
22610 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22611 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22612 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
22613 *ret_conv = InitFeatures_read(ser_ref);
22614 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22615 return (uint64_t)ret_conv;
22618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22619 LDKu8slice ser_ref;
22620 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22621 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22622 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
22623 *ret_conv = NodeFeatures_read(ser_ref);
22624 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22625 return (uint64_t)ret_conv;
22628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22629 LDKu8slice ser_ref;
22630 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22631 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22632 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
22633 *ret_conv = ChannelFeatures_read(ser_ref);
22634 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22635 return (uint64_t)ret_conv;
22638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22639 LDKu8slice ser_ref;
22640 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22641 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22642 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
22643 *ret_conv = InvoiceFeatures_read(ser_ref);
22644 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22645 return (uint64_t)ret_conv;
22648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22649 LDKRouteHop this_obj_conv;
22650 this_obj_conv.inner = (void*)(this_obj & (~1));
22651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22652 RouteHop_free(this_obj_conv);
22655 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
22656 LDKRouteHop this_ptr_conv;
22657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22658 this_ptr_conv.is_owned = false;
22659 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
22664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22665 LDKRouteHop this_ptr_conv;
22666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22667 this_ptr_conv.is_owned = false;
22668 LDKPublicKey val_ref;
22669 CHECK((*env)->GetArrayLength(env, val) == 33);
22670 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22671 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
22674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22675 LDKRouteHop this_ptr_conv;
22676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22677 this_ptr_conv.is_owned = false;
22678 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
22679 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22680 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22681 uint64_t ret_ref = (uint64_t)ret_var.inner;
22682 if (ret_var.is_owned) {
22688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22689 LDKRouteHop this_ptr_conv;
22690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22691 this_ptr_conv.is_owned = false;
22692 LDKNodeFeatures val_conv;
22693 val_conv.inner = (void*)(val & (~1));
22694 val_conv.is_owned = (val & 1) || (val == 0);
22695 val_conv = NodeFeatures_clone(&val_conv);
22696 RouteHop_set_node_features(&this_ptr_conv, val_conv);
22699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22700 LDKRouteHop this_ptr_conv;
22701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22702 this_ptr_conv.is_owned = false;
22703 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
22707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22708 LDKRouteHop this_ptr_conv;
22709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22710 this_ptr_conv.is_owned = false;
22711 RouteHop_set_short_channel_id(&this_ptr_conv, val);
22714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
22715 LDKRouteHop this_ptr_conv;
22716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22717 this_ptr_conv.is_owned = false;
22718 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
22719 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22720 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22721 uint64_t ret_ref = (uint64_t)ret_var.inner;
22722 if (ret_var.is_owned) {
22728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22729 LDKRouteHop this_ptr_conv;
22730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22731 this_ptr_conv.is_owned = false;
22732 LDKChannelFeatures val_conv;
22733 val_conv.inner = (void*)(val & (~1));
22734 val_conv.is_owned = (val & 1) || (val == 0);
22735 val_conv = ChannelFeatures_clone(&val_conv);
22736 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
22739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22740 LDKRouteHop this_ptr_conv;
22741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22742 this_ptr_conv.is_owned = false;
22743 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
22747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22748 LDKRouteHop this_ptr_conv;
22749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22750 this_ptr_conv.is_owned = false;
22751 RouteHop_set_fee_msat(&this_ptr_conv, val);
22754 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
22755 LDKRouteHop this_ptr_conv;
22756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22757 this_ptr_conv.is_owned = false;
22758 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
22762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22763 LDKRouteHop this_ptr_conv;
22764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22765 this_ptr_conv.is_owned = false;
22766 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
22769 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) {
22770 LDKPublicKey pubkey_arg_ref;
22771 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
22772 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
22773 LDKNodeFeatures node_features_arg_conv;
22774 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
22775 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
22776 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
22777 LDKChannelFeatures channel_features_arg_conv;
22778 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
22779 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
22780 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
22781 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);
22782 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22783 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22784 uint64_t ret_ref = (uint64_t)ret_var.inner;
22785 if (ret_var.is_owned) {
22791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22792 LDKRouteHop orig_conv;
22793 orig_conv.inner = (void*)(orig & (~1));
22794 orig_conv.is_owned = false;
22795 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
22796 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22797 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22798 uint64_t ret_ref = (uint64_t)ret_var.inner;
22799 if (ret_var.is_owned) {
22805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
22806 LDKRouteHop obj_conv;
22807 obj_conv.inner = (void*)(obj & (~1));
22808 obj_conv.is_owned = false;
22809 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
22810 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22811 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22812 CVec_u8Z_free(ret_var);
22816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22817 LDKu8slice ser_ref;
22818 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22819 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22820 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
22821 *ret_conv = RouteHop_read(ser_ref);
22822 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22823 return (uint64_t)ret_conv;
22826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22827 LDKRoute this_obj_conv;
22828 this_obj_conv.inner = (void*)(this_obj & (~1));
22829 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22830 Route_free(this_obj_conv);
22833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22834 LDKRoute this_ptr_conv;
22835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22836 this_ptr_conv.is_owned = false;
22837 LDKCVec_CVec_RouteHopZZ val_constr;
22838 val_constr.datalen = (*env)->GetArrayLength(env, val);
22839 if (val_constr.datalen > 0)
22840 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22842 val_constr.data = NULL;
22843 for (size_t m = 0; m < val_constr.datalen; m++) {
22844 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
22845 LDKCVec_RouteHopZ val_conv_12_constr;
22846 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
22847 if (val_conv_12_constr.datalen > 0)
22848 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22850 val_conv_12_constr.data = NULL;
22851 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
22852 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
22853 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
22854 LDKRouteHop val_conv_12_conv_10_conv;
22855 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
22856 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
22857 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
22858 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
22860 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
22861 val_constr.data[m] = val_conv_12_constr;
22863 Route_set_paths(&this_ptr_conv, val_constr);
22866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
22867 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
22868 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
22869 if (paths_arg_constr.datalen > 0)
22870 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
22872 paths_arg_constr.data = NULL;
22873 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
22874 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
22875 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
22876 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
22877 if (paths_arg_conv_12_constr.datalen > 0)
22878 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22880 paths_arg_conv_12_constr.data = NULL;
22881 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
22882 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
22883 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
22884 LDKRouteHop paths_arg_conv_12_conv_10_conv;
22885 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
22886 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
22887 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
22888 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
22890 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
22891 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
22893 LDKRoute ret_var = Route_new(paths_arg_constr);
22894 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22895 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22896 uint64_t ret_ref = (uint64_t)ret_var.inner;
22897 if (ret_var.is_owned) {
22903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22904 LDKRoute orig_conv;
22905 orig_conv.inner = (void*)(orig & (~1));
22906 orig_conv.is_owned = false;
22907 LDKRoute ret_var = Route_clone(&orig_conv);
22908 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22909 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22910 uint64_t ret_ref = (uint64_t)ret_var.inner;
22911 if (ret_var.is_owned) {
22917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
22919 obj_conv.inner = (void*)(obj & (~1));
22920 obj_conv.is_owned = false;
22921 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
22922 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22923 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22924 CVec_u8Z_free(ret_var);
22928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22929 LDKu8slice ser_ref;
22930 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22931 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22932 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
22933 *ret_conv = Route_read(ser_ref);
22934 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22935 return (uint64_t)ret_conv;
22938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22939 LDKRouteHint this_obj_conv;
22940 this_obj_conv.inner = (void*)(this_obj & (~1));
22941 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22942 RouteHint_free(this_obj_conv);
22945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
22946 LDKRouteHint a_conv;
22947 a_conv.inner = (void*)(a & (~1));
22948 a_conv.is_owned = false;
22949 LDKRouteHint b_conv;
22950 b_conv.inner = (void*)(b & (~1));
22951 b_conv.is_owned = false;
22952 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
22956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22957 LDKRouteHint orig_conv;
22958 orig_conv.inner = (void*)(orig & (~1));
22959 orig_conv.is_owned = false;
22960 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
22961 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22962 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22963 uint64_t ret_ref = (uint64_t)ret_var.inner;
22964 if (ret_var.is_owned) {
22970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22971 LDKRouteHintHop this_obj_conv;
22972 this_obj_conv.inner = (void*)(this_obj & (~1));
22973 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22974 RouteHintHop_free(this_obj_conv);
22977 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22978 LDKRouteHintHop this_ptr_conv;
22979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22980 this_ptr_conv.is_owned = false;
22981 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22982 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
22986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22987 LDKRouteHintHop this_ptr_conv;
22988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22989 this_ptr_conv.is_owned = false;
22990 LDKPublicKey val_ref;
22991 CHECK((*env)->GetArrayLength(env, val) == 33);
22992 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22993 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
22996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
22997 LDKRouteHintHop this_ptr_conv;
22998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22999 this_ptr_conv.is_owned = false;
23000 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23005 LDKRouteHintHop this_ptr_conv;
23006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23007 this_ptr_conv.is_owned = false;
23008 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23012 LDKRouteHintHop this_ptr_conv;
23013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23014 this_ptr_conv.is_owned = false;
23015 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23016 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23017 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23018 uint64_t ret_ref = (uint64_t)ret_var.inner;
23019 if (ret_var.is_owned) {
23025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23026 LDKRouteHintHop this_ptr_conv;
23027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23028 this_ptr_conv.is_owned = false;
23029 LDKRoutingFees val_conv;
23030 val_conv.inner = (void*)(val & (~1));
23031 val_conv.is_owned = (val & 1) || (val == 0);
23032 val_conv = RoutingFees_clone(&val_conv);
23033 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23036 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23037 LDKRouteHintHop this_ptr_conv;
23038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23039 this_ptr_conv.is_owned = false;
23040 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23045 LDKRouteHintHop this_ptr_conv;
23046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23047 this_ptr_conv.is_owned = false;
23048 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23052 LDKRouteHintHop this_ptr_conv;
23053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23054 this_ptr_conv.is_owned = false;
23055 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23056 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23057 uint64_t ret_ref = (uint64_t)ret_copy;
23061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23062 LDKRouteHintHop this_ptr_conv;
23063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23064 this_ptr_conv.is_owned = false;
23065 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23066 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23070 LDKRouteHintHop this_ptr_conv;
23071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23072 this_ptr_conv.is_owned = false;
23073 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23074 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23075 uint64_t ret_ref = (uint64_t)ret_copy;
23079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23080 LDKRouteHintHop this_ptr_conv;
23081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23082 this_ptr_conv.is_owned = false;
23083 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23084 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23087 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) {
23088 LDKPublicKey src_node_id_arg_ref;
23089 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23090 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23091 LDKRoutingFees fees_arg_conv;
23092 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23093 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23094 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23095 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23096 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23097 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);
23098 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23099 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23100 uint64_t ret_ref = (uint64_t)ret_var.inner;
23101 if (ret_var.is_owned) {
23107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23108 LDKRouteHintHop a_conv;
23109 a_conv.inner = (void*)(a & (~1));
23110 a_conv.is_owned = false;
23111 LDKRouteHintHop b_conv;
23112 b_conv.inner = (void*)(b & (~1));
23113 b_conv.is_owned = false;
23114 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23119 LDKRouteHintHop orig_conv;
23120 orig_conv.inner = (void*)(orig & (~1));
23121 orig_conv.is_owned = false;
23122 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23123 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23124 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23125 uint64_t ret_ref = (uint64_t)ret_var.inner;
23126 if (ret_var.is_owned) {
23132 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) {
23133 LDKPublicKey our_node_id_ref;
23134 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23135 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23136 LDKNetworkGraph network_conv;
23137 network_conv.inner = (void*)(network & (~1));
23138 network_conv.is_owned = false;
23139 LDKPublicKey payee_ref;
23140 CHECK((*env)->GetArrayLength(env, payee) == 33);
23141 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23142 LDKInvoiceFeatures payee_features_conv;
23143 payee_features_conv.inner = (void*)(payee_features & (~1));
23144 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
23145 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
23146 LDKCVec_ChannelDetailsZ first_hops_constr;
23147 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23148 if (first_hops_constr.datalen > 0)
23149 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23151 first_hops_constr.data = NULL;
23152 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23153 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23154 int64_t first_hops_conv_16 = first_hops_vals[q];
23155 LDKChannelDetails first_hops_conv_16_conv;
23156 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23157 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23158 first_hops_constr.data[q] = first_hops_conv_16_conv;
23160 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23161 LDKCVec_RouteHintZ last_hops_constr;
23162 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23163 if (last_hops_constr.datalen > 0)
23164 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23166 last_hops_constr.data = NULL;
23167 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23168 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23169 int64_t last_hops_conv_11 = last_hops_vals[l];
23170 LDKRouteHint last_hops_conv_11_conv;
23171 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23172 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23173 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23174 last_hops_constr.data[l] = last_hops_conv_11_conv;
23176 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23177 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23178 if (logger_conv.free == LDKLogger_JCalls_free) {
23179 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23180 LDKLogger_JCalls_clone(logger_conv.this_arg);
23182 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23183 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23184 FREE(first_hops_constr.data);
23185 return (uint64_t)ret_conv;
23188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23189 LDKNetworkGraph this_obj_conv;
23190 this_obj_conv.inner = (void*)(this_obj & (~1));
23191 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23192 NetworkGraph_free(this_obj_conv);
23195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23196 LDKNetworkGraph orig_conv;
23197 orig_conv.inner = (void*)(orig & (~1));
23198 orig_conv.is_owned = false;
23199 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
23200 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23201 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23202 uint64_t ret_ref = (uint64_t)ret_var.inner;
23203 if (ret_var.is_owned) {
23209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23210 LDKLockedNetworkGraph this_obj_conv;
23211 this_obj_conv.inner = (void*)(this_obj & (~1));
23212 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23213 LockedNetworkGraph_free(this_obj_conv);
23216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23217 LDKNetGraphMsgHandler this_obj_conv;
23218 this_obj_conv.inner = (void*)(this_obj & (~1));
23219 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23220 NetGraphMsgHandler_free(this_obj_conv);
23223 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) {
23224 LDKThirtyTwoBytes genesis_hash_ref;
23225 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
23226 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
23227 LDKAccess *chain_access_conv_ptr = NULL;
23228 if (chain_access != 0) {
23229 LDKAccess chain_access_conv;
23230 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23231 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23232 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23233 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23235 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23236 *chain_access_conv_ptr = chain_access_conv;
23238 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23239 if (logger_conv.free == LDKLogger_JCalls_free) {
23240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23241 LDKLogger_JCalls_clone(logger_conv.this_arg);
23243 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
23244 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23245 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23246 uint64_t ret_ref = (uint64_t)ret_var.inner;
23247 if (ret_var.is_owned) {
23253 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) {
23254 LDKAccess *chain_access_conv_ptr = NULL;
23255 if (chain_access != 0) {
23256 LDKAccess chain_access_conv;
23257 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23258 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23259 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23260 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23262 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23263 *chain_access_conv_ptr = chain_access_conv;
23265 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23266 if (logger_conv.free == LDKLogger_JCalls_free) {
23267 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23268 LDKLogger_JCalls_clone(logger_conv.this_arg);
23270 LDKNetworkGraph network_graph_conv;
23271 network_graph_conv.inner = (void*)(network_graph & (~1));
23272 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
23273 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
23274 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
23275 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23276 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23277 uint64_t ret_ref = (uint64_t)ret_var.inner;
23278 if (ret_var.is_owned) {
23284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
23285 LDKNetGraphMsgHandler this_arg_conv;
23286 this_arg_conv.inner = (void*)(this_arg & (~1));
23287 this_arg_conv.is_owned = false;
23288 LDKAccess *chain_access_conv_ptr = NULL;
23289 if (chain_access != 0) {
23290 LDKAccess chain_access_conv;
23291 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
23292 if (chain_access_conv.free == LDKAccess_JCalls_free) {
23293 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23294 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
23296 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
23297 *chain_access_conv_ptr = chain_access_conv;
23299 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
23302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23303 LDKNetGraphMsgHandler this_arg_conv;
23304 this_arg_conv.inner = (void*)(this_arg & (~1));
23305 this_arg_conv.is_owned = false;
23306 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
23307 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23308 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23309 uint64_t ret_ref = (uint64_t)ret_var.inner;
23310 if (ret_var.is_owned) {
23316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
23317 LDKLockedNetworkGraph this_arg_conv;
23318 this_arg_conv.inner = (void*)(this_arg & (~1));
23319 this_arg_conv.is_owned = false;
23320 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
23321 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23322 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23323 uint64_t ret_ref = (uint64_t)ret_var.inner;
23324 if (ret_var.is_owned) {
23330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
23331 LDKNetGraphMsgHandler this_arg_conv;
23332 this_arg_conv.inner = (void*)(this_arg & (~1));
23333 this_arg_conv.is_owned = false;
23334 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
23335 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
23336 return (uint64_t)ret;
23339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
23340 LDKNetGraphMsgHandler this_arg_conv;
23341 this_arg_conv.inner = (void*)(this_arg & (~1));
23342 this_arg_conv.is_owned = false;
23343 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
23344 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
23345 return (uint64_t)ret;
23348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23349 LDKDirectionalChannelInfo this_obj_conv;
23350 this_obj_conv.inner = (void*)(this_obj & (~1));
23351 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23352 DirectionalChannelInfo_free(this_obj_conv);
23355 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23356 LDKDirectionalChannelInfo this_ptr_conv;
23357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23358 this_ptr_conv.is_owned = false;
23359 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
23363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23364 LDKDirectionalChannelInfo this_ptr_conv;
23365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23366 this_ptr_conv.is_owned = false;
23367 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
23370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
23371 LDKDirectionalChannelInfo this_ptr_conv;
23372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23373 this_ptr_conv.is_owned = false;
23374 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
23378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
23379 LDKDirectionalChannelInfo this_ptr_conv;
23380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23381 this_ptr_conv.is_owned = false;
23382 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
23385 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23386 LDKDirectionalChannelInfo this_ptr_conv;
23387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23388 this_ptr_conv.is_owned = false;
23389 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
23393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23394 LDKDirectionalChannelInfo this_ptr_conv;
23395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23396 this_ptr_conv.is_owned = false;
23397 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
23400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23401 LDKDirectionalChannelInfo this_ptr_conv;
23402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23403 this_ptr_conv.is_owned = false;
23404 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
23408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23409 LDKDirectionalChannelInfo this_ptr_conv;
23410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23411 this_ptr_conv.is_owned = false;
23412 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
23415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23416 LDKDirectionalChannelInfo this_ptr_conv;
23417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23418 this_ptr_conv.is_owned = false;
23419 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23420 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
23421 uint64_t ret_ref = (uint64_t)ret_copy;
23425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23426 LDKDirectionalChannelInfo this_ptr_conv;
23427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23428 this_ptr_conv.is_owned = false;
23429 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23430 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23434 LDKDirectionalChannelInfo this_ptr_conv;
23435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23436 this_ptr_conv.is_owned = false;
23437 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
23438 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23439 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23440 uint64_t ret_ref = (uint64_t)ret_var.inner;
23441 if (ret_var.is_owned) {
23447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23448 LDKDirectionalChannelInfo this_ptr_conv;
23449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23450 this_ptr_conv.is_owned = false;
23451 LDKRoutingFees val_conv;
23452 val_conv.inner = (void*)(val & (~1));
23453 val_conv.is_owned = (val & 1) || (val == 0);
23454 val_conv = RoutingFees_clone(&val_conv);
23455 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
23458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23459 LDKDirectionalChannelInfo this_ptr_conv;
23460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23461 this_ptr_conv.is_owned = false;
23462 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
23463 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23464 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23465 uint64_t ret_ref = (uint64_t)ret_var.inner;
23466 if (ret_var.is_owned) {
23472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23473 LDKDirectionalChannelInfo this_ptr_conv;
23474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23475 this_ptr_conv.is_owned = false;
23476 LDKChannelUpdate val_conv;
23477 val_conv.inner = (void*)(val & (~1));
23478 val_conv.is_owned = (val & 1) || (val == 0);
23479 val_conv = ChannelUpdate_clone(&val_conv);
23480 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
23483 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) {
23484 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23485 LDKRoutingFees fees_arg_conv;
23486 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23487 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23488 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23489 LDKChannelUpdate last_update_message_arg_conv;
23490 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
23491 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
23492 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
23493 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);
23494 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23495 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23496 uint64_t ret_ref = (uint64_t)ret_var.inner;
23497 if (ret_var.is_owned) {
23503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23504 LDKDirectionalChannelInfo orig_conv;
23505 orig_conv.inner = (void*)(orig & (~1));
23506 orig_conv.is_owned = false;
23507 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
23508 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23509 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23510 uint64_t ret_ref = (uint64_t)ret_var.inner;
23511 if (ret_var.is_owned) {
23517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23518 LDKDirectionalChannelInfo obj_conv;
23519 obj_conv.inner = (void*)(obj & (~1));
23520 obj_conv.is_owned = false;
23521 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
23522 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23523 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23524 CVec_u8Z_free(ret_var);
23528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23529 LDKu8slice ser_ref;
23530 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23531 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23532 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
23533 *ret_conv = DirectionalChannelInfo_read(ser_ref);
23534 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23535 return (uint64_t)ret_conv;
23538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23539 LDKChannelInfo this_obj_conv;
23540 this_obj_conv.inner = (void*)(this_obj & (~1));
23541 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23542 ChannelInfo_free(this_obj_conv);
23545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23546 LDKChannelInfo this_ptr_conv;
23547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23548 this_ptr_conv.is_owned = false;
23549 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
23550 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23551 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23552 uint64_t ret_ref = (uint64_t)ret_var.inner;
23553 if (ret_var.is_owned) {
23559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23560 LDKChannelInfo this_ptr_conv;
23561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23562 this_ptr_conv.is_owned = false;
23563 LDKChannelFeatures val_conv;
23564 val_conv.inner = (void*)(val & (~1));
23565 val_conv.is_owned = (val & 1) || (val == 0);
23566 val_conv = ChannelFeatures_clone(&val_conv);
23567 ChannelInfo_set_features(&this_ptr_conv, val_conv);
23570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23571 LDKChannelInfo this_ptr_conv;
23572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23573 this_ptr_conv.is_owned = false;
23574 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23575 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
23579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23580 LDKChannelInfo this_ptr_conv;
23581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23582 this_ptr_conv.is_owned = false;
23583 LDKPublicKey val_ref;
23584 CHECK((*env)->GetArrayLength(env, val) == 33);
23585 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23586 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
23589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23590 LDKChannelInfo this_ptr_conv;
23591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23592 this_ptr_conv.is_owned = false;
23593 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
23594 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23595 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23596 uint64_t ret_ref = (uint64_t)ret_var.inner;
23597 if (ret_var.is_owned) {
23603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23604 LDKChannelInfo this_ptr_conv;
23605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23606 this_ptr_conv.is_owned = false;
23607 LDKDirectionalChannelInfo val_conv;
23608 val_conv.inner = (void*)(val & (~1));
23609 val_conv.is_owned = (val & 1) || (val == 0);
23610 val_conv = DirectionalChannelInfo_clone(&val_conv);
23611 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
23614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
23615 LDKChannelInfo this_ptr_conv;
23616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23617 this_ptr_conv.is_owned = false;
23618 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23619 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
23623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23624 LDKChannelInfo this_ptr_conv;
23625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23626 this_ptr_conv.is_owned = false;
23627 LDKPublicKey val_ref;
23628 CHECK((*env)->GetArrayLength(env, val) == 33);
23629 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23630 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
23633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
23634 LDKChannelInfo this_ptr_conv;
23635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23636 this_ptr_conv.is_owned = false;
23637 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
23638 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23639 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23640 uint64_t ret_ref = (uint64_t)ret_var.inner;
23641 if (ret_var.is_owned) {
23647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23648 LDKChannelInfo this_ptr_conv;
23649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23650 this_ptr_conv.is_owned = false;
23651 LDKDirectionalChannelInfo val_conv;
23652 val_conv.inner = (void*)(val & (~1));
23653 val_conv.is_owned = (val & 1) || (val == 0);
23654 val_conv = DirectionalChannelInfo_clone(&val_conv);
23655 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
23658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
23659 LDKChannelInfo this_ptr_conv;
23660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23661 this_ptr_conv.is_owned = false;
23662 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23663 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
23664 uint64_t ret_ref = (uint64_t)ret_copy;
23668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23669 LDKChannelInfo this_ptr_conv;
23670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23671 this_ptr_conv.is_owned = false;
23672 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23673 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
23676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23677 LDKChannelInfo this_ptr_conv;
23678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23679 this_ptr_conv.is_owned = false;
23680 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
23681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23683 uint64_t ret_ref = (uint64_t)ret_var.inner;
23684 if (ret_var.is_owned) {
23690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23691 LDKChannelInfo this_ptr_conv;
23692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23693 this_ptr_conv.is_owned = false;
23694 LDKChannelAnnouncement val_conv;
23695 val_conv.inner = (void*)(val & (~1));
23696 val_conv.is_owned = (val & 1) || (val == 0);
23697 val_conv = ChannelAnnouncement_clone(&val_conv);
23698 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
23701 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) {
23702 LDKChannelFeatures features_arg_conv;
23703 features_arg_conv.inner = (void*)(features_arg & (~1));
23704 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23705 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
23706 LDKPublicKey node_one_arg_ref;
23707 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
23708 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
23709 LDKDirectionalChannelInfo one_to_two_arg_conv;
23710 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
23711 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
23712 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
23713 LDKPublicKey node_two_arg_ref;
23714 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
23715 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
23716 LDKDirectionalChannelInfo two_to_one_arg_conv;
23717 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
23718 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
23719 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
23720 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
23721 LDKChannelAnnouncement announcement_message_arg_conv;
23722 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
23723 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
23724 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
23725 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);
23726 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23727 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23728 uint64_t ret_ref = (uint64_t)ret_var.inner;
23729 if (ret_var.is_owned) {
23735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23736 LDKChannelInfo orig_conv;
23737 orig_conv.inner = (void*)(orig & (~1));
23738 orig_conv.is_owned = false;
23739 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
23740 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23741 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23742 uint64_t ret_ref = (uint64_t)ret_var.inner;
23743 if (ret_var.is_owned) {
23749 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
23750 LDKChannelInfo obj_conv;
23751 obj_conv.inner = (void*)(obj & (~1));
23752 obj_conv.is_owned = false;
23753 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
23754 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23755 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23756 CVec_u8Z_free(ret_var);
23760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23761 LDKu8slice ser_ref;
23762 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23763 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23764 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
23765 *ret_conv = ChannelInfo_read(ser_ref);
23766 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23767 return (uint64_t)ret_conv;
23770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23771 LDKRoutingFees this_obj_conv;
23772 this_obj_conv.inner = (void*)(this_obj & (~1));
23773 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23774 RoutingFees_free(this_obj_conv);
23777 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23778 LDKRoutingFees this_ptr_conv;
23779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23780 this_ptr_conv.is_owned = false;
23781 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
23785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23786 LDKRoutingFees this_ptr_conv;
23787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23788 this_ptr_conv.is_owned = false;
23789 RoutingFees_set_base_msat(&this_ptr_conv, val);
23792 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
23793 LDKRoutingFees this_ptr_conv;
23794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23795 this_ptr_conv.is_owned = false;
23796 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
23800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23801 LDKRoutingFees this_ptr_conv;
23802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23803 this_ptr_conv.is_owned = false;
23804 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
23807 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) {
23808 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
23809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23811 uint64_t ret_ref = (uint64_t)ret_var.inner;
23812 if (ret_var.is_owned) {
23818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23819 LDKRoutingFees a_conv;
23820 a_conv.inner = (void*)(a & (~1));
23821 a_conv.is_owned = false;
23822 LDKRoutingFees b_conv;
23823 b_conv.inner = (void*)(b & (~1));
23824 b_conv.is_owned = false;
23825 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
23829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23830 LDKRoutingFees orig_conv;
23831 orig_conv.inner = (void*)(orig & (~1));
23832 orig_conv.is_owned = false;
23833 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
23834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23836 uint64_t ret_ref = (uint64_t)ret_var.inner;
23837 if (ret_var.is_owned) {
23843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
23844 LDKRoutingFees obj_conv;
23845 obj_conv.inner = (void*)(obj & (~1));
23846 obj_conv.is_owned = false;
23847 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
23848 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23849 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23850 CVec_u8Z_free(ret_var);
23854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23855 LDKu8slice ser_ref;
23856 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23857 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23858 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
23859 *ret_conv = RoutingFees_read(ser_ref);
23860 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23861 return (uint64_t)ret_conv;
23864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23865 LDKNodeAnnouncementInfo this_obj_conv;
23866 this_obj_conv.inner = (void*)(this_obj & (~1));
23867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23868 NodeAnnouncementInfo_free(this_obj_conv);
23871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23872 LDKNodeAnnouncementInfo this_ptr_conv;
23873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23874 this_ptr_conv.is_owned = false;
23875 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
23876 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23877 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23878 uint64_t ret_ref = (uint64_t)ret_var.inner;
23879 if (ret_var.is_owned) {
23885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23886 LDKNodeAnnouncementInfo this_ptr_conv;
23887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23888 this_ptr_conv.is_owned = false;
23889 LDKNodeFeatures val_conv;
23890 val_conv.inner = (void*)(val & (~1));
23891 val_conv.is_owned = (val & 1) || (val == 0);
23892 val_conv = NodeFeatures_clone(&val_conv);
23893 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
23896 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
23897 LDKNodeAnnouncementInfo this_ptr_conv;
23898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23899 this_ptr_conv.is_owned = false;
23900 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
23904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23905 LDKNodeAnnouncementInfo this_ptr_conv;
23906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23907 this_ptr_conv.is_owned = false;
23908 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
23911 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
23912 LDKNodeAnnouncementInfo this_ptr_conv;
23913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23914 this_ptr_conv.is_owned = false;
23915 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
23916 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
23920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23921 LDKNodeAnnouncementInfo this_ptr_conv;
23922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23923 this_ptr_conv.is_owned = false;
23924 LDKThreeBytes val_ref;
23925 CHECK((*env)->GetArrayLength(env, val) == 3);
23926 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
23927 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
23930 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
23931 LDKNodeAnnouncementInfo this_ptr_conv;
23932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23933 this_ptr_conv.is_owned = false;
23934 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23935 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
23939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23940 LDKNodeAnnouncementInfo this_ptr_conv;
23941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23942 this_ptr_conv.is_owned = false;
23943 LDKThirtyTwoBytes val_ref;
23944 CHECK((*env)->GetArrayLength(env, val) == 32);
23945 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
23946 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
23949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
23950 LDKNodeAnnouncementInfo this_ptr_conv;
23951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23952 this_ptr_conv.is_owned = false;
23953 LDKCVec_NetAddressZ val_constr;
23954 val_constr.datalen = (*env)->GetArrayLength(env, val);
23955 if (val_constr.datalen > 0)
23956 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
23958 val_constr.data = NULL;
23959 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
23960 for (size_t m = 0; m < val_constr.datalen; m++) {
23961 int64_t val_conv_12 = val_vals[m];
23962 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
23963 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
23964 val_constr.data[m] = val_conv_12_conv;
23966 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
23967 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
23970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
23971 LDKNodeAnnouncementInfo this_ptr_conv;
23972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23973 this_ptr_conv.is_owned = false;
23974 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
23975 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23976 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23977 uint64_t ret_ref = (uint64_t)ret_var.inner;
23978 if (ret_var.is_owned) {
23984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23985 LDKNodeAnnouncementInfo this_ptr_conv;
23986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23987 this_ptr_conv.is_owned = false;
23988 LDKNodeAnnouncement val_conv;
23989 val_conv.inner = (void*)(val & (~1));
23990 val_conv.is_owned = (val & 1) || (val == 0);
23991 val_conv = NodeAnnouncement_clone(&val_conv);
23992 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
23995 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) {
23996 LDKNodeFeatures features_arg_conv;
23997 features_arg_conv.inner = (void*)(features_arg & (~1));
23998 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
23999 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24000 LDKThreeBytes rgb_arg_ref;
24001 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
24002 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24003 LDKThirtyTwoBytes alias_arg_ref;
24004 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24005 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24006 LDKCVec_NetAddressZ addresses_arg_constr;
24007 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24008 if (addresses_arg_constr.datalen > 0)
24009 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24011 addresses_arg_constr.data = NULL;
24012 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24013 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24014 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24015 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24016 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24018 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24019 LDKNodeAnnouncement announcement_message_arg_conv;
24020 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24021 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24022 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24023 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24024 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24025 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24026 uint64_t ret_ref = (uint64_t)ret_var.inner;
24027 if (ret_var.is_owned) {
24033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24034 LDKNodeAnnouncementInfo orig_conv;
24035 orig_conv.inner = (void*)(orig & (~1));
24036 orig_conv.is_owned = false;
24037 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24038 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24039 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24040 uint64_t ret_ref = (uint64_t)ret_var.inner;
24041 if (ret_var.is_owned) {
24047 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24048 LDKNodeAnnouncementInfo obj_conv;
24049 obj_conv.inner = (void*)(obj & (~1));
24050 obj_conv.is_owned = false;
24051 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24052 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24053 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24054 CVec_u8Z_free(ret_var);
24058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24059 LDKu8slice ser_ref;
24060 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24061 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24062 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24063 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24064 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24065 return (uint64_t)ret_conv;
24068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24069 LDKNodeInfo this_obj_conv;
24070 this_obj_conv.inner = (void*)(this_obj & (~1));
24071 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24072 NodeInfo_free(this_obj_conv);
24075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24076 LDKNodeInfo this_ptr_conv;
24077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24078 this_ptr_conv.is_owned = false;
24079 LDKCVec_u64Z val_constr;
24080 val_constr.datalen = (*env)->GetArrayLength(env, val);
24081 if (val_constr.datalen > 0)
24082 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24084 val_constr.data = NULL;
24085 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24086 for (size_t g = 0; g < val_constr.datalen; g++) {
24087 int64_t val_conv_6 = val_vals[g];
24088 val_constr.data[g] = val_conv_6;
24090 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24091 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24095 LDKNodeInfo this_ptr_conv;
24096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24097 this_ptr_conv.is_owned = false;
24098 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24101 uint64_t ret_ref = (uint64_t)ret_var.inner;
24102 if (ret_var.is_owned) {
24108 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) {
24109 LDKNodeInfo this_ptr_conv;
24110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24111 this_ptr_conv.is_owned = false;
24112 LDKRoutingFees val_conv;
24113 val_conv.inner = (void*)(val & (~1));
24114 val_conv.is_owned = (val & 1) || (val == 0);
24115 val_conv = RoutingFees_clone(&val_conv);
24116 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24120 LDKNodeInfo this_ptr_conv;
24121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24122 this_ptr_conv.is_owned = false;
24123 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24124 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24125 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24126 uint64_t ret_ref = (uint64_t)ret_var.inner;
24127 if (ret_var.is_owned) {
24133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24134 LDKNodeInfo this_ptr_conv;
24135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24136 this_ptr_conv.is_owned = false;
24137 LDKNodeAnnouncementInfo val_conv;
24138 val_conv.inner = (void*)(val & (~1));
24139 val_conv.is_owned = (val & 1) || (val == 0);
24140 val_conv = NodeAnnouncementInfo_clone(&val_conv);
24141 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
24144 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) {
24145 LDKCVec_u64Z channels_arg_constr;
24146 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
24147 if (channels_arg_constr.datalen > 0)
24148 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24150 channels_arg_constr.data = NULL;
24151 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
24152 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
24153 int64_t channels_arg_conv_6 = channels_arg_vals[g];
24154 channels_arg_constr.data[g] = channels_arg_conv_6;
24156 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
24157 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
24158 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
24159 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
24160 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
24161 LDKNodeAnnouncementInfo announcement_info_arg_conv;
24162 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
24163 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
24164 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
24165 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
24166 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24167 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24168 uint64_t ret_ref = (uint64_t)ret_var.inner;
24169 if (ret_var.is_owned) {
24175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24176 LDKNodeInfo orig_conv;
24177 orig_conv.inner = (void*)(orig & (~1));
24178 orig_conv.is_owned = false;
24179 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
24180 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24181 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24182 uint64_t ret_ref = (uint64_t)ret_var.inner;
24183 if (ret_var.is_owned) {
24189 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24190 LDKNodeInfo obj_conv;
24191 obj_conv.inner = (void*)(obj & (~1));
24192 obj_conv.is_owned = false;
24193 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
24194 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24195 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24196 CVec_u8Z_free(ret_var);
24200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24201 LDKu8slice ser_ref;
24202 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24203 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24204 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
24205 *ret_conv = NodeInfo_read(ser_ref);
24206 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24207 return (uint64_t)ret_conv;
24210 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
24211 LDKNetworkGraph obj_conv;
24212 obj_conv.inner = (void*)(obj & (~1));
24213 obj_conv.is_owned = false;
24214 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
24215 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24216 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24217 CVec_u8Z_free(ret_var);
24221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24222 LDKu8slice ser_ref;
24223 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24224 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24225 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
24226 *ret_conv = NetworkGraph_read(ser_ref);
24227 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24228 return (uint64_t)ret_conv;
24231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
24232 LDKThirtyTwoBytes genesis_hash_ref;
24233 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24234 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24235 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
24236 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24237 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24238 uint64_t ret_ref = (uint64_t)ret_var.inner;
24239 if (ret_var.is_owned) {
24245 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) {
24246 LDKNetworkGraph this_arg_conv;
24247 this_arg_conv.inner = (void*)(this_arg & (~1));
24248 this_arg_conv.is_owned = false;
24249 LDKNodeAnnouncement msg_conv;
24250 msg_conv.inner = (void*)(msg & (~1));
24251 msg_conv.is_owned = false;
24252 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24253 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
24254 return (uint64_t)ret_conv;
24257 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) {
24258 LDKNetworkGraph this_arg_conv;
24259 this_arg_conv.inner = (void*)(this_arg & (~1));
24260 this_arg_conv.is_owned = false;
24261 LDKUnsignedNodeAnnouncement msg_conv;
24262 msg_conv.inner = (void*)(msg & (~1));
24263 msg_conv.is_owned = false;
24264 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24265 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
24266 return (uint64_t)ret_conv;
24269 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) {
24270 LDKNetworkGraph this_arg_conv;
24271 this_arg_conv.inner = (void*)(this_arg & (~1));
24272 this_arg_conv.is_owned = false;
24273 LDKChannelAnnouncement msg_conv;
24274 msg_conv.inner = (void*)(msg & (~1));
24275 msg_conv.is_owned = false;
24276 LDKAccess *chain_access_conv_ptr = NULL;
24277 if (chain_access != 0) {
24278 LDKAccess chain_access_conv;
24279 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24280 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24281 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24282 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24284 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24285 *chain_access_conv_ptr = chain_access_conv;
24287 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24288 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24289 return (uint64_t)ret_conv;
24292 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) {
24293 LDKNetworkGraph this_arg_conv;
24294 this_arg_conv.inner = (void*)(this_arg & (~1));
24295 this_arg_conv.is_owned = false;
24296 LDKUnsignedChannelAnnouncement msg_conv;
24297 msg_conv.inner = (void*)(msg & (~1));
24298 msg_conv.is_owned = false;
24299 LDKAccess *chain_access_conv_ptr = NULL;
24300 if (chain_access != 0) {
24301 LDKAccess chain_access_conv;
24302 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24303 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24304 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24305 LDKAccess_JCalls_clone(chain_access_conv.this_arg);
24307 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24308 *chain_access_conv_ptr = chain_access_conv;
24310 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24311 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
24312 return (uint64_t)ret_conv;
24315 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) {
24316 LDKNetworkGraph this_arg_conv;
24317 this_arg_conv.inner = (void*)(this_arg & (~1));
24318 this_arg_conv.is_owned = false;
24319 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
24322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24323 LDKNetworkGraph this_arg_conv;
24324 this_arg_conv.inner = (void*)(this_arg & (~1));
24325 this_arg_conv.is_owned = false;
24326 LDKChannelUpdate msg_conv;
24327 msg_conv.inner = (void*)(msg & (~1));
24328 msg_conv.is_owned = false;
24329 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24330 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
24331 return (uint64_t)ret_conv;
24334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
24335 LDKNetworkGraph this_arg_conv;
24336 this_arg_conv.inner = (void*)(this_arg & (~1));
24337 this_arg_conv.is_owned = false;
24338 LDKUnsignedChannelUpdate msg_conv;
24339 msg_conv.inner = (void*)(msg & (~1));
24340 msg_conv.is_owned = false;
24341 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
24342 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
24343 return (uint64_t)ret_conv;
24346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24347 LDKFilesystemPersister this_obj_conv;
24348 this_obj_conv.inner = (void*)(this_obj & (~1));
24349 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24350 FilesystemPersister_free(this_obj_conv);
24353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
24354 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
24355 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
24356 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24357 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24358 uint64_t ret_ref = (uint64_t)ret_var.inner;
24359 if (ret_var.is_owned) {
24365 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
24366 LDKFilesystemPersister this_arg_conv;
24367 this_arg_conv.inner = (void*)(this_arg & (~1));
24368 this_arg_conv.is_owned = false;
24369 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
24370 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
24374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
24375 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
24376 LDKChannelManager manager_conv;
24377 manager_conv.inner = (void*)(manager & (~1));
24378 manager_conv.is_owned = false;
24379 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24380 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
24381 return (uint64_t)ret_conv;
24384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
24385 LDKFilesystemPersister this_arg_conv;
24386 this_arg_conv.inner = (void*)(this_arg & (~1));
24387 this_arg_conv.is_owned = false;
24388 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
24389 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
24390 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24391 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
24393 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
24394 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
24395 return (uint64_t)ret_conv;
24398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
24399 LDKFilesystemPersister this_arg_conv;
24400 this_arg_conv.inner = (void*)(this_arg & (~1));
24401 this_arg_conv.is_owned = false;
24402 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
24403 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
24404 return (uint64_t)ret;
24407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24408 LDKBackgroundProcessor this_obj_conv;
24409 this_obj_conv.inner = (void*)(this_obj & (~1));
24410 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24411 BackgroundProcessor_free(this_obj_conv);
24414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24415 if ((this_ptr & 1) != 0) return;
24416 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
24417 FREE((void*)this_ptr);
24418 ChannelManagerPersister_free(this_ptr_conv);
24421 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) {
24422 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
24423 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
24424 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24425 LDKChannelManagerPersister_JCalls_clone(persister_conv.this_arg);
24427 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
24428 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
24429 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24430 LDKEventHandler_JCalls_clone(event_handler_conv.this_arg);
24432 LDKChainMonitor chain_monitor_conv;
24433 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
24434 chain_monitor_conv.is_owned = false;
24435 LDKChannelManager channel_manager_conv;
24436 channel_manager_conv.inner = (void*)(channel_manager & (~1));
24437 channel_manager_conv.is_owned = false;
24438 LDKPeerManager peer_manager_conv;
24439 peer_manager_conv.inner = (void*)(peer_manager & (~1));
24440 peer_manager_conv.is_owned = false;
24441 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24442 if (logger_conv.free == LDKLogger_JCalls_free) {
24443 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24444 LDKLogger_JCalls_clone(logger_conv.this_arg);
24446 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
24447 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24448 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24449 uint64_t ret_ref = (uint64_t)ret_var.inner;
24450 if (ret_var.is_owned) {
24456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
24457 LDKBackgroundProcessor this_arg_conv;
24458 this_arg_conv.inner = (void*)(this_arg & (~1));
24459 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24460 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
24461 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
24462 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
24463 return (uint64_t)ret_conv;
24466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
24470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24471 LDKInvoice this_obj_conv;
24472 this_obj_conv.inner = (void*)(this_obj & (~1));
24473 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24474 Invoice_free(this_obj_conv);
24477 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24479 a_conv.inner = (void*)(a & (~1));
24480 a_conv.is_owned = false;
24482 b_conv.inner = (void*)(b & (~1));
24483 b_conv.is_owned = false;
24484 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
24488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24489 LDKInvoice orig_conv;
24490 orig_conv.inner = (void*)(orig & (~1));
24491 orig_conv.is_owned = false;
24492 LDKInvoice ret_var = Invoice_clone(&orig_conv);
24493 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24494 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24495 uint64_t ret_ref = (uint64_t)ret_var.inner;
24496 if (ret_var.is_owned) {
24502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24503 LDKSignedRawInvoice this_obj_conv;
24504 this_obj_conv.inner = (void*)(this_obj & (~1));
24505 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24506 SignedRawInvoice_free(this_obj_conv);
24509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24510 LDKSignedRawInvoice a_conv;
24511 a_conv.inner = (void*)(a & (~1));
24512 a_conv.is_owned = false;
24513 LDKSignedRawInvoice b_conv;
24514 b_conv.inner = (void*)(b & (~1));
24515 b_conv.is_owned = false;
24516 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
24520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24521 LDKSignedRawInvoice orig_conv;
24522 orig_conv.inner = (void*)(orig & (~1));
24523 orig_conv.is_owned = false;
24524 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
24525 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24526 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24527 uint64_t ret_ref = (uint64_t)ret_var.inner;
24528 if (ret_var.is_owned) {
24534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24535 LDKRawInvoice this_obj_conv;
24536 this_obj_conv.inner = (void*)(this_obj & (~1));
24537 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24538 RawInvoice_free(this_obj_conv);
24541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
24542 LDKRawInvoice this_ptr_conv;
24543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24544 this_ptr_conv.is_owned = false;
24545 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
24546 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24547 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24548 uint64_t ret_ref = (uint64_t)ret_var.inner;
24549 if (ret_var.is_owned) {
24555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24556 LDKRawInvoice this_ptr_conv;
24557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24558 this_ptr_conv.is_owned = false;
24559 LDKRawDataPart val_conv;
24560 val_conv.inner = (void*)(val & (~1));
24561 val_conv.is_owned = (val & 1) || (val == 0);
24562 val_conv = RawDataPart_clone(&val_conv);
24563 RawInvoice_set_data(&this_ptr_conv, val_conv);
24566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24567 LDKRawInvoice a_conv;
24568 a_conv.inner = (void*)(a & (~1));
24569 a_conv.is_owned = false;
24570 LDKRawInvoice b_conv;
24571 b_conv.inner = (void*)(b & (~1));
24572 b_conv.is_owned = false;
24573 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
24577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24578 LDKRawInvoice orig_conv;
24579 orig_conv.inner = (void*)(orig & (~1));
24580 orig_conv.is_owned = false;
24581 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
24582 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24583 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24584 uint64_t ret_ref = (uint64_t)ret_var.inner;
24585 if (ret_var.is_owned) {
24591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24592 LDKRawDataPart this_obj_conv;
24593 this_obj_conv.inner = (void*)(this_obj & (~1));
24594 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24595 RawDataPart_free(this_obj_conv);
24598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
24599 LDKRawDataPart this_ptr_conv;
24600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24601 this_ptr_conv.is_owned = false;
24602 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
24603 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24604 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24605 uint64_t ret_ref = (uint64_t)ret_var.inner;
24606 if (ret_var.is_owned) {
24612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24613 LDKRawDataPart this_ptr_conv;
24614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24615 this_ptr_conv.is_owned = false;
24616 LDKPositiveTimestamp val_conv;
24617 val_conv.inner = (void*)(val & (~1));
24618 val_conv.is_owned = (val & 1) || (val == 0);
24619 val_conv = PositiveTimestamp_clone(&val_conv);
24620 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
24623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24624 LDKRawDataPart a_conv;
24625 a_conv.inner = (void*)(a & (~1));
24626 a_conv.is_owned = false;
24627 LDKRawDataPart b_conv;
24628 b_conv.inner = (void*)(b & (~1));
24629 b_conv.is_owned = false;
24630 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
24634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24635 LDKRawDataPart orig_conv;
24636 orig_conv.inner = (void*)(orig & (~1));
24637 orig_conv.is_owned = false;
24638 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
24639 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24640 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24641 uint64_t ret_ref = (uint64_t)ret_var.inner;
24642 if (ret_var.is_owned) {
24648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24649 LDKPositiveTimestamp this_obj_conv;
24650 this_obj_conv.inner = (void*)(this_obj & (~1));
24651 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24652 PositiveTimestamp_free(this_obj_conv);
24655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24656 LDKPositiveTimestamp a_conv;
24657 a_conv.inner = (void*)(a & (~1));
24658 a_conv.is_owned = false;
24659 LDKPositiveTimestamp b_conv;
24660 b_conv.inner = (void*)(b & (~1));
24661 b_conv.is_owned = false;
24662 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
24666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24667 LDKPositiveTimestamp orig_conv;
24668 orig_conv.inner = (void*)(orig & (~1));
24669 orig_conv.is_owned = false;
24670 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
24671 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24672 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24673 uint64_t ret_ref = (uint64_t)ret_var.inner;
24674 if (ret_var.is_owned) {
24680 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24681 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
24682 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
24686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24687 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
24688 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
24689 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
24693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
24694 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
24695 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
24699 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24700 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
24701 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
24705 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24706 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
24707 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
24708 jboolean ret_val = Currency_eq(a_conv, b_conv);
24712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24713 LDKSha256 this_obj_conv;
24714 this_obj_conv.inner = (void*)(this_obj & (~1));
24715 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24716 Sha256_free(this_obj_conv);
24719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24721 a_conv.inner = (void*)(a & (~1));
24722 a_conv.is_owned = false;
24724 b_conv.inner = (void*)(b & (~1));
24725 b_conv.is_owned = false;
24726 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
24730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24731 LDKSha256 orig_conv;
24732 orig_conv.inner = (void*)(orig & (~1));
24733 orig_conv.is_owned = false;
24734 LDKSha256 ret_var = Sha256_clone(&orig_conv);
24735 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24736 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24737 uint64_t ret_ref = (uint64_t)ret_var.inner;
24738 if (ret_var.is_owned) {
24744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24745 LDKDescription this_obj_conv;
24746 this_obj_conv.inner = (void*)(this_obj & (~1));
24747 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24748 Description_free(this_obj_conv);
24751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24752 LDKDescription a_conv;
24753 a_conv.inner = (void*)(a & (~1));
24754 a_conv.is_owned = false;
24755 LDKDescription b_conv;
24756 b_conv.inner = (void*)(b & (~1));
24757 b_conv.is_owned = false;
24758 jboolean ret_val = Description_eq(&a_conv, &b_conv);
24762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24763 LDKDescription orig_conv;
24764 orig_conv.inner = (void*)(orig & (~1));
24765 orig_conv.is_owned = false;
24766 LDKDescription ret_var = Description_clone(&orig_conv);
24767 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24768 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24769 uint64_t ret_ref = (uint64_t)ret_var.inner;
24770 if (ret_var.is_owned) {
24776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24777 LDKPayeePubKey this_obj_conv;
24778 this_obj_conv.inner = (void*)(this_obj & (~1));
24779 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24780 PayeePubKey_free(this_obj_conv);
24783 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24784 LDKPayeePubKey a_conv;
24785 a_conv.inner = (void*)(a & (~1));
24786 a_conv.is_owned = false;
24787 LDKPayeePubKey b_conv;
24788 b_conv.inner = (void*)(b & (~1));
24789 b_conv.is_owned = false;
24790 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
24794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24795 LDKPayeePubKey orig_conv;
24796 orig_conv.inner = (void*)(orig & (~1));
24797 orig_conv.is_owned = false;
24798 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
24799 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24800 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24801 uint64_t ret_ref = (uint64_t)ret_var.inner;
24802 if (ret_var.is_owned) {
24808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24809 LDKExpiryTime this_obj_conv;
24810 this_obj_conv.inner = (void*)(this_obj & (~1));
24811 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24812 ExpiryTime_free(this_obj_conv);
24815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24816 LDKExpiryTime a_conv;
24817 a_conv.inner = (void*)(a & (~1));
24818 a_conv.is_owned = false;
24819 LDKExpiryTime b_conv;
24820 b_conv.inner = (void*)(b & (~1));
24821 b_conv.is_owned = false;
24822 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
24826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24827 LDKExpiryTime orig_conv;
24828 orig_conv.inner = (void*)(orig & (~1));
24829 orig_conv.is_owned = false;
24830 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
24831 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24832 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24833 uint64_t ret_ref = (uint64_t)ret_var.inner;
24834 if (ret_var.is_owned) {
24840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24841 LDKMinFinalCltvExpiry this_obj_conv;
24842 this_obj_conv.inner = (void*)(this_obj & (~1));
24843 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24844 MinFinalCltvExpiry_free(this_obj_conv);
24847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24848 LDKMinFinalCltvExpiry a_conv;
24849 a_conv.inner = (void*)(a & (~1));
24850 a_conv.is_owned = false;
24851 LDKMinFinalCltvExpiry b_conv;
24852 b_conv.inner = (void*)(b & (~1));
24853 b_conv.is_owned = false;
24854 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
24858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24859 LDKMinFinalCltvExpiry orig_conv;
24860 orig_conv.inner = (void*)(orig & (~1));
24861 orig_conv.is_owned = false;
24862 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
24863 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24864 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24865 uint64_t ret_ref = (uint64_t)ret_var.inner;
24866 if (ret_var.is_owned) {
24872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
24873 if ((this_ptr & 1) != 0) return;
24874 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
24875 FREE((void*)this_ptr);
24876 Fallback_free(this_ptr_conv);
24879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24880 LDKFallback* orig_conv = (LDKFallback*)orig;
24881 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
24882 *ret_copy = Fallback_clone(orig_conv);
24883 uint64_t ret_ref = (uint64_t)ret_copy;
24887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24888 LDKFallback* a_conv = (LDKFallback*)a;
24889 LDKFallback* b_conv = (LDKFallback*)b;
24890 jboolean ret_val = Fallback_eq(a_conv, b_conv);
24894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24895 LDKInvoiceSignature this_obj_conv;
24896 this_obj_conv.inner = (void*)(this_obj & (~1));
24897 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24898 InvoiceSignature_free(this_obj_conv);
24901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24902 LDKInvoiceSignature a_conv;
24903 a_conv.inner = (void*)(a & (~1));
24904 a_conv.is_owned = false;
24905 LDKInvoiceSignature b_conv;
24906 b_conv.inner = (void*)(b & (~1));
24907 b_conv.is_owned = false;
24908 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
24912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24913 LDKInvoiceSignature orig_conv;
24914 orig_conv.inner = (void*)(orig & (~1));
24915 orig_conv.is_owned = false;
24916 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
24917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24919 uint64_t ret_ref = (uint64_t)ret_var.inner;
24920 if (ret_var.is_owned) {
24926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24927 LDKPrivateRoute this_obj_conv;
24928 this_obj_conv.inner = (void*)(this_obj & (~1));
24929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24930 PrivateRoute_free(this_obj_conv);
24933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24934 LDKPrivateRoute a_conv;
24935 a_conv.inner = (void*)(a & (~1));
24936 a_conv.is_owned = false;
24937 LDKPrivateRoute b_conv;
24938 b_conv.inner = (void*)(b & (~1));
24939 b_conv.is_owned = false;
24940 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
24944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24945 LDKPrivateRoute orig_conv;
24946 orig_conv.inner = (void*)(orig & (~1));
24947 orig_conv.is_owned = false;
24948 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
24949 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24950 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24951 uint64_t ret_ref = (uint64_t)ret_var.inner;
24952 if (ret_var.is_owned) {
24958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
24959 LDKSignedRawInvoice this_arg_conv;
24960 this_arg_conv.inner = (void*)(this_arg & (~1));
24961 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
24962 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
24963 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
24964 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
24965 return (uint64_t)ret_ref;
24968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
24969 LDKSignedRawInvoice this_arg_conv;
24970 this_arg_conv.inner = (void*)(this_arg & (~1));
24971 this_arg_conv.is_owned = false;
24972 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
24973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24975 uint64_t ret_ref = (uint64_t)ret_var.inner;
24976 if (ret_var.is_owned) {
24982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
24983 LDKSignedRawInvoice this_arg_conv;
24984 this_arg_conv.inner = (void*)(this_arg & (~1));
24985 this_arg_conv.is_owned = false;
24986 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24987 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
24991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
24992 LDKSignedRawInvoice this_arg_conv;
24993 this_arg_conv.inner = (void*)(this_arg & (~1));
24994 this_arg_conv.is_owned = false;
24995 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
24996 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24997 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24998 uint64_t ret_ref = (uint64_t)ret_var.inner;
24999 if (ret_var.is_owned) {
25005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25006 LDKSignedRawInvoice this_arg_conv;
25007 this_arg_conv.inner = (void*)(this_arg & (~1));
25008 this_arg_conv.is_owned = false;
25009 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25010 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25011 return (uint64_t)ret_conv;
25014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25015 LDKSignedRawInvoice this_arg_conv;
25016 this_arg_conv.inner = (void*)(this_arg & (~1));
25017 this_arg_conv.is_owned = false;
25018 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25023 LDKRawInvoice this_arg_conv;
25024 this_arg_conv.inner = (void*)(this_arg & (~1));
25025 this_arg_conv.is_owned = false;
25026 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25027 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25032 LDKRawInvoice this_arg_conv;
25033 this_arg_conv.inner = (void*)(this_arg & (~1));
25034 this_arg_conv.is_owned = false;
25035 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25036 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25037 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25038 uint64_t ret_ref = (uint64_t)ret_var.inner;
25039 if (ret_var.is_owned) {
25045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25046 LDKRawInvoice this_arg_conv;
25047 this_arg_conv.inner = (void*)(this_arg & (~1));
25048 this_arg_conv.is_owned = false;
25049 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25050 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25051 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25052 uint64_t ret_ref = (uint64_t)ret_var.inner;
25053 if (ret_var.is_owned) {
25059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25060 LDKRawInvoice this_arg_conv;
25061 this_arg_conv.inner = (void*)(this_arg & (~1));
25062 this_arg_conv.is_owned = false;
25063 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25064 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25065 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25066 uint64_t ret_ref = (uint64_t)ret_var.inner;
25067 if (ret_var.is_owned) {
25073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25074 LDKRawInvoice this_arg_conv;
25075 this_arg_conv.inner = (void*)(this_arg & (~1));
25076 this_arg_conv.is_owned = false;
25077 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25078 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25079 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25080 uint64_t ret_ref = (uint64_t)ret_var.inner;
25081 if (ret_var.is_owned) {
25087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25088 LDKRawInvoice this_arg_conv;
25089 this_arg_conv.inner = (void*)(this_arg & (~1));
25090 this_arg_conv.is_owned = false;
25091 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25092 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25093 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25094 uint64_t ret_ref = (uint64_t)ret_var.inner;
25095 if (ret_var.is_owned) {
25101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25102 LDKRawInvoice this_arg_conv;
25103 this_arg_conv.inner = (void*)(this_arg & (~1));
25104 this_arg_conv.is_owned = false;
25105 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25106 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25107 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25108 uint64_t ret_ref = (uint64_t)ret_var.inner;
25109 if (ret_var.is_owned) {
25115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25116 LDKRawInvoice this_arg_conv;
25117 this_arg_conv.inner = (void*)(this_arg & (~1));
25118 this_arg_conv.is_owned = false;
25119 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25120 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25125 LDKRawInvoice this_arg_conv;
25126 this_arg_conv.inner = (void*)(this_arg & (~1));
25127 this_arg_conv.is_owned = false;
25128 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25129 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25130 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25131 uint64_t ret_ref = (uint64_t)ret_var.inner;
25132 if (ret_var.is_owned) {
25138 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25139 LDKRawInvoice this_arg_conv;
25140 this_arg_conv.inner = (void*)(this_arg & (~1));
25141 this_arg_conv.is_owned = false;
25142 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
25143 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25144 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25145 for (size_t o = 0; o < ret_var.datalen; o++) {
25146 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25147 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25148 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25149 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25150 if (ret_conv_14_var.is_owned) {
25151 ret_conv_14_ref |= 1;
25153 ret_arr_ptr[o] = ret_conv_14_ref;
25155 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25156 FREE(ret_var.data);
25160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25161 LDKRawInvoice this_arg_conv;
25162 this_arg_conv.inner = (void*)(this_arg & (~1));
25163 this_arg_conv.is_owned = false;
25164 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25165 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
25166 uint64_t ret_ref = (uint64_t)ret_copy;
25170 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25171 LDKRawInvoice this_arg_conv;
25172 this_arg_conv.inner = (void*)(this_arg & (~1));
25173 this_arg_conv.is_owned = false;
25174 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
25178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
25179 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25180 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
25181 return (uint64_t)ret_conv;
25184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
25185 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
25186 *ret_conv = PositiveTimestamp_from_system_time(time);
25187 return (uint64_t)ret_conv;
25190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25191 LDKPositiveTimestamp this_arg_conv;
25192 this_arg_conv.inner = (void*)(this_arg & (~1));
25193 this_arg_conv.is_owned = false;
25194 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
25198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25199 LDKPositiveTimestamp this_arg_conv;
25200 this_arg_conv.inner = (void*)(this_arg & (~1));
25201 this_arg_conv.is_owned = false;
25202 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
25206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
25207 LDKInvoice this_arg_conv;
25208 this_arg_conv.inner = (void*)(this_arg & (~1));
25209 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25210 this_arg_conv = Invoice_clone(&this_arg_conv);
25211 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
25212 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25213 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25214 uint64_t ret_ref = (uint64_t)ret_var.inner;
25215 if (ret_var.is_owned) {
25221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25222 LDKInvoice this_arg_conv;
25223 this_arg_conv.inner = (void*)(this_arg & (~1));
25224 this_arg_conv.is_owned = false;
25225 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
25226 *ret_conv = Invoice_check_signature(&this_arg_conv);
25227 return (uint64_t)ret_conv;
25230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
25231 LDKSignedRawInvoice signed_invoice_conv;
25232 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
25233 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
25234 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
25235 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
25236 *ret_conv = Invoice_from_signed(signed_invoice_conv);
25237 return (uint64_t)ret_conv;
25240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
25241 LDKInvoice this_arg_conv;
25242 this_arg_conv.inner = (void*)(this_arg & (~1));
25243 this_arg_conv.is_owned = false;
25244 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
25248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25249 LDKInvoice this_arg_conv;
25250 this_arg_conv.inner = (void*)(this_arg & (~1));
25251 this_arg_conv.is_owned = false;
25252 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25253 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
25257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25258 LDKInvoice this_arg_conv;
25259 this_arg_conv.inner = (void*)(this_arg & (~1));
25260 this_arg_conv.is_owned = false;
25261 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
25266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25267 LDKInvoice this_arg_conv;
25268 this_arg_conv.inner = (void*)(this_arg & (~1));
25269 this_arg_conv.is_owned = false;
25270 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25271 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
25275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25276 LDKInvoice this_arg_conv;
25277 this_arg_conv.inner = (void*)(this_arg & (~1));
25278 this_arg_conv.is_owned = false;
25279 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
25280 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25281 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25282 uint64_t ret_ref = (uint64_t)ret_var.inner;
25283 if (ret_var.is_owned) {
25289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25290 LDKInvoice this_arg_conv;
25291 this_arg_conv.inner = (void*)(this_arg & (~1));
25292 this_arg_conv.is_owned = false;
25293 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
25294 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
25298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25299 LDKInvoice this_arg_conv;
25300 this_arg_conv.inner = (void*)(this_arg & (~1));
25301 this_arg_conv.is_owned = false;
25302 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
25306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25307 LDKInvoice this_arg_conv;
25308 this_arg_conv.inner = (void*)(this_arg & (~1));
25309 this_arg_conv.is_owned = false;
25310 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
25314 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
25315 LDKInvoice this_arg_conv;
25316 this_arg_conv.inner = (void*)(this_arg & (~1));
25317 this_arg_conv.is_owned = false;
25318 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
25319 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25320 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25321 for (size_t o = 0; o < ret_var.datalen; o++) {
25322 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
25323 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25324 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25325 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
25326 if (ret_conv_14_var.is_owned) {
25327 ret_conv_14_ref |= 1;
25329 ret_arr_ptr[o] = ret_conv_14_ref;
25331 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25332 FREE(ret_var.data);
25336 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
25337 LDKInvoice this_arg_conv;
25338 this_arg_conv.inner = (void*)(this_arg & (~1));
25339 this_arg_conv.is_owned = false;
25340 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
25341 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
25342 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
25343 for (size_t l = 0; l < ret_var.datalen; l++) {
25344 LDKRouteHint ret_conv_11_var = ret_var.data[l];
25345 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25346 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25347 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
25348 if (ret_conv_11_var.is_owned) {
25349 ret_conv_11_ref |= 1;
25351 ret_arr_ptr[l] = ret_conv_11_ref;
25353 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
25354 FREE(ret_var.data);
25358 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
25359 LDKInvoice this_arg_conv;
25360 this_arg_conv.inner = (void*)(this_arg & (~1));
25361 this_arg_conv.is_owned = false;
25362 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
25366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
25367 LDKInvoice this_arg_conv;
25368 this_arg_conv.inner = (void*)(this_arg & (~1));
25369 this_arg_conv.is_owned = false;
25370 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
25371 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
25372 uint64_t ret_ref = (uint64_t)ret_copy;
25376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
25377 LDKStr description_conv = java_to_owned_str(env, description);
25378 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
25379 *ret_conv = Description_new(description_conv);
25380 return (uint64_t)ret_conv;
25383 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25384 LDKDescription this_arg_conv;
25385 this_arg_conv.inner = (void*)(this_arg & (~1));
25386 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25387 this_arg_conv = Description_clone(&this_arg_conv);
25388 LDKStr ret_str = Description_into_inner(this_arg_conv);
25389 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
25394 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25395 *ret_conv = ExpiryTime_from_seconds(seconds);
25396 return (uint64_t)ret_conv;
25399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
25400 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
25401 *ret_conv = ExpiryTime_from_duration(duration);
25402 return (uint64_t)ret_conv;
25405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
25406 LDKExpiryTime this_arg_conv;
25407 this_arg_conv.inner = (void*)(this_arg & (~1));
25408 this_arg_conv.is_owned = false;
25409 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
25413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
25414 LDKExpiryTime this_arg_conv;
25415 this_arg_conv.inner = (void*)(this_arg & (~1));
25416 this_arg_conv.is_owned = false;
25417 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
25421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
25422 LDKRouteHint hops_conv;
25423 hops_conv.inner = (void*)(hops & (~1));
25424 hops_conv.is_owned = (hops & 1) || (hops == 0);
25425 hops_conv = RouteHint_clone(&hops_conv);
25426 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
25427 *ret_conv = PrivateRoute_new(hops_conv);
25428 return (uint64_t)ret_conv;
25431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
25432 LDKPrivateRoute this_arg_conv;
25433 this_arg_conv.inner = (void*)(this_arg & (~1));
25434 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25435 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
25436 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
25437 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25438 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25439 uint64_t ret_ref = (uint64_t)ret_var.inner;
25440 if (ret_var.is_owned) {
25446 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25447 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
25448 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
25452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25453 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
25454 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
25455 jboolean ret_val = CreationError_eq(a_conv, b_conv);
25459 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25460 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
25461 LDKStr ret_str = CreationError_to_str(o_conv);
25462 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25466 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25467 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
25468 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
25472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25473 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
25474 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
25475 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
25479 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25480 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
25481 LDKStr ret_str = SemanticError_to_str(o_conv);
25482 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25487 if ((this_ptr & 1) != 0) return;
25488 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
25489 FREE((void*)this_ptr);
25490 SignOrCreationError_free(this_ptr_conv);
25493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25494 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
25495 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
25496 *ret_copy = SignOrCreationError_clone(orig_conv);
25497 uint64_t ret_ref = (uint64_t)ret_copy;
25501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25502 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
25503 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
25504 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
25508 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25509 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
25510 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
25511 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25515 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) {
25516 LDKChannelManager channelmanager_conv;
25517 channelmanager_conv.inner = (void*)(channelmanager & (~1));
25518 channelmanager_conv.is_owned = false;
25519 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25520 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25521 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25522 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
25524 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
25525 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
25526 LDKStr description_conv = java_to_owned_str(env, description);
25527 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
25528 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
25529 return (uint64_t)ret_conv;
25532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25533 LDKStr s_conv = java_to_owned_str(env, s);
25534 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
25535 *ret_conv = SiPrefix_from_str(s_conv);
25536 return (uint64_t)ret_conv;
25539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25540 LDKStr s_conv = java_to_owned_str(env, s);
25541 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
25542 *ret_conv = Invoice_from_str(s_conv);
25543 return (uint64_t)ret_conv;
25546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
25547 LDKStr s_conv = java_to_owned_str(env, s);
25548 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
25549 *ret_conv = SignedRawInvoice_from_str(s_conv);
25550 return (uint64_t)ret_conv;
25553 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25555 o_conv.inner = (void*)(o & (~1));
25556 o_conv.is_owned = false;
25557 LDKStr ret_str = Invoice_to_str(&o_conv);
25558 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25562 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25563 LDKSignedRawInvoice o_conv;
25564 o_conv.inner = (void*)(o & (~1));
25565 o_conv.is_owned = false;
25566 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
25567 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25571 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25572 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
25573 LDKStr ret_str = Currency_to_str(o_conv);
25574 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25578 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
25579 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
25580 LDKStr ret_str = SiPrefix_to_str(o_conv);
25581 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);