1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Running a leak check across all the allocations and frees of the JDK is a mess,
10 // so instead we implement our own naive leak checker here, relying on the -wrap
11 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
12 // and free'd in Rust or C across the generated bindings shared library.
16 static mtx_t allocation_mtx;
18 void __attribute__((constructor)) init_mtx() {
19 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
23 typedef struct allocation {
24 struct allocation* next;
26 const char* struct_name;
30 static allocation* allocation_ll = NULL;
32 void* __real_malloc(size_t len);
33 void* __real_calloc(size_t nmemb, size_t len);
34 static void new_allocation(void* res, const char* struct_name) {
35 allocation* new_alloc = __real_malloc(sizeof(allocation));
37 new_alloc->struct_name = struct_name;
38 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
39 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
40 new_alloc->next = allocation_ll;
41 allocation_ll = new_alloc;
42 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
44 static void* MALLOC(size_t len, const char* struct_name) {
45 void* res = __real_malloc(len);
46 new_allocation(res, struct_name);
49 void __real_free(void* ptr);
50 static void alloc_freed(void* ptr) {
52 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
53 allocation* it = allocation_ll;
54 while (it->ptr != ptr) { p = it; it = it->next; }
55 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
56 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
57 DO_ASSERT(it->ptr == ptr);
60 static void FREE(void* ptr) {
65 void* __wrap_malloc(size_t len) {
66 void* res = __real_malloc(len);
67 new_allocation(res, "malloc call");
70 void* __wrap_calloc(size_t nmemb, size_t len) {
71 void* res = __real_calloc(nmemb, len);
72 new_allocation(res, "calloc call");
75 void __wrap_free(void* ptr) {
80 void* __real_realloc(void* ptr, size_t newlen);
81 void* __wrap_realloc(void* ptr, size_t len) {
83 void* res = __real_realloc(ptr, len);
84 new_allocation(res, "realloc call");
87 void __wrap_reallocarray(void* ptr, size_t new_sz) {
88 // Rust doesn't seem to use reallocarray currently
92 void __attribute__((destructor)) check_leaks() {
93 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
94 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
95 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
96 fprintf(stderr, "\n\n");
98 DO_ASSERT(allocation_ll == NULL);
101 static jmethodID ordinal_meth = NULL;
102 static jmethodID slicedef_meth = NULL;
103 static jclass slicedef_cls = NULL;
104 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
105 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
106 DO_ASSERT(ordinal_meth != NULL);
107 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
108 DO_ASSERT(slicedef_meth != NULL);
109 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
110 DO_ASSERT(slicedef_cls != NULL);
113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
114 return *((bool*)ptr);
116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
117 return *((long*)ptr);
119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
122 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
123 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
124 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
127 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
128 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
129 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
130 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
133 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
134 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
135 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
136 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
137 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
140 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
141 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
142 txdata->datalen = (*env)->GetArrayLength(env, bytes);
143 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
144 txdata->data_is_owned = true;
145 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
149 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
150 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
151 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
152 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
153 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
154 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
155 return (long)vec->datalen;
157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
158 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
159 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
160 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
161 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
162 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
163 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
169 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
170 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
171 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
172 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
174 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
175 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
176 case 0: return LDKAccessError_UnknownChain;
177 case 1: return LDKAccessError_UnknownTx;
181 static jclass LDKAccessError_class = NULL;
182 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
183 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
184 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
185 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
186 DO_ASSERT(LDKAccessError_class != NULL);
187 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
188 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownChain != NULL);
189 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
190 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownTx != NULL);
192 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
194 case LDKAccessError_UnknownChain:
195 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
196 case LDKAccessError_UnknownTx:
197 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
202 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
203 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
204 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
205 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
209 static jclass LDKChannelMonitorUpdateErr_class = NULL;
210 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
211 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
212 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
213 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
214 DO_ASSERT(LDKChannelMonitorUpdateErr_class != NULL);
215 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
216 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
217 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
218 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
220 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
222 case LDKChannelMonitorUpdateErr_TemporaryFailure:
223 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
224 case LDKChannelMonitorUpdateErr_PermanentFailure:
225 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
230 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
231 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
232 case 0: return LDKConfirmationTarget_Background;
233 case 1: return LDKConfirmationTarget_Normal;
234 case 2: return LDKConfirmationTarget_HighPriority;
238 static jclass LDKConfirmationTarget_class = NULL;
239 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
240 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
241 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
242 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
243 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
244 DO_ASSERT(LDKConfirmationTarget_class != NULL);
245 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
246 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
247 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
248 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
252 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
254 case LDKConfirmationTarget_Background:
255 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
256 case LDKConfirmationTarget_Normal:
257 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
258 case LDKConfirmationTarget_HighPriority:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
264 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
265 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
266 case 0: return LDKLevel_Off;
267 case 1: return LDKLevel_Error;
268 case 2: return LDKLevel_Warn;
269 case 3: return LDKLevel_Info;
270 case 4: return LDKLevel_Debug;
271 case 5: return LDKLevel_Trace;
275 static jclass LDKLevel_class = NULL;
276 static jfieldID LDKLevel_LDKLevel_Off = NULL;
277 static jfieldID LDKLevel_LDKLevel_Error = NULL;
278 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
279 static jfieldID LDKLevel_LDKLevel_Info = NULL;
280 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
281 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
283 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
284 DO_ASSERT(LDKLevel_class != NULL);
285 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
286 DO_ASSERT(LDKLevel_LDKLevel_Off != NULL);
287 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
288 DO_ASSERT(LDKLevel_LDKLevel_Error != NULL);
289 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
290 DO_ASSERT(LDKLevel_LDKLevel_Warn != NULL);
291 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
292 DO_ASSERT(LDKLevel_LDKLevel_Info != NULL);
293 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
294 DO_ASSERT(LDKLevel_LDKLevel_Debug != NULL);
295 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
296 DO_ASSERT(LDKLevel_LDKLevel_Trace != NULL);
298 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
301 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
303 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
316 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
317 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
318 case 0: return LDKNetwork_Bitcoin;
319 case 1: return LDKNetwork_Testnet;
320 case 2: return LDKNetwork_Regtest;
324 static jclass LDKNetwork_class = NULL;
325 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
326 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
327 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
328 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
329 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
330 DO_ASSERT(LDKNetwork_class != NULL);
331 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
332 DO_ASSERT(LDKNetwork_LDKNetwork_Bitcoin != NULL);
333 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
334 DO_ASSERT(LDKNetwork_LDKNetwork_Testnet != NULL);
335 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
336 DO_ASSERT(LDKNetwork_LDKNetwork_Regtest != NULL);
338 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
340 case LDKNetwork_Bitcoin:
341 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
342 case LDKNetwork_Testnet:
343 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
344 case LDKNetwork_Regtest:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
350 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
351 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
352 case 0: return LDKSecp256k1Error_IncorrectSignature;
353 case 1: return LDKSecp256k1Error_InvalidMessage;
354 case 2: return LDKSecp256k1Error_InvalidPublicKey;
355 case 3: return LDKSecp256k1Error_InvalidSignature;
356 case 4: return LDKSecp256k1Error_InvalidSecretKey;
357 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
358 case 6: return LDKSecp256k1Error_InvalidTweak;
359 case 7: return LDKSecp256k1Error_NotEnoughMemory;
360 case 8: return LDKSecp256k1Error_CallbackPanicked;
364 static jclass LDKSecp256k1Error_class = NULL;
365 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
366 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
367 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
368 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
374 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
375 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
376 DO_ASSERT(LDKSecp256k1Error_class != NULL);
377 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
378 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
379 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
380 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
396 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
398 case LDKSecp256k1Error_IncorrectSignature:
399 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
400 case LDKSecp256k1Error_InvalidMessage:
401 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
402 case LDKSecp256k1Error_InvalidPublicKey:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
404 case LDKSecp256k1Error_InvalidSignature:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
406 case LDKSecp256k1Error_InvalidSecretKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
408 case LDKSecp256k1Error_InvalidRecoveryId:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
410 case LDKSecp256k1Error_InvalidTweak:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
412 case LDKSecp256k1Error_NotEnoughMemory:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
414 case LDKSecp256k1Error_CallbackPanicked:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
421 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
422 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
425 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
426 ret->datalen = (*env)->GetArrayLength(env, elems);
427 if (ret->datalen == 0) {
430 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
431 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
432 for (size_t i = 0; i < ret->datalen; i++) {
433 ret->data[i] = java_elems[i];
435 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
440 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
442 LDKTransaction b_conv = *(LDKTransaction*)b;
447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
448 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
451 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
452 if (val->result_ok) {
453 return (long)val->contents.result;
455 return (long)val->contents.err;
458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
459 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
462 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
463 if (val->result_ok) {
464 return (long)val->contents.result;
466 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
470 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
472 a_conv.inner = (void*)(a & (~1));
473 a_conv.is_owned = (a & 1) || (a == 0);
474 if (a_conv.inner != NULL)
475 a_conv = OutPoint_clone(&a_conv);
477 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
482 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
483 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
484 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
487 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
488 ret->datalen = (*env)->GetArrayLength(env, elems);
489 if (ret->datalen == 0) {
492 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
493 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
494 for (size_t i = 0; i < ret->datalen; i++) {
495 jlong arr_elem = java_elems[i];
496 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
497 FREE((void*)arr_elem);
498 ret->data[i] = arr_elem_conv;
500 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
505 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
506 LDKThirtyTwoBytes a_ref;
507 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
509 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
515 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
520 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
521 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
522 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
525 LDKCVecTempl_Signature *ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
526 ret->datalen = (*env)->GetArrayLength(env, elems);
527 if (ret->datalen == 0) {
530 ret->data = MALLOC(sizeof(LDKSignature) * ret->datalen, "LDKCVecTempl_Signature Data");
531 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
532 for (size_t i = 0; i < ret->datalen; i++) {
533 jlong arr_elem = java_elems[i];
534 LDKSignature arr_elem_conv = *(LDKSignature*)arr_elem;
535 FREE((void*)arr_elem);
536 ret->data[i] = arr_elem_conv;
538 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
543 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
544 LDKSignature a_conv = *(LDKSignature*)a;
547 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
553 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
556 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
557 if (val->result_ok) {
558 return (long)val->contents.result;
560 return (long)val->contents.err;
563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
564 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
567 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
568 if (val->result_ok) {
569 return (long)val->contents.result;
571 return (long)val->contents.err;
574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
575 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
578 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
579 if (val->result_ok) {
580 return (long)val->contents.result;
582 return (long)val->contents.err;
585 static jclass LDKAPIError_APIMisuseError_class = NULL;
586 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
587 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
588 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
589 static jclass LDKAPIError_RouteError_class = NULL;
590 static jmethodID LDKAPIError_RouteError_meth = NULL;
591 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
592 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
593 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
594 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
596 LDKAPIError_APIMisuseError_class =
597 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
598 DO_ASSERT(LDKAPIError_APIMisuseError_class != NULL);
599 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
600 DO_ASSERT(LDKAPIError_APIMisuseError_meth != NULL);
601 LDKAPIError_FeeRateTooHigh_class =
602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
603 DO_ASSERT(LDKAPIError_FeeRateTooHigh_class != NULL);
604 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
605 DO_ASSERT(LDKAPIError_FeeRateTooHigh_meth != NULL);
606 LDKAPIError_RouteError_class =
607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
608 DO_ASSERT(LDKAPIError_RouteError_class != NULL);
609 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
610 DO_ASSERT(LDKAPIError_RouteError_meth != NULL);
611 LDKAPIError_ChannelUnavailable_class =
612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
613 DO_ASSERT(LDKAPIError_ChannelUnavailable_class != NULL);
614 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
615 DO_ASSERT(LDKAPIError_ChannelUnavailable_meth != NULL);
616 LDKAPIError_MonitorUpdateFailed_class =
617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
618 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_class != NULL);
619 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
620 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_meth != NULL);
622 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
623 LDKAPIError *obj = (LDKAPIError*)ptr;
625 case LDKAPIError_APIMisuseError: {
626 long err_ref = (long)&obj->api_misuse_error.err;
627 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
629 case LDKAPIError_FeeRateTooHigh: {
630 long err_ref = (long)&obj->fee_rate_too_high.err;
631 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
633 case LDKAPIError_RouteError: {
634 long err_ref = (long)&obj->route_error.err;
635 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
637 case LDKAPIError_ChannelUnavailable: {
638 long err_ref = (long)&obj->channel_unavailable.err;
639 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
641 case LDKAPIError_MonitorUpdateFailed: {
642 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
647 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
648 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
651 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
652 if (val->result_ok) {
653 return (long)val->contents.result;
655 return (long)val->contents.err;
658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
659 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
662 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
663 if (val->result_ok) {
664 return (long)val->contents.result;
666 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *_env, jclass _b, jlong a, jlong b, jlong c) {
670 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
671 LDKChannelAnnouncement a_conv;
672 a_conv.inner = (void*)(a & (~1));
673 a_conv.is_owned = (a & 1) || (a == 0);
674 if (a_conv.inner != NULL)
675 a_conv = ChannelAnnouncement_clone(&a_conv);
677 LDKChannelUpdate b_conv;
678 b_conv.inner = (void*)(b & (~1));
679 b_conv.is_owned = (b & 1) || (b == 0);
680 if (b_conv.inner != NULL)
681 b_conv = ChannelUpdate_clone(&b_conv);
683 LDKChannelUpdate c_conv;
684 c_conv.inner = (void*)(c & (~1));
685 c_conv.is_owned = (c & 1) || (c == 0);
686 if (c_conv.inner != NULL)
687 c_conv = ChannelUpdate_clone(&c_conv);
691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
692 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
695 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
696 if (val->result_ok) {
697 return (long)val->contents.result;
699 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
703 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
704 LDKHTLCOutputInCommitment a_conv;
705 a_conv.inner = (void*)(a & (~1));
706 a_conv.is_owned = (a & 1) || (a == 0);
707 if (a_conv.inner != NULL)
708 a_conv = HTLCOutputInCommitment_clone(&a_conv);
710 LDKSignature b_conv = *(LDKSignature*)b;
715 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
716 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
717 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
718 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
719 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
720 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
722 LDKSpendableOutputDescriptor_StaticOutput_class =
723 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
724 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
725 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
726 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
727 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
728 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
729 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
730 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
731 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
732 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
733 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
734 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
735 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
736 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
738 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
739 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
741 case LDKSpendableOutputDescriptor_StaticOutput: {
742 LDKOutPoint outpoint_var = obj->static_output.outpoint;
743 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
744 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
746 if (outpoint_var.is_owned) {
747 outpoint_ref = (long)outpoint_var.inner | 1;
749 outpoint_ref = (long)&outpoint_var;
751 long output_ref = (long)&obj->static_output.output;
752 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
754 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
755 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
756 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
757 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
759 if (outpoint_var.is_owned) {
760 outpoint_ref = (long)outpoint_var.inner | 1;
762 outpoint_ref = (long)&outpoint_var;
764 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
765 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
766 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
767 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
768 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
769 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
770 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr);
772 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
773 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
774 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
775 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
777 if (outpoint_var.is_owned) {
778 outpoint_ref = (long)outpoint_var.inner | 1;
780 outpoint_ref = (long)&outpoint_var;
782 long output_ref = (long)&obj->static_output_counterparty_payment.output;
783 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
784 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
789 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
790 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
791 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
794 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
795 ret->datalen = (*env)->GetArrayLength(env, elems);
796 if (ret->datalen == 0) {
799 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
800 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
801 for (size_t i = 0; i < ret->datalen; i++) {
802 jlong arr_elem = java_elems[i];
803 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
804 FREE((void*)arr_elem);
805 ret->data[i] = arr_elem_conv;
807 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
811 static jclass LDKEvent_FundingGenerationReady_class = NULL;
812 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
813 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
814 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
815 static jclass LDKEvent_PaymentReceived_class = NULL;
816 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
817 static jclass LDKEvent_PaymentSent_class = NULL;
818 static jmethodID LDKEvent_PaymentSent_meth = NULL;
819 static jclass LDKEvent_PaymentFailed_class = NULL;
820 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
821 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
822 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
823 static jclass LDKEvent_SpendableOutputs_class = NULL;
824 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
826 LDKEvent_FundingGenerationReady_class =
827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
828 DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL);
829 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
830 DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL);
831 LDKEvent_FundingBroadcastSafe_class =
832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
833 DO_ASSERT(LDKEvent_FundingBroadcastSafe_class != NULL);
834 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
835 DO_ASSERT(LDKEvent_FundingBroadcastSafe_meth != NULL);
836 LDKEvent_PaymentReceived_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
838 DO_ASSERT(LDKEvent_PaymentReceived_class != NULL);
839 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
840 DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL);
841 LDKEvent_PaymentSent_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
843 DO_ASSERT(LDKEvent_PaymentSent_class != NULL);
844 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
845 DO_ASSERT(LDKEvent_PaymentSent_meth != NULL);
846 LDKEvent_PaymentFailed_class =
847 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
848 DO_ASSERT(LDKEvent_PaymentFailed_class != NULL);
849 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
850 DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL);
851 LDKEvent_PendingHTLCsForwardable_class =
852 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
853 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_class != NULL);
854 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
855 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_meth != NULL);
856 LDKEvent_SpendableOutputs_class =
857 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
858 DO_ASSERT(LDKEvent_SpendableOutputs_class != NULL);
859 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
860 DO_ASSERT(LDKEvent_SpendableOutputs_meth != NULL);
862 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
863 LDKEvent *obj = (LDKEvent*)ptr;
865 case LDKEvent_FundingGenerationReady: {
866 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
867 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
868 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
869 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_ref, obj->funding_generation_ready.user_channel_id);
871 case LDKEvent_FundingBroadcastSafe: {
872 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
873 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
874 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
875 long funding_txo_ref;
876 if (funding_txo_var.is_owned) {
877 funding_txo_ref = (long)funding_txo_var.inner | 1;
879 funding_txo_ref = (long)&funding_txo_var;
881 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
883 case LDKEvent_PaymentReceived: {
884 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
885 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
886 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
887 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
888 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
890 case LDKEvent_PaymentSent: {
891 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
892 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
893 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
895 case LDKEvent_PaymentFailed: {
896 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
897 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
898 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
900 case LDKEvent_PendingHTLCsForwardable: {
901 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
903 case LDKEvent_SpendableOutputs: {
904 long outputs_ref = (long)&obj->spendable_outputs.outputs;
905 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
910 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
911 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
912 static jclass LDKErrorAction_IgnoreError_class = NULL;
913 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
914 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
915 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
917 LDKErrorAction_DisconnectPeer_class =
918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
919 DO_ASSERT(LDKErrorAction_DisconnectPeer_class != NULL);
920 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
921 DO_ASSERT(LDKErrorAction_DisconnectPeer_meth != NULL);
922 LDKErrorAction_IgnoreError_class =
923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
924 DO_ASSERT(LDKErrorAction_IgnoreError_class != NULL);
925 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
926 DO_ASSERT(LDKErrorAction_IgnoreError_meth != NULL);
927 LDKErrorAction_SendErrorMessage_class =
928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
929 DO_ASSERT(LDKErrorAction_SendErrorMessage_class != NULL);
930 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
931 DO_ASSERT(LDKErrorAction_SendErrorMessage_meth != NULL);
933 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
934 LDKErrorAction *obj = (LDKErrorAction*)ptr;
936 case LDKErrorAction_DisconnectPeer: {
937 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
938 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
941 if (msg_var.is_owned) {
942 msg_ref = (long)msg_var.inner | 1;
944 msg_ref = (long)&msg_var;
946 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
948 case LDKErrorAction_IgnoreError: {
949 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
951 case LDKErrorAction_SendErrorMessage: {
952 LDKErrorMessage msg_var = obj->send_error_message.msg;
953 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
954 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
956 if (msg_var.is_owned) {
957 msg_ref = (long)msg_var.inner | 1;
959 msg_ref = (long)&msg_var;
961 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
966 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
967 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
968 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
969 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
970 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
971 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
973 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
974 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
975 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
976 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
977 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
978 LDKHTLCFailChannelUpdate_ChannelClosed_class =
979 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
980 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
981 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
982 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
983 LDKHTLCFailChannelUpdate_NodeFailure_class =
984 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
985 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
986 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
987 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
989 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
990 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
992 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
993 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
994 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
995 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 if (msg_var.is_owned) {
998 msg_ref = (long)msg_var.inner | 1;
1000 msg_ref = (long)&msg_var;
1002 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1004 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1005 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1007 case LDKHTLCFailChannelUpdate_NodeFailure: {
1008 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1009 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1010 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1015 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1016 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1017 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1018 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1019 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1020 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1021 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1022 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1023 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1024 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1025 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1026 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1027 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1028 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1029 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1030 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1031 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1032 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1033 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1034 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1035 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1036 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1037 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1038 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1039 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1040 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1041 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1042 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1043 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1044 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1045 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1046 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1048 LDKMessageSendEvent_SendAcceptChannel_class =
1049 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1050 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1051 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1052 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1053 LDKMessageSendEvent_SendOpenChannel_class =
1054 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1055 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1056 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1057 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1058 LDKMessageSendEvent_SendFundingCreated_class =
1059 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1060 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1061 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1062 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1063 LDKMessageSendEvent_SendFundingSigned_class =
1064 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1065 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1066 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1067 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1068 LDKMessageSendEvent_SendFundingLocked_class =
1069 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1070 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1071 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1072 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1073 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1075 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1076 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1077 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1078 LDKMessageSendEvent_UpdateHTLCs_class =
1079 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1080 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1081 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1082 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1083 LDKMessageSendEvent_SendRevokeAndACK_class =
1084 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1085 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1086 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1087 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1088 LDKMessageSendEvent_SendClosingSigned_class =
1089 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1090 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1091 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1092 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1093 LDKMessageSendEvent_SendShutdown_class =
1094 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1095 DO_ASSERT(LDKMessageSendEvent_SendShutdown_class != NULL);
1096 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1097 DO_ASSERT(LDKMessageSendEvent_SendShutdown_meth != NULL);
1098 LDKMessageSendEvent_SendChannelReestablish_class =
1099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1100 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1101 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1102 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1103 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1105 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1106 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1107 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1108 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1110 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1111 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1112 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1113 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1115 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1116 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1117 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1118 LDKMessageSendEvent_HandleError_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1120 DO_ASSERT(LDKMessageSendEvent_HandleError_class != NULL);
1121 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1122 DO_ASSERT(LDKMessageSendEvent_HandleError_meth != NULL);
1123 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1125 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1126 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1127 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1129 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1130 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1132 case LDKMessageSendEvent_SendAcceptChannel: {
1133 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1134 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1135 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1136 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1137 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1139 if (msg_var.is_owned) {
1140 msg_ref = (long)msg_var.inner | 1;
1142 msg_ref = (long)&msg_var;
1144 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1146 case LDKMessageSendEvent_SendOpenChannel: {
1147 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1148 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1149 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1150 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1151 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1153 if (msg_var.is_owned) {
1154 msg_ref = (long)msg_var.inner | 1;
1156 msg_ref = (long)&msg_var;
1158 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1160 case LDKMessageSendEvent_SendFundingCreated: {
1161 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1162 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1163 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1164 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1165 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1167 if (msg_var.is_owned) {
1168 msg_ref = (long)msg_var.inner | 1;
1170 msg_ref = (long)&msg_var;
1172 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1174 case LDKMessageSendEvent_SendFundingSigned: {
1175 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1176 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1177 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1178 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1179 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 if (msg_var.is_owned) {
1182 msg_ref = (long)msg_var.inner | 1;
1184 msg_ref = (long)&msg_var;
1186 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1188 case LDKMessageSendEvent_SendFundingLocked: {
1189 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1190 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1191 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1192 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1193 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 if (msg_var.is_owned) {
1196 msg_ref = (long)msg_var.inner | 1;
1198 msg_ref = (long)&msg_var;
1200 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1202 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1203 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1204 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1205 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1206 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1207 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1209 if (msg_var.is_owned) {
1210 msg_ref = (long)msg_var.inner | 1;
1212 msg_ref = (long)&msg_var;
1214 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1216 case LDKMessageSendEvent_UpdateHTLCs: {
1217 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1218 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1219 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1220 DO_ASSERT((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1221 DO_ASSERT((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1223 if (updates_var.is_owned) {
1224 updates_ref = (long)updates_var.inner | 1;
1226 updates_ref = (long)&updates_var;
1228 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1230 case LDKMessageSendEvent_SendRevokeAndACK: {
1231 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1232 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1233 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1234 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1235 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1237 if (msg_var.is_owned) {
1238 msg_ref = (long)msg_var.inner | 1;
1240 msg_ref = (long)&msg_var;
1242 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1244 case LDKMessageSendEvent_SendClosingSigned: {
1245 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1246 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1247 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1248 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1249 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1251 if (msg_var.is_owned) {
1252 msg_ref = (long)msg_var.inner | 1;
1254 msg_ref = (long)&msg_var;
1256 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1258 case LDKMessageSendEvent_SendShutdown: {
1259 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1260 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1261 LDKShutdown msg_var = obj->send_shutdown.msg;
1262 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1263 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1265 if (msg_var.is_owned) {
1266 msg_ref = (long)msg_var.inner | 1;
1268 msg_ref = (long)&msg_var;
1270 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1272 case LDKMessageSendEvent_SendChannelReestablish: {
1273 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1274 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1275 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1276 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1279 if (msg_var.is_owned) {
1280 msg_ref = (long)msg_var.inner | 1;
1282 msg_ref = (long)&msg_var;
1284 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1286 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1287 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1288 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1291 if (msg_var.is_owned) {
1292 msg_ref = (long)msg_var.inner | 1;
1294 msg_ref = (long)&msg_var;
1296 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1297 DO_ASSERT((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1298 DO_ASSERT((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1299 long update_msg_ref;
1300 if (update_msg_var.is_owned) {
1301 update_msg_ref = (long)update_msg_var.inner | 1;
1303 update_msg_ref = (long)&update_msg_var;
1305 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1307 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1308 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1309 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1310 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1312 if (msg_var.is_owned) {
1313 msg_ref = (long)msg_var.inner | 1;
1315 msg_ref = (long)&msg_var;
1317 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1319 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1320 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1321 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1322 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1324 if (msg_var.is_owned) {
1325 msg_ref = (long)msg_var.inner | 1;
1327 msg_ref = (long)&msg_var;
1329 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1331 case LDKMessageSendEvent_HandleError: {
1332 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1333 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1334 long action_ref = (long)&obj->handle_error.action;
1335 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1337 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1338 long update_ref = (long)&obj->payment_failure_network_update.update;
1339 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1344 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1345 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1346 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1349 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1350 ret->datalen = (*env)->GetArrayLength(env, elems);
1351 if (ret->datalen == 0) {
1354 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1355 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1356 for (size_t i = 0; i < ret->datalen; i++) {
1357 jlong arr_elem = java_elems[i];
1358 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1359 FREE((void*)arr_elem);
1360 ret->data[i] = arr_elem_conv;
1362 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1366 typedef struct LDKMessageSendEventsProvider_JCalls {
1367 atomic_size_t refcnt;
1370 jmethodID get_and_clear_pending_msg_events_meth;
1371 } LDKMessageSendEventsProvider_JCalls;
1372 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1373 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1376 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1377 DO_ASSERT(obj != NULL);
1378 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1379 LDKCVec_MessageSendEventZ res = *ret;
1383 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1384 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1385 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1387 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1388 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1392 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1393 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1394 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1395 return (void*) this_arg;
1397 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1398 jclass c = (*env)->GetObjectClass(env, o);
1399 DO_ASSERT(c != NULL);
1400 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1401 atomic_init(&calls->refcnt, 1);
1402 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1403 calls->o = (*env)->NewWeakGlobalRef(env, o);
1404 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1405 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1407 LDKMessageSendEventsProvider ret = {
1408 .this_arg = (void*) calls,
1409 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1410 .free = LDKMessageSendEventsProvider_JCalls_free,
1414 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1415 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1416 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1417 return (long)res_ptr;
1419 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1420 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1421 DO_ASSERT(ret != NULL);
1424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1425 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1426 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1427 *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1431 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1432 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1433 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1436 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1437 ret->datalen = (*env)->GetArrayLength(env, elems);
1438 if (ret->datalen == 0) {
1441 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1442 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1443 for (size_t i = 0; i < ret->datalen; i++) {
1444 jlong arr_elem = java_elems[i];
1445 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1446 FREE((void*)arr_elem);
1447 ret->data[i] = arr_elem_conv;
1449 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1453 typedef struct LDKEventsProvider_JCalls {
1454 atomic_size_t refcnt;
1457 jmethodID get_and_clear_pending_events_meth;
1458 } LDKEventsProvider_JCalls;
1459 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1460 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1462 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1463 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1464 DO_ASSERT(obj != NULL);
1465 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1466 LDKCVec_EventZ res = *ret;
1470 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1471 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1472 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1474 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1475 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1479 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1480 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1481 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1482 return (void*) this_arg;
1484 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1485 jclass c = (*env)->GetObjectClass(env, o);
1486 DO_ASSERT(c != NULL);
1487 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1488 atomic_init(&calls->refcnt, 1);
1489 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1490 calls->o = (*env)->NewWeakGlobalRef(env, o);
1491 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1492 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1494 LDKEventsProvider ret = {
1495 .this_arg = (void*) calls,
1496 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1497 .free = LDKEventsProvider_JCalls_free,
1501 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1502 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1503 *res_ptr = LDKEventsProvider_init(env, _a, o);
1504 return (long)res_ptr;
1506 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1507 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1508 DO_ASSERT(ret != NULL);
1511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1512 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1513 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1514 *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1518 typedef struct LDKLogger_JCalls {
1519 atomic_size_t refcnt;
1524 void log_jcall(const void* this_arg, const char *record) {
1525 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1527 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1528 jstring record_conv = (*env)->NewStringUTF(env, record);
1529 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1530 DO_ASSERT(obj != NULL);
1531 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1533 static void LDKLogger_JCalls_free(void* this_arg) {
1534 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1535 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1537 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1538 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1542 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1543 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1544 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1545 return (void*) this_arg;
1547 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1548 jclass c = (*env)->GetObjectClass(env, o);
1549 DO_ASSERT(c != NULL);
1550 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1551 atomic_init(&calls->refcnt, 1);
1552 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1553 calls->o = (*env)->NewWeakGlobalRef(env, o);
1554 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1555 DO_ASSERT(calls->log_meth != NULL);
1558 .this_arg = (void*) calls,
1560 .free = LDKLogger_JCalls_free,
1564 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1565 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1566 *res_ptr = LDKLogger_init(env, _a, o);
1567 return (long)res_ptr;
1569 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1570 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1571 DO_ASSERT(ret != NULL);
1574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1575 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1578 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1579 if (val->result_ok) {
1580 return (long)val->contents.result;
1582 return (long)val->contents.err;
1585 typedef struct LDKAccess_JCalls {
1586 atomic_size_t refcnt;
1589 jmethodID get_utxo_meth;
1591 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1592 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1594 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1595 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1596 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1597 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1598 DO_ASSERT(obj != NULL);
1599 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1600 LDKCResult_TxOutAccessErrorZ res = *ret;
1604 static void LDKAccess_JCalls_free(void* this_arg) {
1605 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1606 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1608 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1609 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1613 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1614 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1615 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1616 return (void*) this_arg;
1618 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1619 jclass c = (*env)->GetObjectClass(env, o);
1620 DO_ASSERT(c != NULL);
1621 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1622 atomic_init(&calls->refcnt, 1);
1623 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1624 calls->o = (*env)->NewWeakGlobalRef(env, o);
1625 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1626 DO_ASSERT(calls->get_utxo_meth != NULL);
1629 .this_arg = (void*) calls,
1630 .get_utxo = get_utxo_jcall,
1631 .free = LDKAccess_JCalls_free,
1635 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1636 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1637 *res_ptr = LDKAccess_init(env, _a, o);
1638 return (long)res_ptr;
1640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1641 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1642 DO_ASSERT(ret != NULL);
1645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
1646 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1647 unsigned char genesis_hash_arr[32];
1648 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1649 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1650 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1651 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1655 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1656 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1657 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1658 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1659 for (size_t i = 0; i < vec->datalen; i++) {
1660 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1661 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1663 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1667 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1668 ret->datalen = (*env)->GetArrayLength(env, elems);
1669 if (ret->datalen == 0) {
1672 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1673 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1674 for (size_t i = 0; i < ret->datalen; i++) {
1675 jlong arr_elem = java_elems[i];
1676 LDKHTLCOutputInCommitment arr_elem_conv;
1677 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1678 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1679 if (arr_elem_conv.inner != NULL)
1680 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1681 ret->data[i] = arr_elem_conv;
1683 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1687 typedef struct LDKChannelKeys_JCalls {
1688 atomic_size_t refcnt;
1691 jmethodID get_per_commitment_point_meth;
1692 jmethodID release_commitment_secret_meth;
1693 jmethodID key_derivation_params_meth;
1694 jmethodID sign_counterparty_commitment_meth;
1695 jmethodID sign_holder_commitment_meth;
1696 jmethodID sign_holder_commitment_htlc_transactions_meth;
1697 jmethodID sign_justice_transaction_meth;
1698 jmethodID sign_counterparty_htlc_transaction_meth;
1699 jmethodID sign_closing_transaction_meth;
1700 jmethodID sign_channel_announcement_meth;
1701 jmethodID on_accept_meth;
1702 } LDKChannelKeys_JCalls;
1703 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1704 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1706 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1707 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1708 DO_ASSERT(obj != NULL);
1709 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1711 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1714 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1715 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1717 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1718 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1719 DO_ASSERT(obj != NULL);
1720 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1721 LDKThirtyTwoBytes ret;
1722 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1725 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1726 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1728 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1729 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1730 DO_ASSERT(obj != NULL);
1731 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1732 LDKC2Tuple_u64u64Z res = *ret;
1736 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) {
1737 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1739 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1740 long commitment_tx_ref = (long)&commitment_tx;
1741 long htlcs_ref = (long)&htlcs;
1742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1743 DO_ASSERT(obj != NULL);
1744 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
1745 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1749 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1750 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1753 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1754 DO_ASSERT(obj != NULL);
1755 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1756 LDKCResult_SignatureNoneZ res = *ret;
1760 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1761 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1763 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1764 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1765 DO_ASSERT(obj != NULL);
1766 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1767 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1771 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc) {
1772 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1774 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1775 long justice_tx_ref = (long)&justice_tx;
1776 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1777 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1778 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1779 DO_ASSERT(obj != NULL);
1780 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1781 LDKCResult_SignatureNoneZ res = *ret;
1785 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) {
1786 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1789 long htlc_tx_ref = (long)&htlc_tx;
1790 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1791 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1792 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1793 DO_ASSERT(obj != NULL);
1794 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc);
1795 LDKCResult_SignatureNoneZ res = *ret;
1799 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1800 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1802 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1803 long closing_tx_ref = (long)&closing_tx;
1804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1805 DO_ASSERT(obj != NULL);
1806 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1807 LDKCResult_SignatureNoneZ res = *ret;
1811 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1812 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1814 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1815 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1816 DO_ASSERT(obj != NULL);
1817 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1818 LDKCResult_SignatureNoneZ res = *ret;
1822 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1823 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1825 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1826 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1827 DO_ASSERT(obj != NULL);
1828 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1830 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1831 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1832 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1834 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1835 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1839 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1840 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1841 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1842 return (void*) this_arg;
1844 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1845 jclass c = (*env)->GetObjectClass(env, o);
1846 DO_ASSERT(c != NULL);
1847 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1848 atomic_init(&calls->refcnt, 1);
1849 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1850 calls->o = (*env)->NewWeakGlobalRef(env, o);
1851 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1852 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1853 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1854 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1855 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1856 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1857 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1858 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1859 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1860 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1861 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1862 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1863 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1864 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1865 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1866 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1867 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1868 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1869 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1870 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1871 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1872 DO_ASSERT(calls->on_accept_meth != NULL);
1874 LDKChannelKeys ret = {
1875 .this_arg = (void*) calls,
1876 .get_per_commitment_point = get_per_commitment_point_jcall,
1877 .release_commitment_secret = release_commitment_secret_jcall,
1878 .key_derivation_params = key_derivation_params_jcall,
1879 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1880 .sign_holder_commitment = sign_holder_commitment_jcall,
1881 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1882 .sign_justice_transaction = sign_justice_transaction_jcall,
1883 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1884 .sign_closing_transaction = sign_closing_transaction_jcall,
1885 .sign_channel_announcement = sign_channel_announcement_jcall,
1886 .on_accept = on_accept_jcall,
1887 .clone = LDKChannelKeys_JCalls_clone,
1888 .free = LDKChannelKeys_JCalls_free,
1892 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1893 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1894 *res_ptr = LDKChannelKeys_init(env, _a, o);
1895 return (long)res_ptr;
1897 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1898 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1899 DO_ASSERT(ret != NULL);
1902 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1903 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1904 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1905 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1909 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1910 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1911 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1912 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1917 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1918 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1919 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1924 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1925 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1926 FREE((void*)commitment_tx);
1927 LDKPreCalculatedTxCreationKeys keys_conv;
1928 keys_conv.inner = (void*)(keys & (~1));
1929 keys_conv.is_owned = (keys & 1) || (keys == 0);
1930 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1932 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1933 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1938 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1939 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1940 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1941 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1942 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1943 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1948 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1949 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1950 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1951 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1952 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1953 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1958 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1959 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1960 FREE((void*)justice_tx);
1961 unsigned char per_commitment_key_arr[32];
1962 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1963 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1964 LDKHTLCOutputInCommitment htlc_conv;
1965 htlc_conv.inner = (void*)(htlc & (~1));
1966 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1967 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1968 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1973 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1974 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1975 FREE((void*)htlc_tx);
1976 LDKPublicKey per_commitment_point_ref;
1977 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1978 LDKHTLCOutputInCommitment htlc_conv;
1979 htlc_conv.inner = (void*)(htlc & (~1));
1980 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1981 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1982 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
1987 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1988 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1989 FREE((void*)closing_tx);
1990 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1991 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
1995 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
1996 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1997 LDKUnsignedChannelAnnouncement msg_conv;
1998 msg_conv.inner = (void*)(msg & (~1));
1999 msg_conv.is_owned = (msg & 1) || (msg == 0);
2000 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2001 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
2006 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2007 LDKChannelPublicKeys channel_points_conv;
2008 channel_points_conv.inner = (void*)(channel_points & (~1));
2009 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2010 return (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2013 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2014 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2015 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2016 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2017 for (size_t i = 0; i < vec->datalen; i++) {
2018 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2019 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2021 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2025 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2026 ret->datalen = (*env)->GetArrayLength(env, elems);
2027 if (ret->datalen == 0) {
2030 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2031 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2032 for (size_t i = 0; i < ret->datalen; i++) {
2033 jlong arr_elem = java_elems[i];
2034 LDKMonitorEvent arr_elem_conv;
2035 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2036 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2037 ret->data[i] = arr_elem_conv;
2039 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2043 typedef struct LDKWatch_JCalls {
2044 atomic_size_t refcnt;
2047 jmethodID watch_channel_meth;
2048 jmethodID update_channel_meth;
2049 jmethodID release_pending_monitor_events_meth;
2051 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2052 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2054 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2055 LDKOutPoint funding_txo_var = funding_txo;
2056 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2057 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2058 long funding_txo_ref;
2059 if (funding_txo_var.is_owned) {
2060 funding_txo_ref = (long)funding_txo_var.inner | 1;
2062 funding_txo_ref = (long)&funding_txo_var;
2064 LDKChannelMonitor monitor_var = monitor;
2065 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2066 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2068 if (monitor_var.is_owned) {
2069 monitor_ref = (long)monitor_var.inner | 1;
2071 monitor_ref = (long)&monitor_var;
2073 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2074 DO_ASSERT(obj != NULL);
2075 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2076 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2080 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2081 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2083 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2084 LDKOutPoint funding_txo_var = funding_txo;
2085 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2086 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2087 long funding_txo_ref;
2088 if (funding_txo_var.is_owned) {
2089 funding_txo_ref = (long)funding_txo_var.inner | 1;
2091 funding_txo_ref = (long)&funding_txo_var;
2093 LDKChannelMonitorUpdate update_var = update;
2094 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2095 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2097 if (update_var.is_owned) {
2098 update_ref = (long)update_var.inner | 1;
2100 update_ref = (long)&update_var;
2102 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2103 DO_ASSERT(obj != NULL);
2104 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2105 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2109 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2110 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2112 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2114 DO_ASSERT(obj != NULL);
2115 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2116 LDKCVec_MonitorEventZ res = *ret;
2120 static void LDKWatch_JCalls_free(void* this_arg) {
2121 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2122 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2124 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2125 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2129 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2130 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2131 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2132 return (void*) this_arg;
2134 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2135 jclass c = (*env)->GetObjectClass(env, o);
2136 DO_ASSERT(c != NULL);
2137 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2138 atomic_init(&calls->refcnt, 1);
2139 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2140 calls->o = (*env)->NewWeakGlobalRef(env, o);
2141 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2142 DO_ASSERT(calls->watch_channel_meth != NULL);
2143 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2144 DO_ASSERT(calls->update_channel_meth != NULL);
2145 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2146 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2149 .this_arg = (void*) calls,
2150 .watch_channel = watch_channel_jcall,
2151 .update_channel = update_channel_jcall,
2152 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2153 .free = LDKWatch_JCalls_free,
2157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2158 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2159 *res_ptr = LDKWatch_init(env, _a, o);
2160 return (long)res_ptr;
2162 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2163 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2164 DO_ASSERT(ret != NULL);
2167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2168 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2169 LDKOutPoint funding_txo_conv;
2170 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2171 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2172 if (funding_txo_conv.inner != NULL)
2173 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2174 LDKChannelMonitor monitor_conv;
2175 monitor_conv.inner = (void*)(monitor & (~1));
2176 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2177 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2178 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2183 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2184 LDKOutPoint funding_txo_conv;
2185 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2186 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2187 if (funding_txo_conv.inner != NULL)
2188 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2189 LDKChannelMonitorUpdate update_conv;
2190 update_conv.inner = (void*)(update & (~1));
2191 update_conv.is_owned = (update & 1) || (update == 0);
2192 if (update_conv.inner != NULL)
2193 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2194 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2195 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2200 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2201 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2202 *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2206 typedef struct LDKFilter_JCalls {
2207 atomic_size_t refcnt;
2210 jmethodID register_tx_meth;
2211 jmethodID register_output_meth;
2213 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2214 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2216 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2217 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2218 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2219 long script_pubkey_ref = (long)&script_pubkey;
2220 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2221 DO_ASSERT(obj != NULL);
2222 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2224 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2225 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2227 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2228 long script_pubkey_ref = (long)&script_pubkey;
2229 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2230 DO_ASSERT(obj != NULL);
2231 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2233 static void LDKFilter_JCalls_free(void* this_arg) {
2234 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2235 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2237 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2238 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2242 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2243 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2244 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2245 return (void*) this_arg;
2247 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2248 jclass c = (*env)->GetObjectClass(env, o);
2249 DO_ASSERT(c != NULL);
2250 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2251 atomic_init(&calls->refcnt, 1);
2252 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2253 calls->o = (*env)->NewWeakGlobalRef(env, o);
2254 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2255 DO_ASSERT(calls->register_tx_meth != NULL);
2256 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2257 DO_ASSERT(calls->register_output_meth != NULL);
2260 .this_arg = (void*) calls,
2261 .register_tx = register_tx_jcall,
2262 .register_output = register_output_jcall,
2263 .free = LDKFilter_JCalls_free,
2267 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2268 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2269 *res_ptr = LDKFilter_init(env, _a, o);
2270 return (long)res_ptr;
2272 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2273 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2274 DO_ASSERT(ret != NULL);
2277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jlong script_pubkey) {
2278 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2279 unsigned char txid_arr[32];
2280 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2281 unsigned char (*txid_ref)[32] = &txid_arr;
2282 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2283 return (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_conv);
2286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jlong script_pubkey) {
2287 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2288 LDKOutPoint outpoint_conv;
2289 outpoint_conv.inner = (void*)(outpoint & (~1));
2290 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2291 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2292 return (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2295 typedef struct LDKBroadcasterInterface_JCalls {
2296 atomic_size_t refcnt;
2299 jmethodID broadcast_transaction_meth;
2300 } LDKBroadcasterInterface_JCalls;
2301 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2302 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2304 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2305 long tx_ref = (long)&tx;
2306 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2307 DO_ASSERT(obj != NULL);
2308 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2310 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2311 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2312 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2314 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2315 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2319 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2320 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2321 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2322 return (void*) this_arg;
2324 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2325 jclass c = (*env)->GetObjectClass(env, o);
2326 DO_ASSERT(c != NULL);
2327 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2328 atomic_init(&calls->refcnt, 1);
2329 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2330 calls->o = (*env)->NewWeakGlobalRef(env, o);
2331 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2332 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2334 LDKBroadcasterInterface ret = {
2335 .this_arg = (void*) calls,
2336 .broadcast_transaction = broadcast_transaction_jcall,
2337 .free = LDKBroadcasterInterface_JCalls_free,
2341 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2342 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2343 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2344 return (long)res_ptr;
2346 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2347 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2348 DO_ASSERT(ret != NULL);
2351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2352 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2353 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2355 return (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2358 typedef struct LDKFeeEstimator_JCalls {
2359 atomic_size_t refcnt;
2362 jmethodID get_est_sat_per_1000_weight_meth;
2363 } LDKFeeEstimator_JCalls;
2364 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2365 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2367 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2368 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2369 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2370 DO_ASSERT(obj != NULL);
2371 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2373 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2374 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2375 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2377 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2378 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2382 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2383 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2384 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2385 return (void*) this_arg;
2387 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2388 jclass c = (*env)->GetObjectClass(env, o);
2389 DO_ASSERT(c != NULL);
2390 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2391 atomic_init(&calls->refcnt, 1);
2392 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2393 calls->o = (*env)->NewWeakGlobalRef(env, o);
2394 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2395 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2397 LDKFeeEstimator ret = {
2398 .this_arg = (void*) calls,
2399 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2400 .free = LDKFeeEstimator_JCalls_free,
2404 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2405 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2406 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2407 return (long)res_ptr;
2409 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2410 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2411 DO_ASSERT(ret != NULL);
2414 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong this_arg, jclass confirmation_target) {
2415 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2416 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2417 return (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2421 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2422 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2425 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2426 ret->datalen = (*env)->GetArrayLength(env, elems);
2427 if (ret->datalen == 0) {
2430 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2431 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2432 for (size_t i = 0; i < ret->datalen; i++) {
2433 jlong arr_elem = java_elems[i];
2434 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2435 FREE((void*)arr_elem);
2436 ret->data[i] = arr_elem_conv;
2438 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2442 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2443 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2444 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2447 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2448 ret->datalen = (*env)->GetArrayLength(env, elems);
2449 if (ret->datalen == 0) {
2452 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2453 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2454 for (size_t i = 0; i < ret->datalen; i++) {
2455 jlong arr_elem = java_elems[i];
2456 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2457 FREE((void*)arr_elem);
2458 ret->data[i] = arr_elem_conv;
2460 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2464 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2465 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2466 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2469 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2470 ret->datalen = (*env)->GetArrayLength(env, elems);
2471 if (ret->datalen == 0) {
2474 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2475 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2476 for (size_t i = 0; i < ret->datalen; i++) {
2477 jlong arr_elem = java_elems[i];
2478 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2479 FREE((void*)arr_elem);
2480 ret->data[i] = arr_elem_conv;
2482 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2486 typedef struct LDKKeysInterface_JCalls {
2487 atomic_size_t refcnt;
2490 jmethodID get_node_secret_meth;
2491 jmethodID get_destination_script_meth;
2492 jmethodID get_shutdown_pubkey_meth;
2493 jmethodID get_channel_keys_meth;
2494 jmethodID get_secure_random_bytes_meth;
2495 } LDKKeysInterface_JCalls;
2496 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2497 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2499 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2500 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2501 DO_ASSERT(obj != NULL);
2502 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2504 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes);
2507 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2508 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2510 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2511 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2512 DO_ASSERT(obj != NULL);
2513 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2514 LDKCVec_u8Z res = *ret;
2518 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2519 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2521 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2522 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2523 DO_ASSERT(obj != NULL);
2524 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2526 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2529 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2530 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2532 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2533 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2534 DO_ASSERT(obj != NULL);
2535 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2536 LDKChannelKeys res = *ret;
2540 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2541 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2543 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2544 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2545 DO_ASSERT(obj != NULL);
2546 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2547 LDKThirtyTwoBytes ret;
2548 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2551 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2552 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2553 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2555 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2556 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2560 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2561 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2562 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2563 return (void*) this_arg;
2565 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2566 jclass c = (*env)->GetObjectClass(env, o);
2567 DO_ASSERT(c != NULL);
2568 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2569 atomic_init(&calls->refcnt, 1);
2570 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2571 calls->o = (*env)->NewWeakGlobalRef(env, o);
2572 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2573 DO_ASSERT(calls->get_node_secret_meth != NULL);
2574 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2575 DO_ASSERT(calls->get_destination_script_meth != NULL);
2576 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2577 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2578 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2579 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2580 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2581 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2583 LDKKeysInterface ret = {
2584 .this_arg = (void*) calls,
2585 .get_node_secret = get_node_secret_jcall,
2586 .get_destination_script = get_destination_script_jcall,
2587 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2588 .get_channel_keys = get_channel_keys_jcall,
2589 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2590 .free = LDKKeysInterface_JCalls_free,
2594 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2595 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2596 *res_ptr = LDKKeysInterface_init(env, _a, o);
2597 return (long)res_ptr;
2599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2600 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2601 DO_ASSERT(ret != NULL);
2604 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2605 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2606 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2607 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2612 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2613 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2614 *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2619 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2620 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2621 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jboolean inbound, jlong channel_value_satoshis) {
2626 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2627 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2628 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2633 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2634 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2635 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2639 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2640 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2641 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2642 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2643 for (size_t i = 0; i < vec->datalen; i++) {
2644 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2645 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2647 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2651 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2652 ret->datalen = (*env)->GetArrayLength(env, elems);
2653 if (ret->datalen == 0) {
2656 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2657 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2658 for (size_t i = 0; i < ret->datalen; i++) {
2659 jlong arr_elem = java_elems[i];
2660 LDKChannelDetails arr_elem_conv;
2661 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2662 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2663 ret->data[i] = arr_elem_conv;
2665 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2669 static jclass LDKNetAddress_IPv4_class = NULL;
2670 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2671 static jclass LDKNetAddress_IPv6_class = NULL;
2672 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2673 static jclass LDKNetAddress_OnionV2_class = NULL;
2674 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2675 static jclass LDKNetAddress_OnionV3_class = NULL;
2676 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2678 LDKNetAddress_IPv4_class =
2679 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2680 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2681 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2682 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2683 LDKNetAddress_IPv6_class =
2684 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2685 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2686 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2687 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2688 LDKNetAddress_OnionV2_class =
2689 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2690 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2691 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2692 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2693 LDKNetAddress_OnionV3_class =
2694 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2695 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2696 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2697 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2699 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2700 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2702 case LDKNetAddress_IPv4: {
2703 long addr_ref = (long)&obj->i_pv4.addr;
2704 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2706 case LDKNetAddress_IPv6: {
2707 long addr_ref = (long)&obj->i_pv6.addr;
2708 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2710 case LDKNetAddress_OnionV2: {
2711 long addr_ref = (long)&obj->onion_v2.addr;
2712 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2714 case LDKNetAddress_OnionV3: {
2715 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2716 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2717 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);
2722 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2723 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2724 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2727 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2728 ret->datalen = (*env)->GetArrayLength(env, elems);
2729 if (ret->datalen == 0) {
2732 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2733 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2734 for (size_t i = 0; i < ret->datalen; i++) {
2735 jlong arr_elem = java_elems[i];
2736 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2737 FREE((void*)arr_elem);
2738 ret->data[i] = arr_elem_conv;
2740 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2744 typedef struct LDKChannelMessageHandler_JCalls {
2745 atomic_size_t refcnt;
2748 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2749 jmethodID handle_open_channel_meth;
2750 jmethodID handle_accept_channel_meth;
2751 jmethodID handle_funding_created_meth;
2752 jmethodID handle_funding_signed_meth;
2753 jmethodID handle_funding_locked_meth;
2754 jmethodID handle_shutdown_meth;
2755 jmethodID handle_closing_signed_meth;
2756 jmethodID handle_update_add_htlc_meth;
2757 jmethodID handle_update_fulfill_htlc_meth;
2758 jmethodID handle_update_fail_htlc_meth;
2759 jmethodID handle_update_fail_malformed_htlc_meth;
2760 jmethodID handle_commitment_signed_meth;
2761 jmethodID handle_revoke_and_ack_meth;
2762 jmethodID handle_update_fee_meth;
2763 jmethodID handle_announcement_signatures_meth;
2764 jmethodID peer_disconnected_meth;
2765 jmethodID peer_connected_meth;
2766 jmethodID handle_channel_reestablish_meth;
2767 jmethodID handle_error_meth;
2768 } LDKChannelMessageHandler_JCalls;
2769 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2770 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2772 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2773 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2774 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2775 LDKInitFeatures their_features_var = their_features;
2776 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2777 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2778 long their_features_ref;
2779 if (their_features_var.is_owned) {
2780 their_features_ref = (long)their_features_var.inner | 1;
2782 their_features_ref = (long)&their_features_var;
2784 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2785 DO_ASSERT(obj != NULL);
2786 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2788 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2789 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2791 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2792 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2793 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2794 LDKInitFeatures their_features_var = their_features;
2795 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2796 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2797 long their_features_ref;
2798 if (their_features_var.is_owned) {
2799 their_features_ref = (long)their_features_var.inner | 1;
2801 their_features_ref = (long)&their_features_var;
2803 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2804 DO_ASSERT(obj != NULL);
2805 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2807 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2808 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2810 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2811 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2812 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2813 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2814 DO_ASSERT(obj != NULL);
2815 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2817 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2818 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2820 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2821 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2822 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2823 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2824 DO_ASSERT(obj != NULL);
2825 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2827 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2828 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2830 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2831 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2832 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2833 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2834 DO_ASSERT(obj != NULL);
2835 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2837 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2838 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2840 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2841 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2842 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2843 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2844 DO_ASSERT(obj != NULL);
2845 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2847 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2848 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2850 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2851 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2852 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2853 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2854 DO_ASSERT(obj != NULL);
2855 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2857 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2858 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2860 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2861 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2862 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2863 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2864 DO_ASSERT(obj != NULL);
2865 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2867 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2868 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2870 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2871 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2872 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2873 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2874 DO_ASSERT(obj != NULL);
2875 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2877 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2878 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2880 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2881 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2882 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2883 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2884 DO_ASSERT(obj != NULL);
2885 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2887 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2888 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2890 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2891 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2892 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2893 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2894 DO_ASSERT(obj != NULL);
2895 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2897 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2898 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2900 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2901 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2902 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2903 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2904 DO_ASSERT(obj != NULL);
2905 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2907 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2908 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2910 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2911 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2912 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2913 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2914 DO_ASSERT(obj != NULL);
2915 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2917 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2918 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2920 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2921 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2922 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2923 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2924 DO_ASSERT(obj != NULL);
2925 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2927 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2928 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2930 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2931 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2932 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2933 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2934 DO_ASSERT(obj != NULL);
2935 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2937 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2938 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2940 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2941 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2942 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2943 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2944 DO_ASSERT(obj != NULL);
2945 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2947 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2948 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2950 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2951 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2952 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2953 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2954 DO_ASSERT(obj != NULL);
2955 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
2957 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2958 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2960 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2961 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2962 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2963 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2964 DO_ASSERT(obj != NULL);
2965 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2967 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2968 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2970 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2971 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2972 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2973 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2974 DO_ASSERT(obj != NULL);
2975 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
2977 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2978 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2979 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2981 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2982 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2986 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2988 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2989 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2990 return (void*) this_arg;
2992 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2993 jclass c = (*env)->GetObjectClass(env, o);
2994 DO_ASSERT(c != NULL);
2995 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
2996 atomic_init(&calls->refcnt, 1);
2997 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2998 calls->o = (*env)->NewWeakGlobalRef(env, o);
2999 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3000 DO_ASSERT(calls->handle_open_channel_meth != NULL);
3001 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3002 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
3003 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3004 DO_ASSERT(calls->handle_funding_created_meth != NULL);
3005 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3006 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
3007 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3008 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
3009 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3010 DO_ASSERT(calls->handle_shutdown_meth != NULL);
3011 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3012 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
3013 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3014 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
3015 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3016 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
3017 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3018 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
3019 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3020 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
3021 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3022 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
3023 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3024 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
3025 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3026 DO_ASSERT(calls->handle_update_fee_meth != NULL);
3027 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3028 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
3029 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3030 DO_ASSERT(calls->peer_disconnected_meth != NULL);
3031 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3032 DO_ASSERT(calls->peer_connected_meth != NULL);
3033 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3034 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
3035 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3036 DO_ASSERT(calls->handle_error_meth != NULL);
3038 LDKChannelMessageHandler ret = {
3039 .this_arg = (void*) calls,
3040 .handle_open_channel = handle_open_channel_jcall,
3041 .handle_accept_channel = handle_accept_channel_jcall,
3042 .handle_funding_created = handle_funding_created_jcall,
3043 .handle_funding_signed = handle_funding_signed_jcall,
3044 .handle_funding_locked = handle_funding_locked_jcall,
3045 .handle_shutdown = handle_shutdown_jcall,
3046 .handle_closing_signed = handle_closing_signed_jcall,
3047 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3048 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3049 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3050 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3051 .handle_commitment_signed = handle_commitment_signed_jcall,
3052 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3053 .handle_update_fee = handle_update_fee_jcall,
3054 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3055 .peer_disconnected = peer_disconnected_jcall,
3056 .peer_connected = peer_connected_jcall,
3057 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3058 .handle_error = handle_error_jcall,
3059 .free = LDKChannelMessageHandler_JCalls_free,
3060 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3062 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3065 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3066 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3067 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3068 return (long)res_ptr;
3070 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3071 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3072 DO_ASSERT(ret != NULL);
3075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3076 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3077 LDKPublicKey their_node_id_ref;
3078 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3079 LDKInitFeatures their_features_conv;
3080 their_features_conv.inner = (void*)(their_features & (~1));
3081 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3082 LDKOpenChannel msg_conv;
3083 msg_conv.inner = (void*)(msg & (~1));
3084 msg_conv.is_owned = (msg & 1) || (msg == 0);
3085 return (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3089 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3090 LDKPublicKey their_node_id_ref;
3091 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3092 LDKInitFeatures their_features_conv;
3093 their_features_conv.inner = (void*)(their_features & (~1));
3094 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3095 LDKAcceptChannel msg_conv;
3096 msg_conv.inner = (void*)(msg & (~1));
3097 msg_conv.is_owned = (msg & 1) || (msg == 0);
3098 return (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3102 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3103 LDKPublicKey their_node_id_ref;
3104 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3105 LDKFundingCreated msg_conv;
3106 msg_conv.inner = (void*)(msg & (~1));
3107 msg_conv.is_owned = (msg & 1) || (msg == 0);
3108 return (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3112 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3113 LDKPublicKey their_node_id_ref;
3114 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3115 LDKFundingSigned msg_conv;
3116 msg_conv.inner = (void*)(msg & (~1));
3117 msg_conv.is_owned = (msg & 1) || (msg == 0);
3118 return (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3122 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3123 LDKPublicKey their_node_id_ref;
3124 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3125 LDKFundingLocked msg_conv;
3126 msg_conv.inner = (void*)(msg & (~1));
3127 msg_conv.is_owned = (msg & 1) || (msg == 0);
3128 return (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3132 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3133 LDKPublicKey their_node_id_ref;
3134 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3135 LDKShutdown msg_conv;
3136 msg_conv.inner = (void*)(msg & (~1));
3137 msg_conv.is_owned = (msg & 1) || (msg == 0);
3138 return (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3142 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3143 LDKPublicKey their_node_id_ref;
3144 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3145 LDKClosingSigned msg_conv;
3146 msg_conv.inner = (void*)(msg & (~1));
3147 msg_conv.is_owned = (msg & 1) || (msg == 0);
3148 return (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3152 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3153 LDKPublicKey their_node_id_ref;
3154 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3155 LDKUpdateAddHTLC msg_conv;
3156 msg_conv.inner = (void*)(msg & (~1));
3157 msg_conv.is_owned = (msg & 1) || (msg == 0);
3158 return (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3162 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3163 LDKPublicKey their_node_id_ref;
3164 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3165 LDKUpdateFulfillHTLC msg_conv;
3166 msg_conv.inner = (void*)(msg & (~1));
3167 msg_conv.is_owned = (msg & 1) || (msg == 0);
3168 return (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3172 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3173 LDKPublicKey their_node_id_ref;
3174 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3175 LDKUpdateFailHTLC msg_conv;
3176 msg_conv.inner = (void*)(msg & (~1));
3177 msg_conv.is_owned = (msg & 1) || (msg == 0);
3178 return (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3182 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3183 LDKPublicKey their_node_id_ref;
3184 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3185 LDKUpdateFailMalformedHTLC msg_conv;
3186 msg_conv.inner = (void*)(msg & (~1));
3187 msg_conv.is_owned = (msg & 1) || (msg == 0);
3188 return (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3192 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3193 LDKPublicKey their_node_id_ref;
3194 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3195 LDKCommitmentSigned msg_conv;
3196 msg_conv.inner = (void*)(msg & (~1));
3197 msg_conv.is_owned = (msg & 1) || (msg == 0);
3198 return (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3202 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3203 LDKPublicKey their_node_id_ref;
3204 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3205 LDKRevokeAndACK msg_conv;
3206 msg_conv.inner = (void*)(msg & (~1));
3207 msg_conv.is_owned = (msg & 1) || (msg == 0);
3208 return (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3212 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3213 LDKPublicKey their_node_id_ref;
3214 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3215 LDKUpdateFee msg_conv;
3216 msg_conv.inner = (void*)(msg & (~1));
3217 msg_conv.is_owned = (msg & 1) || (msg == 0);
3218 return (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3222 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3223 LDKPublicKey their_node_id_ref;
3224 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3225 LDKAnnouncementSignatures msg_conv;
3226 msg_conv.inner = (void*)(msg & (~1));
3227 msg_conv.is_owned = (msg & 1) || (msg == 0);
3228 return (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jboolean no_connection_possible) {
3232 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3233 LDKPublicKey their_node_id_ref;
3234 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3235 return (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3239 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3240 LDKPublicKey their_node_id_ref;
3241 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3243 msg_conv.inner = (void*)(msg & (~1));
3244 msg_conv.is_owned = (msg & 1) || (msg == 0);
3245 return (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3249 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3250 LDKPublicKey their_node_id_ref;
3251 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3252 LDKChannelReestablish msg_conv;
3253 msg_conv.inner = (void*)(msg & (~1));
3254 msg_conv.is_owned = (msg & 1) || (msg == 0);
3255 return (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3259 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3260 LDKPublicKey their_node_id_ref;
3261 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3262 LDKErrorMessage msg_conv;
3263 msg_conv.inner = (void*)(msg & (~1));
3264 msg_conv.is_owned = (msg & 1) || (msg == 0);
3265 return (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3268 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3269 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3270 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3271 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3272 for (size_t i = 0; i < vec->datalen; i++) {
3273 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3274 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3276 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3280 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3281 ret->datalen = (*env)->GetArrayLength(env, elems);
3282 if (ret->datalen == 0) {
3285 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3286 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3287 for (size_t i = 0; i < ret->datalen; i++) {
3288 jlong arr_elem = java_elems[i];
3289 LDKChannelMonitor arr_elem_conv;
3290 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3291 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3292 ret->data[i] = arr_elem_conv;
3294 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3298 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3299 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3300 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3302 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3303 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3304 ret->datalen = (*env)->GetArrayLength(env, elems);
3305 if (ret->datalen == 0) {
3308 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3309 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3310 for (size_t i = 0; i < ret->datalen; i++) {
3311 ret->data[i] = java_elems[i];
3313 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3317 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3318 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3319 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3320 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3321 for (size_t i = 0; i < vec->datalen; i++) {
3322 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3323 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3325 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3329 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3330 ret->datalen = (*env)->GetArrayLength(env, elems);
3331 if (ret->datalen == 0) {
3334 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3335 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3336 for (size_t i = 0; i < ret->datalen; i++) {
3337 jlong arr_elem = java_elems[i];
3338 LDKUpdateAddHTLC arr_elem_conv;
3339 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3340 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3341 if (arr_elem_conv.inner != NULL)
3342 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3343 ret->data[i] = arr_elem_conv;
3345 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3349 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3350 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3351 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3352 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3353 for (size_t i = 0; i < vec->datalen; i++) {
3354 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3355 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3357 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3361 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3362 ret->datalen = (*env)->GetArrayLength(env, elems);
3363 if (ret->datalen == 0) {
3366 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3367 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3368 for (size_t i = 0; i < ret->datalen; i++) {
3369 jlong arr_elem = java_elems[i];
3370 LDKUpdateFulfillHTLC arr_elem_conv;
3371 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3372 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3373 if (arr_elem_conv.inner != NULL)
3374 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3375 ret->data[i] = arr_elem_conv;
3377 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3381 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3382 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3383 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3384 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3385 for (size_t i = 0; i < vec->datalen; i++) {
3386 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3387 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3389 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3393 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3394 ret->datalen = (*env)->GetArrayLength(env, elems);
3395 if (ret->datalen == 0) {
3398 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3399 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3400 for (size_t i = 0; i < ret->datalen; i++) {
3401 jlong arr_elem = java_elems[i];
3402 LDKUpdateFailHTLC arr_elem_conv;
3403 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3404 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3405 if (arr_elem_conv.inner != NULL)
3406 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3407 ret->data[i] = arr_elem_conv;
3409 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3413 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3414 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3415 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3416 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3417 for (size_t i = 0; i < vec->datalen; i++) {
3418 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3419 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3421 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3425 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3426 ret->datalen = (*env)->GetArrayLength(env, elems);
3427 if (ret->datalen == 0) {
3430 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3431 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3432 for (size_t i = 0; i < ret->datalen; i++) {
3433 jlong arr_elem = java_elems[i];
3434 LDKUpdateFailMalformedHTLC arr_elem_conv;
3435 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3436 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3437 if (arr_elem_conv.inner != NULL)
3438 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3439 ret->data[i] = arr_elem_conv;
3441 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3445 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3446 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3449 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3450 if (val->result_ok) {
3451 return (long)val->contents.result;
3453 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3456 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3457 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3458 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3461 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3462 ret->datalen = (*env)->GetArrayLength(env, elems);
3463 if (ret->datalen == 0) {
3466 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3467 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3468 for (size_t i = 0; i < ret->datalen; i++) {
3469 jlong arr_elem = java_elems[i];
3470 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3471 FREE((void*)arr_elem);
3472 ret->data[i] = arr_elem_conv;
3474 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3478 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3479 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3480 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3481 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3482 for (size_t i = 0; i < vec->datalen; i++) {
3483 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3484 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3486 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3490 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3491 ret->datalen = (*env)->GetArrayLength(env, elems);
3492 if (ret->datalen == 0) {
3495 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3496 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3497 for (size_t i = 0; i < ret->datalen; i++) {
3498 jlong arr_elem = java_elems[i];
3499 LDKNodeAnnouncement arr_elem_conv;
3500 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3501 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3502 if (arr_elem_conv.inner != NULL)
3503 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3504 ret->data[i] = arr_elem_conv;
3506 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3510 typedef struct LDKRoutingMessageHandler_JCalls {
3511 atomic_size_t refcnt;
3514 jmethodID handle_node_announcement_meth;
3515 jmethodID handle_channel_announcement_meth;
3516 jmethodID handle_channel_update_meth;
3517 jmethodID handle_htlc_fail_channel_update_meth;
3518 jmethodID get_next_channel_announcements_meth;
3519 jmethodID get_next_node_announcements_meth;
3520 jmethodID should_request_full_sync_meth;
3521 } LDKRoutingMessageHandler_JCalls;
3522 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3523 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3525 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3526 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3527 DO_ASSERT(obj != NULL);
3528 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3529 LDKCResult_boolLightningErrorZ res = *ret;
3533 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3534 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3536 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3537 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3538 DO_ASSERT(obj != NULL);
3539 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3540 LDKCResult_boolLightningErrorZ res = *ret;
3544 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3545 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3547 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3549 DO_ASSERT(obj != NULL);
3550 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3551 LDKCResult_boolLightningErrorZ res = *ret;
3555 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3556 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3558 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3559 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3560 DO_ASSERT(obj != NULL);
3561 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3563 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3564 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3566 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3567 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3568 DO_ASSERT(obj != NULL);
3569 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3570 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3574 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3575 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3577 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3578 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3579 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3580 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3581 DO_ASSERT(obj != NULL);
3582 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3583 LDKCVec_NodeAnnouncementZ res = *ret;
3587 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3588 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3590 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3591 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3592 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3594 DO_ASSERT(obj != NULL);
3595 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3597 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3598 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3601 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3602 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3606 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3607 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3608 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3609 return (void*) this_arg;
3611 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3612 jclass c = (*env)->GetObjectClass(env, o);
3613 DO_ASSERT(c != NULL);
3614 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3615 atomic_init(&calls->refcnt, 1);
3616 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3617 calls->o = (*env)->NewWeakGlobalRef(env, o);
3618 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3619 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3620 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3621 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3622 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3623 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3624 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3625 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3626 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3627 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3628 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3629 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3630 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3631 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3633 LDKRoutingMessageHandler ret = {
3634 .this_arg = (void*) calls,
3635 .handle_node_announcement = handle_node_announcement_jcall,
3636 .handle_channel_announcement = handle_channel_announcement_jcall,
3637 .handle_channel_update = handle_channel_update_jcall,
3638 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3639 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3640 .get_next_node_announcements = get_next_node_announcements_jcall,
3641 .should_request_full_sync = should_request_full_sync_jcall,
3642 .free = LDKRoutingMessageHandler_JCalls_free,
3646 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3647 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3648 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3649 return (long)res_ptr;
3651 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3652 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3653 DO_ASSERT(ret != NULL);
3656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3657 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3658 LDKNodeAnnouncement msg_conv;
3659 msg_conv.inner = (void*)(msg & (~1));
3660 msg_conv.is_owned = (msg & 1) || (msg == 0);
3661 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3662 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3667 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3668 LDKChannelAnnouncement msg_conv;
3669 msg_conv.inner = (void*)(msg & (~1));
3670 msg_conv.is_owned = (msg & 1) || (msg == 0);
3671 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3672 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3677 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3678 LDKChannelUpdate msg_conv;
3679 msg_conv.inner = (void*)(msg & (~1));
3680 msg_conv.is_owned = (msg & 1) || (msg == 0);
3681 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3682 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3687 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3688 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3689 return (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) {
3693 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3694 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3695 *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) {
3700 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3701 LDKPublicKey starting_point_ref;
3702 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3703 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3704 *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3709 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3710 LDKPublicKey node_id_ref;
3711 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3712 return (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3715 typedef struct LDKSocketDescriptor_JCalls {
3716 atomic_size_t refcnt;
3719 jmethodID send_data_meth;
3720 jmethodID disconnect_socket_meth;
3722 jmethodID hash_meth;
3723 } LDKSocketDescriptor_JCalls;
3724 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3725 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3727 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3728 long data_ref = (long)&data;
3729 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3730 DO_ASSERT(obj != NULL);
3731 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_ref, resume_read);
3733 void disconnect_socket_jcall(void* this_arg) {
3734 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3736 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3737 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3738 DO_ASSERT(obj != NULL);
3739 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3741 bool eq_jcall(const void* this_arg, const void *other_arg) {
3742 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3744 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3745 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3746 DO_ASSERT(obj != NULL);
3747 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3749 uint64_t hash_jcall(const void* this_arg) {
3750 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3753 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3754 DO_ASSERT(obj != NULL);
3755 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3757 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3758 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3759 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3761 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3762 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3766 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3767 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3768 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3769 return (void*) this_arg;
3771 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3772 jclass c = (*env)->GetObjectClass(env, o);
3773 DO_ASSERT(c != NULL);
3774 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3775 atomic_init(&calls->refcnt, 1);
3776 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3777 calls->o = (*env)->NewWeakGlobalRef(env, o);
3778 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3779 DO_ASSERT(calls->send_data_meth != NULL);
3780 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3781 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3782 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3783 DO_ASSERT(calls->eq_meth != NULL);
3784 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3785 DO_ASSERT(calls->hash_meth != NULL);
3787 LDKSocketDescriptor ret = {
3788 .this_arg = (void*) calls,
3789 .send_data = send_data_jcall,
3790 .disconnect_socket = disconnect_socket_jcall,
3793 .clone = LDKSocketDescriptor_JCalls_clone,
3794 .free = LDKSocketDescriptor_JCalls_free,
3798 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3799 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3800 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3801 return (long)res_ptr;
3803 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3804 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3805 DO_ASSERT(ret != NULL);
3808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jlong data, jboolean resume_read) {
3809 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3810 LDKu8slice data_conv = *(LDKu8slice*)data;
3811 return (this_arg_conv->send_data)(this_arg_conv->this_arg, data_conv, resume_read);
3814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
3815 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3816 return (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
3819 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
3820 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3821 return (this_arg_conv->hash)(this_arg_conv->this_arg);
3824 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3825 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3826 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3829 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3832 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3833 if (val->result_ok) {
3834 return (long)val->contents.result;
3836 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3840 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3843 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3844 if (val->result_ok) {
3845 return (long)val->contents.result;
3847 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3851 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3854 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3855 if (val->result_ok) {
3856 return (long)val->contents.result;
3858 return (long)val->contents.err;
3861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3862 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3865 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3866 if (val->result_ok) {
3867 return (long)val->contents.result;
3869 return (long)val->contents.err;
3872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3873 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3876 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3877 if (val->result_ok) {
3878 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3880 return (long)val->contents.err;
3883 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3884 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3885 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3888 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3889 ret->datalen = (*env)->GetArrayLength(env, elems);
3890 if (ret->datalen == 0) {
3893 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3894 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3895 for (size_t i = 0; i < ret->datalen; i++) {
3896 jlong arr_elem = java_elems[i];
3897 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3898 FREE((void*)arr_elem);
3899 ret->data[i] = arr_elem_conv;
3901 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3905 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3906 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3907 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3908 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3909 for (size_t i = 0; i < vec->datalen; i++) {
3910 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3911 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3913 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3917 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3918 ret->datalen = (*env)->GetArrayLength(env, elems);
3919 if (ret->datalen == 0) {
3922 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3923 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3924 for (size_t i = 0; i < ret->datalen; i++) {
3925 jlong arr_elem = java_elems[i];
3926 LDKRouteHop arr_elem_conv;
3927 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3928 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3929 if (arr_elem_conv.inner != NULL)
3930 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3931 ret->data[i] = arr_elem_conv;
3933 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3937 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3938 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3939 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3942 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3943 ret->datalen = (*env)->GetArrayLength(env, elems);
3944 if (ret->datalen == 0) {
3947 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3948 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3949 for (size_t i = 0; i < ret->datalen; i++) {
3950 jlong arr_elem = java_elems[i];
3951 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3952 FREE((void*)arr_elem);
3953 ret->data[i] = arr_elem_conv;
3955 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3960 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3963 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3964 if (val->result_ok) {
3965 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3967 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3970 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3971 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3972 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3973 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3974 for (size_t i = 0; i < vec->datalen; i++) {
3975 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3976 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3978 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3982 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3983 ret->datalen = (*env)->GetArrayLength(env, elems);
3984 if (ret->datalen == 0) {
3987 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
3988 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3989 for (size_t i = 0; i < ret->datalen; i++) {
3990 jlong arr_elem = java_elems[i];
3991 LDKRouteHint arr_elem_conv;
3992 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3993 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3994 ret->data[i] = arr_elem_conv;
3996 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4001 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4003 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4007 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4009 return C2Tuple_OutPointScriptZ_free(arg_conv);
4012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4013 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4015 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4019 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4021 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4025 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4027 return C2Tuple_u64u64Z_free(arg_conv);
4030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4031 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4033 return C2Tuple_usizeTransactionZ_free(arg_conv);
4036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4037 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4039 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4043 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4045 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4049 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4051 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4052 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4057 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4059 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
4062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4063 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4065 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4066 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4071 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4073 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4074 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4079 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4081 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4084 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4085 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4087 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4088 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4093 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4095 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4096 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4101 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4103 return CResult_NoneAPIErrorZ_free(arg_conv);
4106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4107 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4109 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4110 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4115 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4117 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4121 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4123 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4124 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4129 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4131 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4135 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4137 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4138 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4143 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4145 return CResult_NonePaymentSendFailureZ_free(arg_conv);
4148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4149 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4151 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4152 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4157 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4159 return CResult_NonePeerHandleErrorZ_free(arg_conv);
4162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4163 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4165 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4166 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4171 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4173 return CResult_PublicKeySecpErrorZ_free(arg_conv);
4176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4177 LDKPublicKey arg_ref;
4178 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4179 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4180 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4185 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4187 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4188 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4193 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4195 return CResult_RouteLightningErrorZ_free(arg_conv);
4198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4199 LDKRoute arg_conv = *(LDKRoute*)arg;
4201 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4202 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4207 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4209 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4210 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4215 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4217 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4221 LDKSecretKey arg_ref;
4222 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4223 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4224 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4229 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4231 return CResult_SignatureNoneZ_free(arg_conv);
4234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4235 LDKSignature arg_conv = *(LDKSignature*)arg;
4237 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4238 *ret = CResult_SignatureNoneZ_ok(arg_conv);
4242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4243 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4245 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4246 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4251 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4253 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4257 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4259 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4260 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4265 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4267 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4268 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4273 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4275 return CResult_TxOutAccessErrorZ_free(arg_conv);
4278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4279 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4281 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4282 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4286 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4287 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4289 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4290 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4295 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4297 return CResult_boolLightningErrorZ_free(arg_conv);
4300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4301 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4302 *ret = CResult_boolLightningErrorZ_ok(arg);
4306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4307 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4309 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4310 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4315 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4317 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4321 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4322 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4327 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4329 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4333 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4335 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4339 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4341 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4345 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4347 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4351 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4353 return CVec_CVec_RouteHopZZ_free(arg_conv);
4356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4357 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4359 return CVec_ChannelDetailsZ_free(arg_conv);
4362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4363 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4365 return CVec_ChannelMonitorZ_free(arg_conv);
4368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4369 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4371 return CVec_EventZ_free(arg_conv);
4374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4375 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4377 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4381 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4383 return CVec_MessageSendEventZ_free(arg_conv);
4386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4387 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4389 return CVec_MonitorEventZ_free(arg_conv);
4392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4393 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4395 return CVec_NetAddressZ_free(arg_conv);
4398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4399 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4401 return CVec_NodeAnnouncementZ_free(arg_conv);
4404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4405 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4407 return CVec_PublicKeyZ_free(arg_conv);
4410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4411 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4413 return CVec_RouteHintZ_free(arg_conv);
4416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4417 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4419 return CVec_RouteHopZ_free(arg_conv);
4422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4423 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4425 return CVec_SignatureZ_free(arg_conv);
4428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4429 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4431 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4435 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4437 return CVec_TransactionZ_free(arg_conv);
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4443 return CVec_TxOutZ_free(arg_conv);
4446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4447 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4449 return CVec_UpdateAddHTLCZ_free(arg_conv);
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4453 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4455 return CVec_UpdateFailHTLCZ_free(arg_conv);
4458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4459 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4461 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4465 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4467 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4471 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4473 return CVec_u64Z_free(arg_conv);
4476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4477 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4479 return CVec_u8Z_free(arg_conv);
4482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4483 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4485 return Transaction_free(_res_conv);
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4489 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4491 return TxOut_free(_res_conv);
4494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4495 LDKTransaction b_conv = *(LDKTransaction*)b;
4497 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4498 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4503 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4504 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4509 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4510 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4516 a_conv.inner = (void*)(a & (~1));
4517 a_conv.is_owned = (a & 1) || (a == 0);
4518 if (a_conv.inner != NULL)
4519 a_conv = OutPoint_clone(&a_conv);
4520 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4522 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4523 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4528 LDKThirtyTwoBytes a_ref;
4529 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4530 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4532 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4533 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4538 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4539 *ret = C2Tuple_u64u64Z_new(a, b);
4543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4544 LDKSignature a_conv = *(LDKSignature*)a;
4546 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4548 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4549 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
4553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4554 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4555 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4560 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4561 *ret = CResult_SignatureNoneZ_err();
4565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4566 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4567 *ret = CResult_CVec_SignatureZNoneZ_err();
4571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4572 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4573 *ret = CResult_NoneAPIErrorZ_ok();
4577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4578 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4579 *ret = CResult_NonePaymentSendFailureZ_ok();
4583 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4584 LDKChannelAnnouncement a_conv;
4585 a_conv.inner = (void*)(a & (~1));
4586 a_conv.is_owned = (a & 1) || (a == 0);
4587 if (a_conv.inner != NULL)
4588 a_conv = ChannelAnnouncement_clone(&a_conv);
4589 LDKChannelUpdate b_conv;
4590 b_conv.inner = (void*)(b & (~1));
4591 b_conv.is_owned = (b & 1) || (b == 0);
4592 if (b_conv.inner != NULL)
4593 b_conv = ChannelUpdate_clone(&b_conv);
4594 LDKChannelUpdate c_conv;
4595 c_conv.inner = (void*)(c & (~1));
4596 c_conv.is_owned = (c & 1) || (c == 0);
4597 if (c_conv.inner != NULL)
4598 c_conv = ChannelUpdate_clone(&c_conv);
4599 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4600 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4605 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4606 *ret = CResult_NonePeerHandleErrorZ_ok();
4610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4611 LDKHTLCOutputInCommitment a_conv;
4612 a_conv.inner = (void*)(a & (~1));
4613 a_conv.is_owned = (a & 1) || (a == 0);
4614 if (a_conv.inner != NULL)
4615 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4616 LDKSignature b_conv = *(LDKSignature*)b;
4618 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4619 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
4623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4624 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4625 FREE((void*)this_ptr);
4626 return Event_free(this_ptr_conv);
4629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4630 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4631 FREE((void*)this_ptr);
4632 return MessageSendEvent_free(this_ptr_conv);
4635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4636 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4637 FREE((void*)this_ptr);
4638 return MessageSendEventsProvider_free(this_ptr_conv);
4641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4642 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4643 FREE((void*)this_ptr);
4644 return EventsProvider_free(this_ptr_conv);
4647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4648 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4649 FREE((void*)this_ptr);
4650 return APIError_free(this_ptr_conv);
4653 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4654 jclass ret = LDKLevel_to_java(_env, Level_max());
4658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4659 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4660 FREE((void*)this_ptr);
4661 return Logger_free(this_ptr_conv);
4664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4665 LDKChannelHandshakeConfig this_ptr_conv;
4666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4668 return ChannelHandshakeConfig_free(this_ptr_conv);
4671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4672 LDKChannelHandshakeConfig orig_conv;
4673 orig_conv.inner = (void*)(orig & (~1));
4674 orig_conv.is_owned = (orig & 1) || (orig == 0);
4675 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4676 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4679 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4680 LDKChannelHandshakeConfig this_ptr_conv;
4681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4683 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4687 LDKChannelHandshakeConfig this_ptr_conv;
4688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4690 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4693 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4694 LDKChannelHandshakeConfig this_ptr_conv;
4695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4697 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4701 LDKChannelHandshakeConfig this_ptr_conv;
4702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4704 return ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4708 LDKChannelHandshakeConfig this_ptr_conv;
4709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4711 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4715 LDKChannelHandshakeConfig this_ptr_conv;
4716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4718 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jshort our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
4722 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4723 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4727 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4728 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4732 LDKChannelHandshakeLimits this_ptr_conv;
4733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4735 return ChannelHandshakeLimits_free(this_ptr_conv);
4738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4739 LDKChannelHandshakeLimits orig_conv;
4740 orig_conv.inner = (void*)(orig & (~1));
4741 orig_conv.is_owned = (orig & 1) || (orig == 0);
4742 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4743 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4747 LDKChannelHandshakeLimits this_ptr_conv;
4748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4750 return ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4754 LDKChannelHandshakeLimits this_ptr_conv;
4755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4756 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4757 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4761 LDKChannelHandshakeLimits this_ptr_conv;
4762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4764 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4768 LDKChannelHandshakeLimits this_ptr_conv;
4769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4771 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4775 LDKChannelHandshakeLimits this_ptr_conv;
4776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4778 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4782 LDKChannelHandshakeLimits this_ptr_conv;
4783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4785 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4789 LDKChannelHandshakeLimits this_ptr_conv;
4790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4792 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4796 LDKChannelHandshakeLimits this_ptr_conv;
4797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4799 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4802 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4803 LDKChannelHandshakeLimits this_ptr_conv;
4804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4806 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4810 LDKChannelHandshakeLimits this_ptr_conv;
4811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4813 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4817 LDKChannelHandshakeLimits this_ptr_conv;
4818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4820 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4824 LDKChannelHandshakeLimits this_ptr_conv;
4825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4827 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4831 LDKChannelHandshakeLimits this_ptr_conv;
4832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4834 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4838 LDKChannelHandshakeLimits this_ptr_conv;
4839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4841 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4844 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4845 LDKChannelHandshakeLimits this_ptr_conv;
4846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4848 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4852 LDKChannelHandshakeLimits this_ptr_conv;
4853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4855 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4858 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4859 LDKChannelHandshakeLimits this_ptr_conv;
4860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4862 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4866 LDKChannelHandshakeLimits this_ptr_conv;
4867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4869 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4872 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4873 LDKChannelHandshakeLimits this_ptr_conv;
4874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4876 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4880 LDKChannelHandshakeLimits this_ptr_conv;
4881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4883 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv * _env, jclass _b, jlong min_funding_satoshis_arg, jlong max_htlc_minimum_msat_arg, jlong min_max_htlc_value_in_flight_msat_arg, jlong max_channel_reserve_satoshis_arg, jshort min_max_accepted_htlcs_arg, jlong min_dust_limit_satoshis_arg, jlong max_dust_limit_satoshis_arg, jint max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, jshort their_to_self_delay_arg) {
4887 LDKChannelHandshakeLimits ret = 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, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
4888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4892 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4893 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4897 LDKChannelConfig this_ptr_conv;
4898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4900 return ChannelConfig_free(this_ptr_conv);
4903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4904 LDKChannelConfig orig_conv;
4905 orig_conv.inner = (void*)(orig & (~1));
4906 orig_conv.is_owned = (orig & 1) || (orig == 0);
4907 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
4908 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4911 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4912 LDKChannelConfig this_ptr_conv;
4913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4915 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4919 LDKChannelConfig this_ptr_conv;
4920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4922 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4926 LDKChannelConfig this_ptr_conv;
4927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4929 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4933 LDKChannelConfig this_ptr_conv;
4934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4936 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4940 LDKChannelConfig this_ptr_conv;
4941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4943 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4947 LDKChannelConfig this_ptr_conv;
4948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4950 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv * _env, jclass _b, jint fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
4954 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4955 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4959 LDKChannelConfig ret = ChannelConfig_default();
4960 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4964 LDKChannelConfig obj_conv;
4965 obj_conv.inner = (void*)(obj & (~1));
4966 obj_conv.is_owned = (obj & 1) || (obj == 0);
4967 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4968 *ret = ChannelConfig_write(&obj_conv);
4972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4973 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4974 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4975 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4979 LDKUserConfig this_ptr_conv;
4980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4982 return UserConfig_free(this_ptr_conv);
4985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4986 LDKUserConfig orig_conv;
4987 orig_conv.inner = (void*)(orig & (~1));
4988 orig_conv.is_owned = (orig & 1) || (orig == 0);
4989 LDKUserConfig ret = UserConfig_clone(&orig_conv);
4990 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4994 LDKUserConfig this_ptr_conv;
4995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4997 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
4998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5002 LDKUserConfig this_ptr_conv;
5003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5005 LDKChannelHandshakeConfig val_conv;
5006 val_conv.inner = (void*)(val & (~1));
5007 val_conv.is_owned = (val & 1) || (val == 0);
5008 if (val_conv.inner != NULL)
5009 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5010 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5014 LDKUserConfig this_ptr_conv;
5015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5017 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5018 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5022 LDKUserConfig this_ptr_conv;
5023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5025 LDKChannelHandshakeLimits val_conv;
5026 val_conv.inner = (void*)(val & (~1));
5027 val_conv.is_owned = (val & 1) || (val == 0);
5028 if (val_conv.inner != NULL)
5029 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5030 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5034 LDKUserConfig this_ptr_conv;
5035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5037 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5038 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5042 LDKUserConfig this_ptr_conv;
5043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5045 LDKChannelConfig val_conv;
5046 val_conv.inner = (void*)(val & (~1));
5047 val_conv.is_owned = (val & 1) || (val == 0);
5048 if (val_conv.inner != NULL)
5049 val_conv = ChannelConfig_clone(&val_conv);
5050 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv * _env, jclass _b, jlong own_channel_config_arg, jlong peer_channel_config_limits_arg, jlong channel_options_arg) {
5054 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5055 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5056 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5057 if (own_channel_config_arg_conv.inner != NULL)
5058 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5059 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5060 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5061 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5062 if (peer_channel_config_limits_arg_conv.inner != NULL)
5063 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5064 LDKChannelConfig channel_options_arg_conv;
5065 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5066 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5067 if (channel_options_arg_conv.inner != NULL)
5068 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5069 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5070 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5074 LDKUserConfig ret = UserConfig_default();
5075 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5079 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5080 FREE((void*)this_ptr);
5081 return Access_free(this_ptr_conv);
5084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5085 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5086 FREE((void*)this_ptr);
5087 return Watch_free(this_ptr_conv);
5090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5091 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5092 FREE((void*)this_ptr);
5093 return Filter_free(this_ptr_conv);
5096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5097 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5098 FREE((void*)this_ptr);
5099 return BroadcasterInterface_free(this_ptr_conv);
5102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5103 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5104 FREE((void*)this_ptr);
5105 return FeeEstimator_free(this_ptr_conv);
5108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5109 LDKChainMonitor this_ptr_conv;
5110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5112 return ChainMonitor_free(this_ptr_conv);
5115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5116 LDKChainMonitor this_arg_conv;
5117 this_arg_conv.inner = (void*)(this_arg & (~1));
5118 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5119 unsigned char header_arr[80];
5120 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5121 unsigned char (*header_ref)[80] = &header_arr;
5122 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5123 FREE((void*)txdata);
5124 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5128 LDKChainMonitor this_arg_conv;
5129 this_arg_conv.inner = (void*)(this_arg & (~1));
5130 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5131 unsigned char header_arr[80];
5132 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5133 unsigned char (*header_ref)[80] = &header_arr;
5134 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5138 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5139 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5140 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5141 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5142 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5144 LDKLogger logger_conv = *(LDKLogger*)logger;
5145 if (logger_conv.free == LDKLogger_JCalls_free) {
5146 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5147 LDKLogger_JCalls_clone(logger_conv.this_arg);
5149 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5150 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5151 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5152 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5154 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5155 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5159 LDKChainMonitor this_arg_conv;
5160 this_arg_conv.inner = (void*)(this_arg & (~1));
5161 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5162 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5163 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5168 LDKChainMonitor this_arg_conv;
5169 this_arg_conv.inner = (void*)(this_arg & (~1));
5170 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5171 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5172 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5177 LDKChannelMonitorUpdate this_ptr_conv;
5178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5180 return ChannelMonitorUpdate_free(this_ptr_conv);
5183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5184 LDKChannelMonitorUpdate orig_conv;
5185 orig_conv.inner = (void*)(orig & (~1));
5186 orig_conv.is_owned = (orig & 1) || (orig == 0);
5187 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5188 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5192 LDKChannelMonitorUpdate this_ptr_conv;
5193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5194 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5195 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5199 LDKChannelMonitorUpdate this_ptr_conv;
5200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5202 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5206 LDKChannelMonitorUpdate obj_conv;
5207 obj_conv.inner = (void*)(obj & (~1));
5208 obj_conv.is_owned = (obj & 1) || (obj == 0);
5209 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5210 *ret = ChannelMonitorUpdate_write(&obj_conv);
5214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5215 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5216 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
5217 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5221 LDKMonitorUpdateError this_ptr_conv;
5222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5224 return MonitorUpdateError_free(this_ptr_conv);
5227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5228 LDKMonitorEvent this_ptr_conv;
5229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5231 return MonitorEvent_free(this_ptr_conv);
5234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5235 LDKHTLCUpdate this_ptr_conv;
5236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5238 return HTLCUpdate_free(this_ptr_conv);
5241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5242 LDKHTLCUpdate orig_conv;
5243 orig_conv.inner = (void*)(orig & (~1));
5244 orig_conv.is_owned = (orig & 1) || (orig == 0);
5245 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5246 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5250 LDKHTLCUpdate obj_conv;
5251 obj_conv.inner = (void*)(obj & (~1));
5252 obj_conv.is_owned = (obj & 1) || (obj == 0);
5253 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5254 *ret = HTLCUpdate_write(&obj_conv);
5258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5259 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5260 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5261 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5265 LDKChannelMonitor this_ptr_conv;
5266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5268 return ChannelMonitor_free(this_ptr_conv);
5271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5272 LDKChannelMonitor this_arg_conv;
5273 this_arg_conv.inner = (void*)(this_arg & (~1));
5274 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5275 LDKChannelMonitorUpdate updates_conv;
5276 updates_conv.inner = (void*)(updates & (~1));
5277 updates_conv.is_owned = (updates & 1) || (updates == 0);
5278 if (updates_conv.inner != NULL)
5279 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5280 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5281 LDKLogger* logger_conv = (LDKLogger*)logger;
5282 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5283 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5288 LDKChannelMonitor this_arg_conv;
5289 this_arg_conv.inner = (void*)(this_arg & (~1));
5290 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5291 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5295 LDKChannelMonitor this_arg_conv;
5296 this_arg_conv.inner = (void*)(this_arg & (~1));
5297 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5298 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5299 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5304 LDKChannelMonitor this_arg_conv;
5305 this_arg_conv.inner = (void*)(this_arg & (~1));
5306 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5307 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5308 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5313 LDKChannelMonitor this_arg_conv;
5314 this_arg_conv.inner = (void*)(this_arg & (~1));
5315 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5316 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5317 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5322 LDKChannelMonitor this_arg_conv;
5323 this_arg_conv.inner = (void*)(this_arg & (~1));
5324 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5325 LDKLogger* logger_conv = (LDKLogger*)logger;
5326 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5327 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
5332 LDKChannelMonitor this_arg_conv;
5333 this_arg_conv.inner = (void*)(this_arg & (~1));
5334 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5335 unsigned char header_arr[80];
5336 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5337 unsigned char (*header_ref)[80] = &header_arr;
5338 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5339 FREE((void*)txdata);
5340 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5341 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5342 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5343 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5345 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5346 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5347 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5348 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5350 LDKLogger logger_conv = *(LDKLogger*)logger;
5351 if (logger_conv.free == LDKLogger_JCalls_free) {
5352 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5353 LDKLogger_JCalls_clone(logger_conv.this_arg);
5355 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5356 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
5361 LDKChannelMonitor this_arg_conv;
5362 this_arg_conv.inner = (void*)(this_arg & (~1));
5363 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5364 unsigned char header_arr[80];
5365 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5366 unsigned char (*header_ref)[80] = &header_arr;
5367 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5368 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5369 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5370 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5372 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5373 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5374 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5375 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5377 LDKLogger logger_conv = *(LDKLogger*)logger;
5378 if (logger_conv.free == LDKLogger_JCalls_free) {
5379 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5380 LDKLogger_JCalls_clone(logger_conv.this_arg);
5382 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5386 LDKOutPoint this_ptr_conv;
5387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5389 return OutPoint_free(this_ptr_conv);
5392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5393 LDKOutPoint orig_conv;
5394 orig_conv.inner = (void*)(orig & (~1));
5395 orig_conv.is_owned = (orig & 1) || (orig == 0);
5396 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5397 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5401 LDKOutPoint this_ptr_conv;
5402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5404 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5405 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5410 LDKOutPoint this_ptr_conv;
5411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5413 LDKThirtyTwoBytes val_ref;
5414 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5415 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5418 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5419 LDKOutPoint this_ptr_conv;
5420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5422 return OutPoint_get_index(&this_ptr_conv);
5425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5426 LDKOutPoint this_ptr_conv;
5427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5429 return OutPoint_set_index(&this_ptr_conv, val);
5432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5433 LDKThirtyTwoBytes txid_arg_ref;
5434 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5435 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5436 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5439 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5440 LDKOutPoint this_arg_conv;
5441 this_arg_conv.inner = (void*)(this_arg & (~1));
5442 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5443 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5444 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5449 LDKOutPoint obj_conv;
5450 obj_conv.inner = (void*)(obj & (~1));
5451 obj_conv.is_owned = (obj & 1) || (obj == 0);
5452 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5453 *ret = OutPoint_write(&obj_conv);
5457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5458 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5459 LDKOutPoint ret = OutPoint_read(ser_conv);
5460 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5464 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5465 FREE((void*)this_ptr);
5466 return SpendableOutputDescriptor_free(this_ptr_conv);
5469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5470 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5471 FREE((void*)this_ptr);
5472 return ChannelKeys_free(this_ptr_conv);
5475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5476 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5477 FREE((void*)this_ptr);
5478 return KeysInterface_free(this_ptr_conv);
5481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5482 LDKInMemoryChannelKeys this_ptr_conv;
5483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5485 return InMemoryChannelKeys_free(this_ptr_conv);
5488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5489 LDKInMemoryChannelKeys orig_conv;
5490 orig_conv.inner = (void*)(orig & (~1));
5491 orig_conv.is_owned = (orig & 1) || (orig == 0);
5492 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5493 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5496 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5497 LDKInMemoryChannelKeys this_ptr_conv;
5498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5500 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5501 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5506 LDKInMemoryChannelKeys this_ptr_conv;
5507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5509 LDKSecretKey val_ref;
5510 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5511 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5514 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5515 LDKInMemoryChannelKeys this_ptr_conv;
5516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5518 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5519 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5524 LDKInMemoryChannelKeys this_ptr_conv;
5525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5527 LDKSecretKey val_ref;
5528 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5529 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5532 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5533 LDKInMemoryChannelKeys this_ptr_conv;
5534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5536 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5537 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5542 LDKInMemoryChannelKeys this_ptr_conv;
5543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5545 LDKSecretKey val_ref;
5546 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5547 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5551 LDKInMemoryChannelKeys this_ptr_conv;
5552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5554 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5555 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5560 LDKInMemoryChannelKeys this_ptr_conv;
5561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5563 LDKSecretKey val_ref;
5564 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5565 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5568 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5569 LDKInMemoryChannelKeys this_ptr_conv;
5570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5572 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5573 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5578 LDKInMemoryChannelKeys this_ptr_conv;
5579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5581 LDKSecretKey val_ref;
5582 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5583 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
5586 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5587 LDKInMemoryChannelKeys this_ptr_conv;
5588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5590 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5591 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5596 LDKInMemoryChannelKeys this_ptr_conv;
5597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5599 LDKThirtyTwoBytes val_ref;
5600 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5601 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_key, jbyteArray revocation_base_key, jbyteArray payment_key, jbyteArray delayed_payment_base_key, jbyteArray htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
5605 LDKSecretKey funding_key_ref;
5606 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
5607 LDKSecretKey revocation_base_key_ref;
5608 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
5609 LDKSecretKey payment_key_ref;
5610 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
5611 LDKSecretKey delayed_payment_base_key_ref;
5612 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
5613 LDKSecretKey htlc_base_key_ref;
5614 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
5615 LDKThirtyTwoBytes commitment_seed_ref;
5616 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5617 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5618 FREE((void*)key_derivation_params);
5619 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_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, key_derivation_params_conv);
5620 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5624 LDKInMemoryChannelKeys this_arg_conv;
5625 this_arg_conv.inner = (void*)(this_arg & (~1));
5626 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5627 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5628 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5631 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5632 LDKInMemoryChannelKeys this_arg_conv;
5633 this_arg_conv.inner = (void*)(this_arg & (~1));
5634 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5635 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5638 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5639 LDKInMemoryChannelKeys this_arg_conv;
5640 this_arg_conv.inner = (void*)(this_arg & (~1));
5641 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5642 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5646 LDKInMemoryChannelKeys this_arg_conv;
5647 this_arg_conv.inner = (void*)(this_arg & (~1));
5648 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5649 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5650 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5655 LDKInMemoryChannelKeys obj_conv;
5656 obj_conv.inner = (void*)(obj & (~1));
5657 obj_conv.is_owned = (obj & 1) || (obj == 0);
5658 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5659 *ret = InMemoryChannelKeys_write(&obj_conv);
5663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5664 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5665 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5666 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5670 LDKKeysManager this_ptr_conv;
5671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5672 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5673 return KeysManager_free(this_ptr_conv);
5676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv * _env, jclass _b, jbyteArray seed, jclass network, jlong starting_time_secs, jint starting_time_nanos) {
5677 unsigned char seed_arr[32];
5678 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5679 unsigned char (*seed_ref)[32] = &seed_arr;
5680 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5681 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5682 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_value_satoshis, jlong params_1, jlong params_2) {
5686 LDKKeysManager this_arg_conv;
5687 this_arg_conv.inner = (void*)(this_arg & (~1));
5688 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5689 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5690 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5694 LDKKeysManager this_arg_conv;
5695 this_arg_conv.inner = (void*)(this_arg & (~1));
5696 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5697 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5698 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5703 LDKChannelManager this_ptr_conv;
5704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5706 return ChannelManager_free(this_ptr_conv);
5709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5710 LDKChannelDetails this_ptr_conv;
5711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5713 return ChannelDetails_free(this_ptr_conv);
5716 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5717 LDKChannelDetails this_ptr_conv;
5718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5720 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5721 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5726 LDKChannelDetails this_ptr_conv;
5727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5729 LDKThirtyTwoBytes val_ref;
5730 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5731 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5734 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5735 LDKChannelDetails this_ptr_conv;
5736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5738 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5739 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5744 LDKChannelDetails this_ptr_conv;
5745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5747 LDKPublicKey val_ref;
5748 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5749 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5753 LDKChannelDetails this_ptr_conv;
5754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5756 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5757 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5761 LDKChannelDetails this_ptr_conv;
5762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5764 LDKInitFeatures val_conv;
5765 val_conv.inner = (void*)(val & (~1));
5766 val_conv.is_owned = (val & 1) || (val == 0);
5767 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5771 LDKChannelDetails this_ptr_conv;
5772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5774 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5778 LDKChannelDetails this_ptr_conv;
5779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5781 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5785 LDKChannelDetails this_ptr_conv;
5786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5788 return ChannelDetails_get_user_id(&this_ptr_conv);
5791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5792 LDKChannelDetails this_ptr_conv;
5793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5795 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5799 LDKChannelDetails this_ptr_conv;
5800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5802 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5806 LDKChannelDetails this_ptr_conv;
5807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5809 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5813 LDKChannelDetails this_ptr_conv;
5814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5816 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5820 LDKChannelDetails this_ptr_conv;
5821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5823 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5827 LDKChannelDetails this_ptr_conv;
5828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5830 return ChannelDetails_get_is_live(&this_ptr_conv);
5833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5834 LDKChannelDetails this_ptr_conv;
5835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5837 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5841 LDKPaymentSendFailure this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 return PaymentSendFailure_free(this_ptr_conv);
5847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jclass network, jlong fee_est, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
5848 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5849 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5850 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5851 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5852 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5854 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5855 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5856 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5857 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5859 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5860 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5861 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5862 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5864 LDKLogger logger_conv = *(LDKLogger*)logger;
5865 if (logger_conv.free == LDKLogger_JCalls_free) {
5866 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5867 LDKLogger_JCalls_clone(logger_conv.this_arg);
5869 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5870 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5871 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5872 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5874 LDKUserConfig config_conv;
5875 config_conv.inner = (void*)(config & (~1));
5876 config_conv.is_owned = (config & 1) || (config == 0);
5877 if (config_conv.inner != NULL)
5878 config_conv = UserConfig_clone(&config_conv);
5879 LDKChannelManager ret = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
5880 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
5884 LDKChannelManager this_arg_conv;
5885 this_arg_conv.inner = (void*)(this_arg & (~1));
5886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5887 LDKPublicKey their_network_key_ref;
5888 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
5889 LDKUserConfig override_config_conv;
5890 override_config_conv.inner = (void*)(override_config & (~1));
5891 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5892 if (override_config_conv.inner != NULL)
5893 override_config_conv = UserConfig_clone(&override_config_conv);
5894 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5895 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
5899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5900 LDKChannelManager this_arg_conv;
5901 this_arg_conv.inner = (void*)(this_arg & (~1));
5902 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5903 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5904 *ret = ChannelManager_list_channels(&this_arg_conv);
5908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5909 LDKChannelManager this_arg_conv;
5910 this_arg_conv.inner = (void*)(this_arg & (~1));
5911 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5912 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5913 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5918 LDKChannelManager this_arg_conv;
5919 this_arg_conv.inner = (void*)(this_arg & (~1));
5920 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5921 unsigned char channel_id_arr[32];
5922 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5923 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5924 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5925 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5930 LDKChannelManager this_arg_conv;
5931 this_arg_conv.inner = (void*)(this_arg & (~1));
5932 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5933 unsigned char channel_id_arr[32];
5934 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5935 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5936 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5940 LDKChannelManager this_arg_conv;
5941 this_arg_conv.inner = (void*)(this_arg & (~1));
5942 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5943 return ChannelManager_force_close_all_channels(&this_arg_conv);
5946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jbyteArray payment_hash, jbyteArray payment_secret) {
5947 LDKChannelManager this_arg_conv;
5948 this_arg_conv.inner = (void*)(this_arg & (~1));
5949 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5950 LDKRoute route_conv;
5951 route_conv.inner = (void*)(route & (~1));
5952 route_conv.is_owned = (route & 1) || (route == 0);
5953 LDKThirtyTwoBytes payment_hash_ref;
5954 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
5955 LDKThirtyTwoBytes payment_secret_ref;
5956 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5957 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5958 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
5962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray temporary_channel_id, jlong funding_txo) {
5963 LDKChannelManager this_arg_conv;
5964 this_arg_conv.inner = (void*)(this_arg & (~1));
5965 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5966 unsigned char temporary_channel_id_arr[32];
5967 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
5968 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
5969 LDKOutPoint funding_txo_conv;
5970 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5971 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5972 if (funding_txo_conv.inner != NULL)
5973 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5974 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
5977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jbyteArray alias, jlong addresses) {
5978 LDKChannelManager this_arg_conv;
5979 this_arg_conv.inner = (void*)(this_arg & (~1));
5980 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5981 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
5983 LDKThirtyTwoBytes alias_ref;
5984 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
5985 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
5986 FREE((void*)addresses);
5987 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
5990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
5991 LDKChannelManager this_arg_conv;
5992 this_arg_conv.inner = (void*)(this_arg & (~1));
5993 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5994 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
5997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
5998 LDKChannelManager this_arg_conv;
5999 this_arg_conv.inner = (void*)(this_arg & (~1));
6000 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6001 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jbyteArray payment_secret) {
6005 LDKChannelManager this_arg_conv;
6006 this_arg_conv.inner = (void*)(this_arg & (~1));
6007 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6008 unsigned char payment_hash_arr[32];
6009 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6010 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6011 LDKThirtyTwoBytes payment_secret_ref;
6012 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6013 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6016 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_preimage, jbyteArray payment_secret, jlong expected_amount) {
6017 LDKChannelManager this_arg_conv;
6018 this_arg_conv.inner = (void*)(this_arg & (~1));
6019 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6020 LDKThirtyTwoBytes payment_preimage_ref;
6021 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6022 LDKThirtyTwoBytes payment_secret_ref;
6023 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6024 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6027 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6028 LDKChannelManager this_arg_conv;
6029 this_arg_conv.inner = (void*)(this_arg & (~1));
6030 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6031 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6032 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong highest_applied_update_id) {
6037 LDKChannelManager this_arg_conv;
6038 this_arg_conv.inner = (void*)(this_arg & (~1));
6039 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6040 LDKOutPoint funding_txo_conv;
6041 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6042 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6043 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6047 LDKChannelManager this_arg_conv;
6048 this_arg_conv.inner = (void*)(this_arg & (~1));
6049 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6050 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6051 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6056 LDKChannelManager this_arg_conv;
6057 this_arg_conv.inner = (void*)(this_arg & (~1));
6058 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6059 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6060 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6065 LDKChannelManager this_arg_conv;
6066 this_arg_conv.inner = (void*)(this_arg & (~1));
6067 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6068 unsigned char header_arr[80];
6069 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6070 unsigned char (*header_ref)[80] = &header_arr;
6071 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6072 FREE((void*)txdata);
6073 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6077 LDKChannelManager this_arg_conv;
6078 this_arg_conv.inner = (void*)(this_arg & (~1));
6079 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6080 unsigned char header_arr[80];
6081 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6082 unsigned char (*header_ref)[80] = &header_arr;
6083 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6087 LDKChannelManager this_arg_conv;
6088 this_arg_conv.inner = (void*)(this_arg & (~1));
6089 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6090 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6091 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6096 LDKChannelManagerReadArgs this_ptr_conv;
6097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6099 return ChannelManagerReadArgs_free(this_ptr_conv);
6102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6103 LDKChannelManagerReadArgs this_ptr_conv;
6104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6106 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6111 LDKChannelManagerReadArgs this_ptr_conv;
6112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6114 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6115 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6116 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6117 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6119 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6123 LDKChannelManagerReadArgs this_ptr_conv;
6124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6126 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6131 LDKChannelManagerReadArgs this_ptr_conv;
6132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6134 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6135 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6137 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6139 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6143 LDKChannelManagerReadArgs this_ptr_conv;
6144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6146 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6151 LDKChannelManagerReadArgs this_ptr_conv;
6152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6154 LDKWatch val_conv = *(LDKWatch*)val;
6155 if (val_conv.free == LDKWatch_JCalls_free) {
6156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6157 LDKWatch_JCalls_clone(val_conv.this_arg);
6159 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6163 LDKChannelManagerReadArgs this_ptr_conv;
6164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6166 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6171 LDKChannelManagerReadArgs this_ptr_conv;
6172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6174 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6175 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6176 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6177 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6179 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6183 LDKChannelManagerReadArgs this_ptr_conv;
6184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6185 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6186 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6191 LDKChannelManagerReadArgs this_ptr_conv;
6192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6194 LDKLogger val_conv = *(LDKLogger*)val;
6195 if (val_conv.free == LDKLogger_JCalls_free) {
6196 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6197 LDKLogger_JCalls_clone(val_conv.this_arg);
6199 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6203 LDKChannelManagerReadArgs this_ptr_conv;
6204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6206 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6207 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6211 LDKChannelManagerReadArgs this_ptr_conv;
6212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6214 LDKUserConfig val_conv;
6215 val_conv.inner = (void*)(val & (~1));
6216 val_conv.is_owned = (val & 1) || (val == 0);
6217 if (val_conv.inner != NULL)
6218 val_conv = UserConfig_clone(&val_conv);
6219 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv * _env, jclass _b, jlong keys_manager, jlong fee_estimator, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong default_config, jlong channel_monitors) {
6223 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6224 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6225 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6226 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6228 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6229 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6230 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6231 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6233 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6234 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6235 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6236 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6238 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6239 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6241 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6243 LDKLogger logger_conv = *(LDKLogger*)logger;
6244 if (logger_conv.free == LDKLogger_JCalls_free) {
6245 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6246 LDKLogger_JCalls_clone(logger_conv.this_arg);
6248 LDKUserConfig default_config_conv;
6249 default_config_conv.inner = (void*)(default_config & (~1));
6250 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6251 if (default_config_conv.inner != NULL)
6252 default_config_conv = UserConfig_clone(&default_config_conv);
6253 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6254 FREE((void*)channel_monitors);
6255 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6256 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6260 LDKDecodeError this_ptr_conv;
6261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6263 return DecodeError_free(this_ptr_conv);
6266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6267 LDKInit this_ptr_conv;
6268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6270 return Init_free(this_ptr_conv);
6273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6274 LDKErrorMessage this_ptr_conv;
6275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6276 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6277 return ErrorMessage_free(this_ptr_conv);
6280 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6281 LDKErrorMessage orig_conv;
6282 orig_conv.inner = (void*)(orig & (~1));
6283 orig_conv.is_owned = (orig & 1) || (orig == 0);
6284 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6285 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6288 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6289 LDKErrorMessage this_ptr_conv;
6290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6292 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6293 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6298 LDKErrorMessage this_ptr_conv;
6299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6301 LDKThirtyTwoBytes val_ref;
6302 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6303 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6307 LDKErrorMessage this_ptr_conv;
6308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6310 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6311 *ret = ErrorMessage_get_data(&this_ptr_conv);
6315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6316 LDKErrorMessage this_ptr_conv;
6317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6319 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6321 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6325 LDKThirtyTwoBytes channel_id_arg_ref;
6326 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6327 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6328 FREE((void*)data_arg);
6329 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6330 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6334 LDKPing this_ptr_conv;
6335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6337 return Ping_free(this_ptr_conv);
6340 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6341 LDKPing this_ptr_conv;
6342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6344 return Ping_get_ponglen(&this_ptr_conv);
6347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6348 LDKPing this_ptr_conv;
6349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6351 return Ping_set_ponglen(&this_ptr_conv, val);
6354 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6355 LDKPing this_ptr_conv;
6356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6358 return Ping_get_byteslen(&this_ptr_conv);
6361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6362 LDKPing this_ptr_conv;
6363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6365 return Ping_set_byteslen(&this_ptr_conv, val);
6368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6369 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6370 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6374 LDKPong this_ptr_conv;
6375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6377 return Pong_free(this_ptr_conv);
6380 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6381 LDKPong this_ptr_conv;
6382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6384 return Pong_get_byteslen(&this_ptr_conv);
6387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6388 LDKPong this_ptr_conv;
6389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6391 return Pong_set_byteslen(&this_ptr_conv, val);
6394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6395 LDKPong ret = Pong_new(byteslen_arg);
6396 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6400 LDKOpenChannel this_ptr_conv;
6401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6403 return OpenChannel_free(this_ptr_conv);
6406 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6407 LDKOpenChannel orig_conv;
6408 orig_conv.inner = (void*)(orig & (~1));
6409 orig_conv.is_owned = (orig & 1) || (orig == 0);
6410 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6411 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6414 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6415 LDKOpenChannel this_ptr_conv;
6416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6418 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6419 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6424 LDKOpenChannel this_ptr_conv;
6425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6427 LDKThirtyTwoBytes val_ref;
6428 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6429 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6432 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6433 LDKOpenChannel this_ptr_conv;
6434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6436 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6437 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6442 LDKOpenChannel this_ptr_conv;
6443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6445 LDKThirtyTwoBytes val_ref;
6446 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6447 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6451 LDKOpenChannel this_ptr_conv;
6452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6454 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6458 LDKOpenChannel this_ptr_conv;
6459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6461 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6465 LDKOpenChannel this_ptr_conv;
6466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6468 return OpenChannel_get_push_msat(&this_ptr_conv);
6471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6472 LDKOpenChannel this_ptr_conv;
6473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6475 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6479 LDKOpenChannel this_ptr_conv;
6480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6482 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6486 LDKOpenChannel this_ptr_conv;
6487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6489 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6493 LDKOpenChannel this_ptr_conv;
6494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6496 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6500 LDKOpenChannel this_ptr_conv;
6501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6503 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6507 LDKOpenChannel this_ptr_conv;
6508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6510 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6514 LDKOpenChannel this_ptr_conv;
6515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6517 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6521 LDKOpenChannel this_ptr_conv;
6522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6524 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6528 LDKOpenChannel this_ptr_conv;
6529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6531 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6534 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6535 LDKOpenChannel this_ptr_conv;
6536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6538 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6542 LDKOpenChannel this_ptr_conv;
6543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6545 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6548 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6549 LDKOpenChannel this_ptr_conv;
6550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6552 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6556 LDKOpenChannel this_ptr_conv;
6557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6559 return OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6562 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6563 LDKOpenChannel this_ptr_conv;
6564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6566 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6570 LDKOpenChannel this_ptr_conv;
6571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6573 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6576 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6577 LDKOpenChannel this_ptr_conv;
6578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6586 LDKOpenChannel this_ptr_conv;
6587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6589 LDKPublicKey val_ref;
6590 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6591 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6595 LDKOpenChannel this_ptr_conv;
6596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6598 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6599 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6604 LDKOpenChannel this_ptr_conv;
6605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6607 LDKPublicKey val_ref;
6608 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6609 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6612 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6613 LDKOpenChannel this_ptr_conv;
6614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6616 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6617 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6622 LDKOpenChannel this_ptr_conv;
6623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6625 LDKPublicKey val_ref;
6626 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6627 return OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6630 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6631 LDKOpenChannel this_ptr_conv;
6632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6634 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6635 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6640 LDKOpenChannel this_ptr_conv;
6641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6643 LDKPublicKey val_ref;
6644 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6645 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6649 LDKOpenChannel this_ptr_conv;
6650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6652 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6653 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6658 LDKOpenChannel this_ptr_conv;
6659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6661 LDKPublicKey val_ref;
6662 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6663 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6666 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6667 LDKOpenChannel this_ptr_conv;
6668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6670 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6671 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6676 LDKOpenChannel this_ptr_conv;
6677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6679 LDKPublicKey val_ref;
6680 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6681 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6684 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6685 LDKOpenChannel this_ptr_conv;
6686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6688 return OpenChannel_get_channel_flags(&this_ptr_conv);
6691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6692 LDKOpenChannel this_ptr_conv;
6693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6695 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6699 LDKAcceptChannel this_ptr_conv;
6700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6702 return AcceptChannel_free(this_ptr_conv);
6705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6706 LDKAcceptChannel orig_conv;
6707 orig_conv.inner = (void*)(orig & (~1));
6708 orig_conv.is_owned = (orig & 1) || (orig == 0);
6709 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6710 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6714 LDKAcceptChannel this_ptr_conv;
6715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6717 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6718 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6723 LDKAcceptChannel this_ptr_conv;
6724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6726 LDKThirtyTwoBytes val_ref;
6727 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6728 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6732 LDKAcceptChannel this_ptr_conv;
6733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6735 return AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6739 LDKAcceptChannel this_ptr_conv;
6740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6742 return AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6745 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6746 LDKAcceptChannel this_ptr_conv;
6747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6749 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6753 LDKAcceptChannel this_ptr_conv;
6754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6756 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6760 LDKAcceptChannel this_ptr_conv;
6761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6763 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6767 LDKAcceptChannel this_ptr_conv;
6768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6770 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6774 LDKAcceptChannel this_ptr_conv;
6775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6777 return AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6781 LDKAcceptChannel this_ptr_conv;
6782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6784 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6787 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6788 LDKAcceptChannel this_ptr_conv;
6789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6791 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6795 LDKAcceptChannel this_ptr_conv;
6796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6798 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6801 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6802 LDKAcceptChannel this_ptr_conv;
6803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6805 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6809 LDKAcceptChannel this_ptr_conv;
6810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6812 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6815 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6816 LDKAcceptChannel this_ptr_conv;
6817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6819 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6823 LDKAcceptChannel this_ptr_conv;
6824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6826 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6829 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6830 LDKAcceptChannel this_ptr_conv;
6831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6833 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6834 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6839 LDKAcceptChannel this_ptr_conv;
6840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6842 LDKPublicKey val_ref;
6843 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6844 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6847 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6848 LDKAcceptChannel this_ptr_conv;
6849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6851 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6852 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6857 LDKAcceptChannel this_ptr_conv;
6858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6860 LDKPublicKey val_ref;
6861 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6862 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6865 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6866 LDKAcceptChannel this_ptr_conv;
6867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6869 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6870 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
6874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6875 LDKAcceptChannel this_ptr_conv;
6876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6878 LDKPublicKey val_ref;
6879 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6880 return AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
6883 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6884 LDKAcceptChannel this_ptr_conv;
6885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6887 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6888 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6893 LDKAcceptChannel this_ptr_conv;
6894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6896 LDKPublicKey val_ref;
6897 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6898 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6901 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6902 LDKAcceptChannel this_ptr_conv;
6903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6905 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6906 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6911 LDKAcceptChannel this_ptr_conv;
6912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6914 LDKPublicKey val_ref;
6915 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6916 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6919 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6920 LDKAcceptChannel this_ptr_conv;
6921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6923 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6924 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6929 LDKAcceptChannel this_ptr_conv;
6930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6932 LDKPublicKey val_ref;
6933 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6934 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6938 LDKFundingCreated this_ptr_conv;
6939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6941 return FundingCreated_free(this_ptr_conv);
6944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6945 LDKFundingCreated orig_conv;
6946 orig_conv.inner = (void*)(orig & (~1));
6947 orig_conv.is_owned = (orig & 1) || (orig == 0);
6948 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
6949 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6953 LDKFundingCreated this_ptr_conv;
6954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6956 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6957 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
6961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6962 LDKFundingCreated this_ptr_conv;
6963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6965 LDKThirtyTwoBytes val_ref;
6966 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6967 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
6970 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6971 LDKFundingCreated this_ptr_conv;
6972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6974 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6975 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
6979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6980 LDKFundingCreated this_ptr_conv;
6981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6983 LDKThirtyTwoBytes val_ref;
6984 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6985 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
6988 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6989 LDKFundingCreated this_ptr_conv;
6990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6992 return FundingCreated_get_funding_output_index(&this_ptr_conv);
6995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6996 LDKFundingCreated this_ptr_conv;
6997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6999 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7003 LDKFundingCreated this_ptr_conv;
7004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7006 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7007 *ret = FundingCreated_get_signature(&this_ptr_conv);
7011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7012 LDKFundingCreated this_ptr_conv;
7013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7015 LDKSignature val_conv = *(LDKSignature*)val;
7017 return FundingCreated_set_signature(&this_ptr_conv, val_conv);
7020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jbyteArray temporary_channel_id_arg, jbyteArray funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) {
7021 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7022 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7023 LDKThirtyTwoBytes funding_txid_arg_ref;
7024 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7025 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7026 FREE((void*)signature_arg);
7027 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv);
7028 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7032 LDKFundingSigned this_ptr_conv;
7033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7035 return FundingSigned_free(this_ptr_conv);
7038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7039 LDKFundingSigned orig_conv;
7040 orig_conv.inner = (void*)(orig & (~1));
7041 orig_conv.is_owned = (orig & 1) || (orig == 0);
7042 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7043 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7046 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7047 LDKFundingSigned this_ptr_conv;
7048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7050 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7051 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7056 LDKFundingSigned this_ptr_conv;
7057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7059 LDKThirtyTwoBytes val_ref;
7060 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7061 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7065 LDKFundingSigned this_ptr_conv;
7066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7068 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7069 *ret = FundingSigned_get_signature(&this_ptr_conv);
7073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7074 LDKFundingSigned this_ptr_conv;
7075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7077 LDKSignature val_conv = *(LDKSignature*)val;
7079 return FundingSigned_set_signature(&this_ptr_conv, val_conv);
7082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) {
7083 LDKThirtyTwoBytes channel_id_arg_ref;
7084 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7085 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7086 FREE((void*)signature_arg);
7087 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv);
7088 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7092 LDKFundingLocked this_ptr_conv;
7093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7095 return FundingLocked_free(this_ptr_conv);
7098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7099 LDKFundingLocked orig_conv;
7100 orig_conv.inner = (void*)(orig & (~1));
7101 orig_conv.is_owned = (orig & 1) || (orig == 0);
7102 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7103 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7107 LDKFundingLocked this_ptr_conv;
7108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7110 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7111 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7116 LDKFundingLocked this_ptr_conv;
7117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7119 LDKThirtyTwoBytes val_ref;
7120 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7121 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7125 LDKFundingLocked this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7128 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7129 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7134 LDKFundingLocked this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 LDKPublicKey val_ref;
7138 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7139 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7143 LDKThirtyTwoBytes channel_id_arg_ref;
7144 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7145 LDKPublicKey next_per_commitment_point_arg_ref;
7146 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7147 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7148 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7152 LDKShutdown this_ptr_conv;
7153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7155 return Shutdown_free(this_ptr_conv);
7158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7159 LDKShutdown orig_conv;
7160 orig_conv.inner = (void*)(orig & (~1));
7161 orig_conv.is_owned = (orig & 1) || (orig == 0);
7162 LDKShutdown ret = Shutdown_clone(&orig_conv);
7163 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7166 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7167 LDKShutdown this_ptr_conv;
7168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7170 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7171 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7176 LDKShutdown this_ptr_conv;
7177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7179 LDKThirtyTwoBytes val_ref;
7180 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7181 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7185 LDKShutdown this_ptr_conv;
7186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7188 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
7189 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
7193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7194 LDKShutdown this_ptr_conv;
7195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7197 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7199 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7203 LDKThirtyTwoBytes channel_id_arg_ref;
7204 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7205 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7206 FREE((void*)scriptpubkey_arg);
7207 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7208 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7212 LDKClosingSigned this_ptr_conv;
7213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7215 return ClosingSigned_free(this_ptr_conv);
7218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7219 LDKClosingSigned orig_conv;
7220 orig_conv.inner = (void*)(orig & (~1));
7221 orig_conv.is_owned = (orig & 1) || (orig == 0);
7222 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7223 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7226 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7227 LDKClosingSigned this_ptr_conv;
7228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7230 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7231 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7236 LDKClosingSigned this_ptr_conv;
7237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7239 LDKThirtyTwoBytes val_ref;
7240 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7241 return ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7245 LDKClosingSigned this_ptr_conv;
7246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7248 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7252 LDKClosingSigned this_ptr_conv;
7253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7255 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7259 LDKClosingSigned this_ptr_conv;
7260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7262 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7263 *ret = ClosingSigned_get_signature(&this_ptr_conv);
7267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7268 LDKClosingSigned this_ptr_conv;
7269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7271 LDKSignature val_conv = *(LDKSignature*)val;
7273 return ClosingSigned_set_signature(&this_ptr_conv, val_conv);
7276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) {
7277 LDKThirtyTwoBytes channel_id_arg_ref;
7278 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7279 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7280 FREE((void*)signature_arg);
7281 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv);
7282 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7286 LDKUpdateAddHTLC this_ptr_conv;
7287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7289 return UpdateAddHTLC_free(this_ptr_conv);
7292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7293 LDKUpdateAddHTLC orig_conv;
7294 orig_conv.inner = (void*)(orig & (~1));
7295 orig_conv.is_owned = (orig & 1) || (orig == 0);
7296 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7297 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7300 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7301 LDKUpdateAddHTLC this_ptr_conv;
7302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7304 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7305 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7310 LDKUpdateAddHTLC this_ptr_conv;
7311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7313 LDKThirtyTwoBytes val_ref;
7314 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7315 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7319 LDKUpdateAddHTLC this_ptr_conv;
7320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7322 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7326 LDKUpdateAddHTLC this_ptr_conv;
7327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7329 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7333 LDKUpdateAddHTLC this_ptr_conv;
7334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7336 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7340 LDKUpdateAddHTLC this_ptr_conv;
7341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7343 return UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7346 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7347 LDKUpdateAddHTLC this_ptr_conv;
7348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7350 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7351 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7356 LDKUpdateAddHTLC this_ptr_conv;
7357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7359 LDKThirtyTwoBytes val_ref;
7360 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7361 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7364 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7365 LDKUpdateAddHTLC this_ptr_conv;
7366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7368 return UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7372 LDKUpdateAddHTLC this_ptr_conv;
7373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7375 return UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7379 LDKUpdateFulfillHTLC this_ptr_conv;
7380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7382 return UpdateFulfillHTLC_free(this_ptr_conv);
7385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7386 LDKUpdateFulfillHTLC orig_conv;
7387 orig_conv.inner = (void*)(orig & (~1));
7388 orig_conv.is_owned = (orig & 1) || (orig == 0);
7389 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7390 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7394 LDKUpdateFulfillHTLC this_ptr_conv;
7395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7397 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7398 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7403 LDKUpdateFulfillHTLC this_ptr_conv;
7404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7406 LDKThirtyTwoBytes val_ref;
7407 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7408 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7412 LDKUpdateFulfillHTLC this_ptr_conv;
7413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7415 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7419 LDKUpdateFulfillHTLC this_ptr_conv;
7420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7422 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7426 LDKUpdateFulfillHTLC this_ptr_conv;
7427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7429 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7430 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7435 LDKUpdateFulfillHTLC this_ptr_conv;
7436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7438 LDKThirtyTwoBytes val_ref;
7439 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7440 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong htlc_id_arg, jbyteArray payment_preimage_arg) {
7444 LDKThirtyTwoBytes channel_id_arg_ref;
7445 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7446 LDKThirtyTwoBytes payment_preimage_arg_ref;
7447 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7448 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7449 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7453 LDKUpdateFailHTLC this_ptr_conv;
7454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7456 return UpdateFailHTLC_free(this_ptr_conv);
7459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7460 LDKUpdateFailHTLC orig_conv;
7461 orig_conv.inner = (void*)(orig & (~1));
7462 orig_conv.is_owned = (orig & 1) || (orig == 0);
7463 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7464 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7468 LDKUpdateFailHTLC this_ptr_conv;
7469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7471 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7472 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7477 LDKUpdateFailHTLC this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7480 LDKThirtyTwoBytes val_ref;
7481 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7482 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7486 LDKUpdateFailHTLC this_ptr_conv;
7487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7489 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7493 LDKUpdateFailHTLC this_ptr_conv;
7494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7496 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7500 LDKUpdateFailMalformedHTLC this_ptr_conv;
7501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7503 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7507 LDKUpdateFailMalformedHTLC orig_conv;
7508 orig_conv.inner = (void*)(orig & (~1));
7509 orig_conv.is_owned = (orig & 1) || (orig == 0);
7510 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7511 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7514 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7515 LDKUpdateFailMalformedHTLC this_ptr_conv;
7516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7518 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7519 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7524 LDKUpdateFailMalformedHTLC this_ptr_conv;
7525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7527 LDKThirtyTwoBytes val_ref;
7528 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7529 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7533 LDKUpdateFailMalformedHTLC this_ptr_conv;
7534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7536 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7540 LDKUpdateFailMalformedHTLC this_ptr_conv;
7541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7543 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7546 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7547 LDKUpdateFailMalformedHTLC this_ptr_conv;
7548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7550 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7554 LDKUpdateFailMalformedHTLC this_ptr_conv;
7555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7557 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7561 LDKCommitmentSigned this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7564 return CommitmentSigned_free(this_ptr_conv);
7567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7568 LDKCommitmentSigned orig_conv;
7569 orig_conv.inner = (void*)(orig & (~1));
7570 orig_conv.is_owned = (orig & 1) || (orig == 0);
7571 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7572 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7576 LDKCommitmentSigned this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7579 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7580 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7585 LDKCommitmentSigned this_ptr_conv;
7586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7588 LDKThirtyTwoBytes val_ref;
7589 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7590 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7594 LDKCommitmentSigned this_ptr_conv;
7595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7597 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7598 *ret = CommitmentSigned_get_signature(&this_ptr_conv);
7602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7603 LDKCommitmentSigned this_ptr_conv;
7604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7606 LDKSignature val_conv = *(LDKSignature*)val;
7608 return CommitmentSigned_set_signature(&this_ptr_conv, val_conv);
7611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7612 LDKCommitmentSigned this_ptr_conv;
7613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7615 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7617 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) {
7621 LDKThirtyTwoBytes channel_id_arg_ref;
7622 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7623 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7624 FREE((void*)signature_arg);
7625 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7626 FREE((void*)htlc_signatures_arg);
7627 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv);
7628 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7632 LDKRevokeAndACK this_ptr_conv;
7633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7635 return RevokeAndACK_free(this_ptr_conv);
7638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7639 LDKRevokeAndACK orig_conv;
7640 orig_conv.inner = (void*)(orig & (~1));
7641 orig_conv.is_owned = (orig & 1) || (orig == 0);
7642 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7643 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7646 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7647 LDKRevokeAndACK this_ptr_conv;
7648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7650 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7651 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7656 LDKRevokeAndACK this_ptr_conv;
7657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7659 LDKThirtyTwoBytes val_ref;
7660 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7661 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7664 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7665 LDKRevokeAndACK this_ptr_conv;
7666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7668 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7669 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7674 LDKRevokeAndACK this_ptr_conv;
7675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7677 LDKThirtyTwoBytes val_ref;
7678 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7679 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7682 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7683 LDKRevokeAndACK this_ptr_conv;
7684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7686 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7687 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7692 LDKRevokeAndACK this_ptr_conv;
7693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7695 LDKPublicKey val_ref;
7696 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7697 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray per_commitment_secret_arg, jbyteArray next_per_commitment_point_arg) {
7701 LDKThirtyTwoBytes channel_id_arg_ref;
7702 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7703 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7704 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7705 LDKPublicKey next_per_commitment_point_arg_ref;
7706 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7707 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7708 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7712 LDKUpdateFee this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 return UpdateFee_free(this_ptr_conv);
7718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7719 LDKUpdateFee orig_conv;
7720 orig_conv.inner = (void*)(orig & (~1));
7721 orig_conv.is_owned = (orig & 1) || (orig == 0);
7722 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
7723 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7726 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7727 LDKUpdateFee this_ptr_conv;
7728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7730 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7731 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7736 LDKUpdateFee this_ptr_conv;
7737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7739 LDKThirtyTwoBytes val_ref;
7740 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7741 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7744 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7745 LDKUpdateFee this_ptr_conv;
7746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7748 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7752 LDKUpdateFee this_ptr_conv;
7753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7755 return UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7759 LDKThirtyTwoBytes channel_id_arg_ref;
7760 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7761 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7762 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7766 LDKDataLossProtect this_ptr_conv;
7767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7769 return DataLossProtect_free(this_ptr_conv);
7772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7773 LDKDataLossProtect orig_conv;
7774 orig_conv.inner = (void*)(orig & (~1));
7775 orig_conv.is_owned = (orig & 1) || (orig == 0);
7776 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
7777 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7781 LDKDataLossProtect this_ptr_conv;
7782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7784 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7785 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7790 LDKDataLossProtect this_ptr_conv;
7791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7793 LDKThirtyTwoBytes val_ref;
7794 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7795 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7798 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7799 LDKDataLossProtect this_ptr_conv;
7800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7802 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7803 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
7807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7808 LDKDataLossProtect this_ptr_conv;
7809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7811 LDKPublicKey val_ref;
7812 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7813 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
7816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jbyteArray your_last_per_commitment_secret_arg, jbyteArray my_current_per_commitment_point_arg) {
7817 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7818 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7819 LDKPublicKey my_current_per_commitment_point_arg_ref;
7820 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
7821 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
7822 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7826 LDKChannelReestablish this_ptr_conv;
7827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7829 return ChannelReestablish_free(this_ptr_conv);
7832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7833 LDKChannelReestablish orig_conv;
7834 orig_conv.inner = (void*)(orig & (~1));
7835 orig_conv.is_owned = (orig & 1) || (orig == 0);
7836 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
7837 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7840 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7841 LDKChannelReestablish this_ptr_conv;
7842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7844 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7845 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7850 LDKChannelReestablish this_ptr_conv;
7851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7853 LDKThirtyTwoBytes val_ref;
7854 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7855 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7859 LDKChannelReestablish this_ptr_conv;
7860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7862 return ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7866 LDKChannelReestablish this_ptr_conv;
7867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7869 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7873 LDKChannelReestablish this_ptr_conv;
7874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7876 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7880 LDKChannelReestablish this_ptr_conv;
7881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7883 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
7886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7887 LDKAnnouncementSignatures this_ptr_conv;
7888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7890 return AnnouncementSignatures_free(this_ptr_conv);
7893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7894 LDKAnnouncementSignatures orig_conv;
7895 orig_conv.inner = (void*)(orig & (~1));
7896 orig_conv.is_owned = (orig & 1) || (orig == 0);
7897 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
7898 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7901 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7902 LDKAnnouncementSignatures this_ptr_conv;
7903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7905 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7906 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
7910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7911 LDKAnnouncementSignatures this_ptr_conv;
7912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7914 LDKThirtyTwoBytes val_ref;
7915 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7916 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
7919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7920 LDKAnnouncementSignatures this_ptr_conv;
7921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7923 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
7926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7927 LDKAnnouncementSignatures this_ptr_conv;
7928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7930 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
7933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7934 LDKAnnouncementSignatures this_ptr_conv;
7935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7937 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7938 *ret = AnnouncementSignatures_get_node_signature(&this_ptr_conv);
7942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7943 LDKAnnouncementSignatures this_ptr_conv;
7944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7946 LDKSignature val_conv = *(LDKSignature*)val;
7948 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_conv);
7951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7952 LDKAnnouncementSignatures this_ptr_conv;
7953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7955 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7956 *ret = AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv);
7960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7961 LDKAnnouncementSignatures this_ptr_conv;
7962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7964 LDKSignature val_conv = *(LDKSignature*)val;
7966 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_conv);
7969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) {
7970 LDKThirtyTwoBytes channel_id_arg_ref;
7971 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7972 LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
7973 FREE((void*)node_signature_arg);
7974 LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
7975 FREE((void*)bitcoin_signature_arg);
7976 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
7977 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7981 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
7982 FREE((void*)this_ptr);
7983 return NetAddress_free(this_ptr_conv);
7986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7987 LDKUnsignedNodeAnnouncement this_ptr_conv;
7988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7990 return UnsignedNodeAnnouncement_free(this_ptr_conv);
7993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7994 LDKUnsignedNodeAnnouncement orig_conv;
7995 orig_conv.inner = (void*)(orig & (~1));
7996 orig_conv.is_owned = (orig & 1) || (orig == 0);
7997 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
7998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8002 LDKUnsignedNodeAnnouncement this_ptr_conv;
8003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8005 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8006 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8010 LDKUnsignedNodeAnnouncement this_ptr_conv;
8011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8013 LDKNodeFeatures val_conv;
8014 val_conv.inner = (void*)(val & (~1));
8015 val_conv.is_owned = (val & 1) || (val == 0);
8016 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8019 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8020 LDKUnsignedNodeAnnouncement this_ptr_conv;
8021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8023 return UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8027 LDKUnsignedNodeAnnouncement this_ptr_conv;
8028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8030 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8034 LDKUnsignedNodeAnnouncement this_ptr_conv;
8035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8037 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8038 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8043 LDKUnsignedNodeAnnouncement this_ptr_conv;
8044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8046 LDKPublicKey val_ref;
8047 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8048 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8051 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8052 LDKUnsignedNodeAnnouncement this_ptr_conv;
8053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8055 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8056 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8061 LDKUnsignedNodeAnnouncement this_ptr_conv;
8062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8064 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
8066 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
8069 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8070 LDKUnsignedNodeAnnouncement this_ptr_conv;
8071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8073 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8074 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8079 LDKUnsignedNodeAnnouncement this_ptr_conv;
8080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8082 LDKThirtyTwoBytes val_ref;
8083 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8084 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8088 LDKUnsignedNodeAnnouncement this_ptr_conv;
8089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8091 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8093 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8097 LDKNodeAnnouncement this_ptr_conv;
8098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8100 return NodeAnnouncement_free(this_ptr_conv);
8103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8104 LDKNodeAnnouncement orig_conv;
8105 orig_conv.inner = (void*)(orig & (~1));
8106 orig_conv.is_owned = (orig & 1) || (orig == 0);
8107 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8108 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8112 LDKNodeAnnouncement this_ptr_conv;
8113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8115 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8116 *ret = NodeAnnouncement_get_signature(&this_ptr_conv);
8120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8121 LDKNodeAnnouncement this_ptr_conv;
8122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8124 LDKSignature val_conv = *(LDKSignature*)val;
8126 return NodeAnnouncement_set_signature(&this_ptr_conv, val_conv);
8129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8130 LDKNodeAnnouncement this_ptr_conv;
8131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8133 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8134 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8138 LDKNodeAnnouncement this_ptr_conv;
8139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8141 LDKUnsignedNodeAnnouncement val_conv;
8142 val_conv.inner = (void*)(val & (~1));
8143 val_conv.is_owned = (val & 1) || (val == 0);
8144 if (val_conv.inner != NULL)
8145 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8146 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8150 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8151 FREE((void*)signature_arg);
8152 LDKUnsignedNodeAnnouncement contents_arg_conv;
8153 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8154 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8155 if (contents_arg_conv.inner != NULL)
8156 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8157 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
8158 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8162 LDKUnsignedChannelAnnouncement this_ptr_conv;
8163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8165 return UnsignedChannelAnnouncement_free(this_ptr_conv);
8168 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8169 LDKUnsignedChannelAnnouncement orig_conv;
8170 orig_conv.inner = (void*)(orig & (~1));
8171 orig_conv.is_owned = (orig & 1) || (orig == 0);
8172 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8173 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8177 LDKUnsignedChannelAnnouncement this_ptr_conv;
8178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8180 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8181 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8185 LDKUnsignedChannelAnnouncement this_ptr_conv;
8186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8188 LDKChannelFeatures val_conv;
8189 val_conv.inner = (void*)(val & (~1));
8190 val_conv.is_owned = (val & 1) || (val == 0);
8191 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8194 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8195 LDKUnsignedChannelAnnouncement this_ptr_conv;
8196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8198 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8199 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8204 LDKUnsignedChannelAnnouncement this_ptr_conv;
8205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8206 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8207 LDKThirtyTwoBytes val_ref;
8208 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8209 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8213 LDKUnsignedChannelAnnouncement this_ptr_conv;
8214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8216 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8220 LDKUnsignedChannelAnnouncement this_ptr_conv;
8221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8223 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8226 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8227 LDKUnsignedChannelAnnouncement this_ptr_conv;
8228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8230 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8231 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8236 LDKUnsignedChannelAnnouncement this_ptr_conv;
8237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8239 LDKPublicKey val_ref;
8240 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8241 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8244 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8245 LDKUnsignedChannelAnnouncement this_ptr_conv;
8246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8248 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8249 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8254 LDKUnsignedChannelAnnouncement this_ptr_conv;
8255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8257 LDKPublicKey val_ref;
8258 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8259 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8262 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8263 LDKUnsignedChannelAnnouncement this_ptr_conv;
8264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8266 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8267 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8272 LDKUnsignedChannelAnnouncement this_ptr_conv;
8273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8275 LDKPublicKey val_ref;
8276 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8277 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8280 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8281 LDKUnsignedChannelAnnouncement this_ptr_conv;
8282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8284 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8285 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8290 LDKUnsignedChannelAnnouncement this_ptr_conv;
8291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8293 LDKPublicKey val_ref;
8294 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8295 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8299 LDKChannelAnnouncement this_ptr_conv;
8300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8302 return ChannelAnnouncement_free(this_ptr_conv);
8305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8306 LDKChannelAnnouncement orig_conv;
8307 orig_conv.inner = (void*)(orig & (~1));
8308 orig_conv.is_owned = (orig & 1) || (orig == 0);
8309 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8310 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8314 LDKChannelAnnouncement this_ptr_conv;
8315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8317 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8318 *ret = ChannelAnnouncement_get_node_signature_1(&this_ptr_conv);
8322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8323 LDKChannelAnnouncement this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8326 LDKSignature val_conv = *(LDKSignature*)val;
8328 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_conv);
8331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8332 LDKChannelAnnouncement this_ptr_conv;
8333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8335 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8336 *ret = ChannelAnnouncement_get_node_signature_2(&this_ptr_conv);
8340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8341 LDKChannelAnnouncement this_ptr_conv;
8342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8344 LDKSignature val_conv = *(LDKSignature*)val;
8346 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_conv);
8349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8350 LDKChannelAnnouncement this_ptr_conv;
8351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8353 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8354 *ret = ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv);
8358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8359 LDKChannelAnnouncement this_ptr_conv;
8360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8362 LDKSignature val_conv = *(LDKSignature*)val;
8364 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_conv);
8367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8368 LDKChannelAnnouncement this_ptr_conv;
8369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8371 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8372 *ret = ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv);
8376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8377 LDKChannelAnnouncement this_ptr_conv;
8378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8380 LDKSignature val_conv = *(LDKSignature*)val;
8382 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_conv);
8385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8386 LDKChannelAnnouncement this_ptr_conv;
8387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8389 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8390 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8394 LDKChannelAnnouncement this_ptr_conv;
8395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8397 LDKUnsignedChannelAnnouncement val_conv;
8398 val_conv.inner = (void*)(val & (~1));
8399 val_conv.is_owned = (val & 1) || (val == 0);
8400 if (val_conv.inner != NULL)
8401 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8402 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jlong node_signature_1_arg, jlong node_signature_2_arg, jlong bitcoin_signature_1_arg, jlong bitcoin_signature_2_arg, jlong contents_arg) {
8406 LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
8407 FREE((void*)node_signature_1_arg);
8408 LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
8409 FREE((void*)node_signature_2_arg);
8410 LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
8411 FREE((void*)bitcoin_signature_1_arg);
8412 LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
8413 FREE((void*)bitcoin_signature_2_arg);
8414 LDKUnsignedChannelAnnouncement contents_arg_conv;
8415 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8416 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8417 if (contents_arg_conv.inner != NULL)
8418 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8419 LDKChannelAnnouncement ret = ChannelAnnouncement_new(node_signature_1_arg_conv, node_signature_2_arg_conv, bitcoin_signature_1_arg_conv, bitcoin_signature_2_arg_conv, contents_arg_conv);
8420 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8424 LDKUnsignedChannelUpdate this_ptr_conv;
8425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8427 return UnsignedChannelUpdate_free(this_ptr_conv);
8430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8431 LDKUnsignedChannelUpdate orig_conv;
8432 orig_conv.inner = (void*)(orig & (~1));
8433 orig_conv.is_owned = (orig & 1) || (orig == 0);
8434 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8435 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8438 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8439 LDKUnsignedChannelUpdate this_ptr_conv;
8440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8442 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8443 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8448 LDKUnsignedChannelUpdate this_ptr_conv;
8449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8451 LDKThirtyTwoBytes val_ref;
8452 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8453 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8457 LDKUnsignedChannelUpdate this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8460 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8464 LDKUnsignedChannelUpdate this_ptr_conv;
8465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8467 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8470 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8471 LDKUnsignedChannelUpdate this_ptr_conv;
8472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8474 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8478 LDKUnsignedChannelUpdate this_ptr_conv;
8479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8481 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8484 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8485 LDKUnsignedChannelUpdate this_ptr_conv;
8486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8488 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8492 LDKUnsignedChannelUpdate this_ptr_conv;
8493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8495 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8498 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8499 LDKUnsignedChannelUpdate this_ptr_conv;
8500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8502 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8506 LDKUnsignedChannelUpdate this_ptr_conv;
8507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8509 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8513 LDKUnsignedChannelUpdate this_ptr_conv;
8514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8516 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8520 LDKUnsignedChannelUpdate this_ptr_conv;
8521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8523 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8526 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8527 LDKUnsignedChannelUpdate this_ptr_conv;
8528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8530 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8534 LDKUnsignedChannelUpdate this_ptr_conv;
8535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8537 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8540 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8541 LDKUnsignedChannelUpdate this_ptr_conv;
8542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8544 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8548 LDKUnsignedChannelUpdate this_ptr_conv;
8549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8551 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8555 LDKChannelUpdate this_ptr_conv;
8556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8558 return ChannelUpdate_free(this_ptr_conv);
8561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8562 LDKChannelUpdate orig_conv;
8563 orig_conv.inner = (void*)(orig & (~1));
8564 orig_conv.is_owned = (orig & 1) || (orig == 0);
8565 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8566 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8570 LDKChannelUpdate this_ptr_conv;
8571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8573 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8574 *ret = ChannelUpdate_get_signature(&this_ptr_conv);
8578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8579 LDKChannelUpdate this_ptr_conv;
8580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8582 LDKSignature val_conv = *(LDKSignature*)val;
8584 return ChannelUpdate_set_signature(&this_ptr_conv, val_conv);
8587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8588 LDKChannelUpdate this_ptr_conv;
8589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8590 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8591 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8592 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8596 LDKChannelUpdate this_ptr_conv;
8597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8599 LDKUnsignedChannelUpdate val_conv;
8600 val_conv.inner = (void*)(val & (~1));
8601 val_conv.is_owned = (val & 1) || (val == 0);
8602 if (val_conv.inner != NULL)
8603 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8604 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8608 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8609 FREE((void*)signature_arg);
8610 LDKUnsignedChannelUpdate contents_arg_conv;
8611 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8612 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8613 if (contents_arg_conv.inner != NULL)
8614 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
8615 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
8616 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8620 LDKQueryChannelRange this_ptr_conv;
8621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8623 return QueryChannelRange_free(this_ptr_conv);
8626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8627 LDKQueryChannelRange orig_conv;
8628 orig_conv.inner = (void*)(orig & (~1));
8629 orig_conv.is_owned = (orig & 1) || (orig == 0);
8630 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
8631 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8635 LDKQueryChannelRange this_ptr_conv;
8636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8638 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8639 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8644 LDKQueryChannelRange this_ptr_conv;
8645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8647 LDKThirtyTwoBytes val_ref;
8648 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8649 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8652 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8653 LDKQueryChannelRange this_ptr_conv;
8654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8656 return QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8660 LDKQueryChannelRange this_ptr_conv;
8661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8663 return QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8666 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8667 LDKQueryChannelRange this_ptr_conv;
8668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8670 return QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8674 LDKQueryChannelRange this_ptr_conv;
8675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8677 return QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg) {
8681 LDKThirtyTwoBytes chain_hash_arg_ref;
8682 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8683 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8684 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8688 LDKReplyChannelRange this_ptr_conv;
8689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8691 return ReplyChannelRange_free(this_ptr_conv);
8694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8695 LDKReplyChannelRange orig_conv;
8696 orig_conv.inner = (void*)(orig & (~1));
8697 orig_conv.is_owned = (orig & 1) || (orig == 0);
8698 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
8699 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8702 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8703 LDKReplyChannelRange this_ptr_conv;
8704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8706 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8707 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8712 LDKReplyChannelRange this_ptr_conv;
8713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8715 LDKThirtyTwoBytes val_ref;
8716 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8717 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8720 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8721 LDKReplyChannelRange this_ptr_conv;
8722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8724 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8728 LDKReplyChannelRange this_ptr_conv;
8729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8731 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8734 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8735 LDKReplyChannelRange this_ptr_conv;
8736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8738 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8742 LDKReplyChannelRange this_ptr_conv;
8743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8745 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8749 LDKReplyChannelRange this_ptr_conv;
8750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8752 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8756 LDKReplyChannelRange this_ptr_conv;
8757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8759 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8763 LDKReplyChannelRange this_ptr_conv;
8764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8766 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8768 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg, jboolean full_information_arg, jlong short_channel_ids_arg) {
8772 LDKThirtyTwoBytes chain_hash_arg_ref;
8773 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8774 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8775 FREE((void*)short_channel_ids_arg);
8776 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8777 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8781 LDKQueryShortChannelIds this_ptr_conv;
8782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8784 return QueryShortChannelIds_free(this_ptr_conv);
8787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8788 LDKQueryShortChannelIds orig_conv;
8789 orig_conv.inner = (void*)(orig & (~1));
8790 orig_conv.is_owned = (orig & 1) || (orig == 0);
8791 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
8792 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8795 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8796 LDKQueryShortChannelIds this_ptr_conv;
8797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8799 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8800 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8805 LDKQueryShortChannelIds this_ptr_conv;
8806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8808 LDKThirtyTwoBytes val_ref;
8809 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8810 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8814 LDKQueryShortChannelIds this_ptr_conv;
8815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8817 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8819 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8823 LDKThirtyTwoBytes chain_hash_arg_ref;
8824 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8825 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8826 FREE((void*)short_channel_ids_arg);
8827 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8832 LDKReplyShortChannelIdsEnd this_ptr_conv;
8833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8835 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8839 LDKReplyShortChannelIdsEnd orig_conv;
8840 orig_conv.inner = (void*)(orig & (~1));
8841 orig_conv.is_owned = (orig & 1) || (orig == 0);
8842 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
8843 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8846 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8847 LDKReplyShortChannelIdsEnd this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8850 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8851 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
8855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8856 LDKReplyShortChannelIdsEnd this_ptr_conv;
8857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8859 LDKThirtyTwoBytes val_ref;
8860 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8861 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
8864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8865 LDKReplyShortChannelIdsEnd this_ptr_conv;
8866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8868 return ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
8871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8872 LDKReplyShortChannelIdsEnd this_ptr_conv;
8873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8875 return ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
8878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
8879 LDKThirtyTwoBytes chain_hash_arg_ref;
8880 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8881 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
8882 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8886 LDKGossipTimestampFilter this_ptr_conv;
8887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8889 return GossipTimestampFilter_free(this_ptr_conv);
8892 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8893 LDKGossipTimestampFilter orig_conv;
8894 orig_conv.inner = (void*)(orig & (~1));
8895 orig_conv.is_owned = (orig & 1) || (orig == 0);
8896 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
8897 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8900 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8901 LDKGossipTimestampFilter this_ptr_conv;
8902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8904 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8905 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
8909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8910 LDKGossipTimestampFilter this_ptr_conv;
8911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8913 LDKThirtyTwoBytes val_ref;
8914 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8915 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
8918 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8919 LDKGossipTimestampFilter this_ptr_conv;
8920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8922 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
8925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8926 LDKGossipTimestampFilter this_ptr_conv;
8927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8929 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
8932 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
8933 LDKGossipTimestampFilter this_ptr_conv;
8934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8936 return GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
8939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8940 LDKGossipTimestampFilter this_ptr_conv;
8941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8943 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
8946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_timestamp_arg, jint timestamp_range_arg) {
8947 LDKThirtyTwoBytes chain_hash_arg_ref;
8948 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8949 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
8950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8954 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
8955 FREE((void*)this_ptr);
8956 return ErrorAction_free(this_ptr_conv);
8959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8960 LDKLightningError this_ptr_conv;
8961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8963 return LightningError_free(this_ptr_conv);
8966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
8967 LDKLightningError this_ptr_conv;
8968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8970 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
8971 *ret = LightningError_get_err(&this_ptr_conv);
8975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8976 LDKLightningError this_ptr_conv;
8977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8979 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
8981 return LightningError_set_err(&this_ptr_conv, val_conv);
8984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
8985 LDKLightningError this_ptr_conv;
8986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8988 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
8989 *ret = LightningError_get_action(&this_ptr_conv);
8993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8994 LDKLightningError this_ptr_conv;
8995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8997 LDKErrorAction val_conv = *(LDKErrorAction*)val;
8999 return LightningError_set_action(&this_ptr_conv, val_conv);
9002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
9003 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
9004 FREE((void*)err_arg);
9005 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9006 FREE((void*)action_arg);
9007 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
9008 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9012 LDKCommitmentUpdate this_ptr_conv;
9013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9015 return CommitmentUpdate_free(this_ptr_conv);
9018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9019 LDKCommitmentUpdate orig_conv;
9020 orig_conv.inner = (void*)(orig & (~1));
9021 orig_conv.is_owned = (orig & 1) || (orig == 0);
9022 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9023 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9027 LDKCommitmentUpdate this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9030 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9032 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9036 LDKCommitmentUpdate this_ptr_conv;
9037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9039 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9041 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9045 LDKCommitmentUpdate this_ptr_conv;
9046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9048 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9050 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9054 LDKCommitmentUpdate this_ptr_conv;
9055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9057 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9059 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9063 LDKCommitmentUpdate this_ptr_conv;
9064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9066 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9067 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9071 LDKCommitmentUpdate this_ptr_conv;
9072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9074 LDKUpdateFee val_conv;
9075 val_conv.inner = (void*)(val & (~1));
9076 val_conv.is_owned = (val & 1) || (val == 0);
9077 if (val_conv.inner != NULL)
9078 val_conv = UpdateFee_clone(&val_conv);
9079 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9083 LDKCommitmentUpdate this_ptr_conv;
9084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9086 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9087 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9091 LDKCommitmentUpdate this_ptr_conv;
9092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9094 LDKCommitmentSigned val_conv;
9095 val_conv.inner = (void*)(val & (~1));
9096 val_conv.is_owned = (val & 1) || (val == 0);
9097 if (val_conv.inner != NULL)
9098 val_conv = CommitmentSigned_clone(&val_conv);
9099 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv * _env, jclass _b, jlong update_add_htlcs_arg, jlong update_fulfill_htlcs_arg, jlong update_fail_htlcs_arg, jlong update_fail_malformed_htlcs_arg, jlong update_fee_arg, jlong commitment_signed_arg) {
9103 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9104 FREE((void*)update_add_htlcs_arg);
9105 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9106 FREE((void*)update_fulfill_htlcs_arg);
9107 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9108 FREE((void*)update_fail_htlcs_arg);
9109 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9110 FREE((void*)update_fail_malformed_htlcs_arg);
9111 LDKUpdateFee update_fee_arg_conv;
9112 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9113 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9114 if (update_fee_arg_conv.inner != NULL)
9115 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9116 LDKCommitmentSigned commitment_signed_arg_conv;
9117 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9118 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9119 if (commitment_signed_arg_conv.inner != NULL)
9120 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9121 LDKCommitmentUpdate ret = CommitmentUpdate_new(update_add_htlcs_arg_conv, update_fulfill_htlcs_arg_conv, update_fail_htlcs_arg_conv, update_fail_malformed_htlcs_arg_conv, update_fee_arg_conv, commitment_signed_arg_conv);
9122 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9126 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9127 FREE((void*)this_ptr);
9128 return HTLCFailChannelUpdate_free(this_ptr_conv);
9131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9132 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9133 FREE((void*)this_ptr);
9134 return ChannelMessageHandler_free(this_ptr_conv);
9137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9138 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9139 FREE((void*)this_ptr);
9140 return RoutingMessageHandler_free(this_ptr_conv);
9143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9144 LDKAcceptChannel obj_conv;
9145 obj_conv.inner = (void*)(obj & (~1));
9146 obj_conv.is_owned = (obj & 1) || (obj == 0);
9147 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9148 *ret = AcceptChannel_write(&obj_conv);
9152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9153 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9154 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
9155 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9159 LDKAnnouncementSignatures obj_conv;
9160 obj_conv.inner = (void*)(obj & (~1));
9161 obj_conv.is_owned = (obj & 1) || (obj == 0);
9162 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9163 *ret = AnnouncementSignatures_write(&obj_conv);
9167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
9168 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9169 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
9170 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9174 LDKChannelReestablish obj_conv;
9175 obj_conv.inner = (void*)(obj & (~1));
9176 obj_conv.is_owned = (obj & 1) || (obj == 0);
9177 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9178 *ret = ChannelReestablish_write(&obj_conv);
9182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
9183 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9184 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
9185 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9189 LDKClosingSigned obj_conv;
9190 obj_conv.inner = (void*)(obj & (~1));
9191 obj_conv.is_owned = (obj & 1) || (obj == 0);
9192 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9193 *ret = ClosingSigned_write(&obj_conv);
9197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9198 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9199 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
9200 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9204 LDKCommitmentSigned obj_conv;
9205 obj_conv.inner = (void*)(obj & (~1));
9206 obj_conv.is_owned = (obj & 1) || (obj == 0);
9207 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9208 *ret = CommitmentSigned_write(&obj_conv);
9212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9213 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9214 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
9215 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9219 LDKFundingCreated obj_conv;
9220 obj_conv.inner = (void*)(obj & (~1));
9221 obj_conv.is_owned = (obj & 1) || (obj == 0);
9222 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9223 *ret = FundingCreated_write(&obj_conv);
9227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
9228 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9229 LDKFundingCreated ret = FundingCreated_read(ser_conv);
9230 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9234 LDKFundingSigned obj_conv;
9235 obj_conv.inner = (void*)(obj & (~1));
9236 obj_conv.is_owned = (obj & 1) || (obj == 0);
9237 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9238 *ret = FundingSigned_write(&obj_conv);
9242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9243 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9244 LDKFundingSigned ret = FundingSigned_read(ser_conv);
9245 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9249 LDKFundingLocked obj_conv;
9250 obj_conv.inner = (void*)(obj & (~1));
9251 obj_conv.is_owned = (obj & 1) || (obj == 0);
9252 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9253 *ret = FundingLocked_write(&obj_conv);
9257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
9258 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9259 LDKFundingLocked ret = FundingLocked_read(ser_conv);
9260 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9265 obj_conv.inner = (void*)(obj & (~1));
9266 obj_conv.is_owned = (obj & 1) || (obj == 0);
9267 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9268 *ret = Init_write(&obj_conv);
9272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
9273 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9274 LDKInit ret = Init_read(ser_conv);
9275 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9279 LDKOpenChannel obj_conv;
9280 obj_conv.inner = (void*)(obj & (~1));
9281 obj_conv.is_owned = (obj & 1) || (obj == 0);
9282 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9283 *ret = OpenChannel_write(&obj_conv);
9287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9288 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9289 LDKOpenChannel ret = OpenChannel_read(ser_conv);
9290 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9294 LDKRevokeAndACK obj_conv;
9295 obj_conv.inner = (void*)(obj & (~1));
9296 obj_conv.is_owned = (obj & 1) || (obj == 0);
9297 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9298 *ret = RevokeAndACK_write(&obj_conv);
9302 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
9303 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9304 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
9305 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9309 LDKShutdown obj_conv;
9310 obj_conv.inner = (void*)(obj & (~1));
9311 obj_conv.is_owned = (obj & 1) || (obj == 0);
9312 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9313 *ret = Shutdown_write(&obj_conv);
9317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
9318 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9319 LDKShutdown ret = Shutdown_read(ser_conv);
9320 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9324 LDKUpdateFailHTLC obj_conv;
9325 obj_conv.inner = (void*)(obj & (~1));
9326 obj_conv.is_owned = (obj & 1) || (obj == 0);
9327 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9328 *ret = UpdateFailHTLC_write(&obj_conv);
9332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9333 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9334 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
9335 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9339 LDKUpdateFailMalformedHTLC obj_conv;
9340 obj_conv.inner = (void*)(obj & (~1));
9341 obj_conv.is_owned = (obj & 1) || (obj == 0);
9342 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9343 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
9347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9348 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9349 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
9350 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9353 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9354 LDKUpdateFee obj_conv;
9355 obj_conv.inner = (void*)(obj & (~1));
9356 obj_conv.is_owned = (obj & 1) || (obj == 0);
9357 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9358 *ret = UpdateFee_write(&obj_conv);
9362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
9363 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9364 LDKUpdateFee ret = UpdateFee_read(ser_conv);
9365 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9369 LDKUpdateFulfillHTLC obj_conv;
9370 obj_conv.inner = (void*)(obj & (~1));
9371 obj_conv.is_owned = (obj & 1) || (obj == 0);
9372 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9373 *ret = UpdateFulfillHTLC_write(&obj_conv);
9377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9378 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9379 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
9380 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9384 LDKUpdateAddHTLC obj_conv;
9385 obj_conv.inner = (void*)(obj & (~1));
9386 obj_conv.is_owned = (obj & 1) || (obj == 0);
9387 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9388 *ret = UpdateAddHTLC_write(&obj_conv);
9392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9393 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9394 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
9395 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9400 obj_conv.inner = (void*)(obj & (~1));
9401 obj_conv.is_owned = (obj & 1) || (obj == 0);
9402 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9403 *ret = Ping_write(&obj_conv);
9407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
9408 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9409 LDKPing ret = Ping_read(ser_conv);
9410 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9415 obj_conv.inner = (void*)(obj & (~1));
9416 obj_conv.is_owned = (obj & 1) || (obj == 0);
9417 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9418 *ret = Pong_write(&obj_conv);
9422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
9423 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9424 LDKPong ret = Pong_read(ser_conv);
9425 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9429 LDKUnsignedChannelAnnouncement obj_conv;
9430 obj_conv.inner = (void*)(obj & (~1));
9431 obj_conv.is_owned = (obj & 1) || (obj == 0);
9432 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9433 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9438 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9439 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
9440 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9444 LDKChannelAnnouncement obj_conv;
9445 obj_conv.inner = (void*)(obj & (~1));
9446 obj_conv.is_owned = (obj & 1) || (obj == 0);
9447 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9448 *ret = ChannelAnnouncement_write(&obj_conv);
9452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9453 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9454 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
9455 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9459 LDKUnsignedChannelUpdate obj_conv;
9460 obj_conv.inner = (void*)(obj & (~1));
9461 obj_conv.is_owned = (obj & 1) || (obj == 0);
9462 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9463 *ret = UnsignedChannelUpdate_write(&obj_conv);
9467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9468 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9469 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
9470 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9474 LDKChannelUpdate obj_conv;
9475 obj_conv.inner = (void*)(obj & (~1));
9476 obj_conv.is_owned = (obj & 1) || (obj == 0);
9477 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9478 *ret = ChannelUpdate_write(&obj_conv);
9482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9483 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9484 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
9485 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9489 LDKErrorMessage obj_conv;
9490 obj_conv.inner = (void*)(obj & (~1));
9491 obj_conv.is_owned = (obj & 1) || (obj == 0);
9492 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9493 *ret = ErrorMessage_write(&obj_conv);
9497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
9498 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9499 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
9500 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9504 LDKUnsignedNodeAnnouncement obj_conv;
9505 obj_conv.inner = (void*)(obj & (~1));
9506 obj_conv.is_owned = (obj & 1) || (obj == 0);
9507 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9508 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9513 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9514 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
9515 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9519 LDKNodeAnnouncement obj_conv;
9520 obj_conv.inner = (void*)(obj & (~1));
9521 obj_conv.is_owned = (obj & 1) || (obj == 0);
9522 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9523 *ret = NodeAnnouncement_write(&obj_conv);
9527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9528 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9529 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9530 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9534 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9535 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9536 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9540 LDKQueryShortChannelIds obj_conv;
9541 obj_conv.inner = (void*)(obj & (~1));
9542 obj_conv.is_owned = (obj & 1) || (obj == 0);
9543 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9544 *ret = QueryShortChannelIds_write(&obj_conv);
9548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9549 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9550 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9551 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9555 LDKReplyShortChannelIdsEnd obj_conv;
9556 obj_conv.inner = (void*)(obj & (~1));
9557 obj_conv.is_owned = (obj & 1) || (obj == 0);
9558 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9559 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9564 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9565 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9566 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9570 LDKQueryChannelRange obj_conv;
9571 obj_conv.inner = (void*)(obj & (~1));
9572 obj_conv.is_owned = (obj & 1) || (obj == 0);
9573 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9574 *ret = QueryChannelRange_write(&obj_conv);
9578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9579 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9580 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9581 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9585 LDKReplyChannelRange obj_conv;
9586 obj_conv.inner = (void*)(obj & (~1));
9587 obj_conv.is_owned = (obj & 1) || (obj == 0);
9588 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9589 *ret = ReplyChannelRange_write(&obj_conv);
9593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9594 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9595 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9596 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9600 LDKGossipTimestampFilter obj_conv;
9601 obj_conv.inner = (void*)(obj & (~1));
9602 obj_conv.is_owned = (obj & 1) || (obj == 0);
9603 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9604 *ret = GossipTimestampFilter_write(&obj_conv);
9608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9609 LDKMessageHandler this_ptr_conv;
9610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9612 return MessageHandler_free(this_ptr_conv);
9615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9616 LDKMessageHandler this_ptr_conv;
9617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9619 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9624 LDKMessageHandler this_ptr_conv;
9625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9627 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9628 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9629 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9630 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9632 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9636 LDKMessageHandler this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9639 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9644 LDKMessageHandler this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9647 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9648 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9649 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9650 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9652 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9656 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9657 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9658 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9659 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9661 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9662 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9663 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9664 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9666 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9667 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9671 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9672 FREE((void*)this_ptr);
9673 return SocketDescriptor_free(this_ptr_conv);
9676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9677 LDKPeerHandleError this_ptr_conv;
9678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9680 return PeerHandleError_free(this_ptr_conv);
9683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9684 LDKPeerHandleError this_ptr_conv;
9685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9687 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9691 LDKPeerHandleError this_ptr_conv;
9692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9694 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9698 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9699 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9703 LDKPeerManager this_ptr_conv;
9704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9706 return PeerManager_free(this_ptr_conv);
9709 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jbyteArray our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
9710 LDKMessageHandler message_handler_conv;
9711 message_handler_conv.inner = (void*)(message_handler & (~1));
9712 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9713 LDKSecretKey our_node_secret_ref;
9714 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
9715 unsigned char ephemeral_random_data_arr[32];
9716 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9717 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9718 LDKLogger logger_conv = *(LDKLogger*)logger;
9719 if (logger_conv.free == LDKLogger_JCalls_free) {
9720 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9721 LDKLogger_JCalls_clone(logger_conv.this_arg);
9723 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
9724 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9728 LDKPeerManager this_arg_conv;
9729 this_arg_conv.inner = (void*)(this_arg & (~1));
9730 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9731 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9732 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong descriptor) {
9737 LDKPeerManager this_arg_conv;
9738 this_arg_conv.inner = (void*)(this_arg & (~1));
9739 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9740 LDKPublicKey their_node_id_ref;
9741 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9742 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9743 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9744 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9745 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9747 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9748 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
9752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9753 LDKPeerManager this_arg_conv;
9754 this_arg_conv.inner = (void*)(this_arg & (~1));
9755 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9756 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9757 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9758 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9759 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9761 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9762 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9767 LDKPeerManager this_arg_conv;
9768 this_arg_conv.inner = (void*)(this_arg & (~1));
9769 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9770 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9771 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9772 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9777 LDKPeerManager this_arg_conv;
9778 this_arg_conv.inner = (void*)(this_arg & (~1));
9779 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9780 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9781 LDKu8slice data_conv = *(LDKu8slice*)data;
9782 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9783 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9788 LDKPeerManager this_arg_conv;
9789 this_arg_conv.inner = (void*)(this_arg & (~1));
9790 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9791 return PeerManager_process_events(&this_arg_conv);
9794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9795 LDKPeerManager this_arg_conv;
9796 this_arg_conv.inner = (void*)(this_arg & (~1));
9797 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9798 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9799 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9803 LDKPeerManager this_arg_conv;
9804 this_arg_conv.inner = (void*)(this_arg & (~1));
9805 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9806 return PeerManager_timer_tick_occured(&this_arg_conv);
9809 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9810 unsigned char commitment_seed_arr[32];
9811 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9812 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9813 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9814 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
9819 LDKPublicKey per_commitment_point_ref;
9820 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9821 unsigned char base_secret_arr[32];
9822 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9823 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9824 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9825 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
9829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
9830 LDKPublicKey per_commitment_point_ref;
9831 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9832 LDKPublicKey base_point_ref;
9833 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
9834 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9835 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
9839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_secret, jbyteArray countersignatory_revocation_base_secret) {
9840 unsigned char per_commitment_secret_arr[32];
9841 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
9842 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
9843 unsigned char countersignatory_revocation_base_secret_arr[32];
9844 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
9845 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
9846 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9847 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
9851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray countersignatory_revocation_base_point) {
9852 LDKPublicKey per_commitment_point_ref;
9853 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9854 LDKPublicKey countersignatory_revocation_base_point_ref;
9855 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
9856 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9857 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
9861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9862 LDKTxCreationKeys this_ptr_conv;
9863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9865 return TxCreationKeys_free(this_ptr_conv);
9868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9869 LDKTxCreationKeys orig_conv;
9870 orig_conv.inner = (void*)(orig & (~1));
9871 orig_conv.is_owned = (orig & 1) || (orig == 0);
9872 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
9873 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9876 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9877 LDKTxCreationKeys this_ptr_conv;
9878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9880 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9881 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
9885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9886 LDKTxCreationKeys this_ptr_conv;
9887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9889 LDKPublicKey val_ref;
9890 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9891 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
9894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9895 LDKTxCreationKeys this_ptr_conv;
9896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9898 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9899 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
9903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9904 LDKTxCreationKeys this_ptr_conv;
9905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9907 LDKPublicKey val_ref;
9908 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9909 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
9912 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9913 LDKTxCreationKeys this_ptr_conv;
9914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9916 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9917 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
9921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9922 LDKTxCreationKeys this_ptr_conv;
9923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9925 LDKPublicKey val_ref;
9926 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9927 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
9930 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9931 LDKTxCreationKeys this_ptr_conv;
9932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9934 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9935 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
9939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9940 LDKTxCreationKeys this_ptr_conv;
9941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9943 LDKPublicKey val_ref;
9944 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9945 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
9948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9949 LDKTxCreationKeys this_ptr_conv;
9950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9952 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9953 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
9957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9958 LDKTxCreationKeys this_ptr_conv;
9959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9961 LDKPublicKey val_ref;
9962 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9963 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
9966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point_arg, jbyteArray revocation_key_arg, jbyteArray broadcaster_htlc_key_arg, jbyteArray countersignatory_htlc_key_arg, jbyteArray broadcaster_delayed_payment_key_arg) {
9967 LDKPublicKey per_commitment_point_arg_ref;
9968 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
9969 LDKPublicKey revocation_key_arg_ref;
9970 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
9971 LDKPublicKey broadcaster_htlc_key_arg_ref;
9972 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
9973 LDKPublicKey countersignatory_htlc_key_arg_ref;
9974 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
9975 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
9976 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
9977 LDKTxCreationKeys ret = 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);
9978 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9982 LDKTxCreationKeys obj_conv;
9983 obj_conv.inner = (void*)(obj & (~1));
9984 obj_conv.is_owned = (obj & 1) || (obj == 0);
9985 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9986 *ret = TxCreationKeys_write(&obj_conv);
9990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9991 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9992 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
9993 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9997 LDKPreCalculatedTxCreationKeys this_ptr_conv;
9998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10000 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
10003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10004 LDKTxCreationKeys keys_conv;
10005 keys_conv.inner = (void*)(keys & (~1));
10006 keys_conv.is_owned = (keys & 1) || (keys == 0);
10007 if (keys_conv.inner != NULL)
10008 keys_conv = TxCreationKeys_clone(&keys_conv);
10009 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10010 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10014 LDKPreCalculatedTxCreationKeys this_arg_conv;
10015 this_arg_conv.inner = (void*)(this_arg & (~1));
10016 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10017 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10018 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10021 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10022 LDKPreCalculatedTxCreationKeys this_arg_conv;
10023 this_arg_conv.inner = (void*)(this_arg & (~1));
10024 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10025 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10026 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10031 LDKChannelPublicKeys this_ptr_conv;
10032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10034 return ChannelPublicKeys_free(this_ptr_conv);
10037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10038 LDKChannelPublicKeys orig_conv;
10039 orig_conv.inner = (void*)(orig & (~1));
10040 orig_conv.is_owned = (orig & 1) || (orig == 0);
10041 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10042 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10045 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10046 LDKChannelPublicKeys this_ptr_conv;
10047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10049 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10050 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10055 LDKChannelPublicKeys this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10058 LDKPublicKey val_ref;
10059 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10060 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10063 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10064 LDKChannelPublicKeys this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10067 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10068 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10073 LDKChannelPublicKeys this_ptr_conv;
10074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10076 LDKPublicKey val_ref;
10077 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10078 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10081 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10082 LDKChannelPublicKeys this_ptr_conv;
10083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10085 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10086 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10091 LDKChannelPublicKeys this_ptr_conv;
10092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10094 LDKPublicKey val_ref;
10095 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10096 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10099 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10100 LDKChannelPublicKeys this_ptr_conv;
10101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10103 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10104 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10109 LDKChannelPublicKeys this_ptr_conv;
10110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10112 LDKPublicKey val_ref;
10113 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10114 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10117 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10118 LDKChannelPublicKeys this_ptr_conv;
10119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10121 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10122 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10127 LDKChannelPublicKeys this_ptr_conv;
10128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10130 LDKPublicKey val_ref;
10131 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10132 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_pubkey_arg, jbyteArray revocation_basepoint_arg, jbyteArray payment_point_arg, jbyteArray delayed_payment_basepoint_arg, jbyteArray htlc_basepoint_arg) {
10136 LDKPublicKey funding_pubkey_arg_ref;
10137 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10138 LDKPublicKey revocation_basepoint_arg_ref;
10139 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10140 LDKPublicKey payment_point_arg_ref;
10141 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10142 LDKPublicKey delayed_payment_basepoint_arg_ref;
10143 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10144 LDKPublicKey htlc_basepoint_arg_ref;
10145 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10146 LDKChannelPublicKeys ret = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
10147 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10151 LDKChannelPublicKeys obj_conv;
10152 obj_conv.inner = (void*)(obj & (~1));
10153 obj_conv.is_owned = (obj & 1) || (obj == 0);
10154 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10155 *ret = ChannelPublicKeys_write(&obj_conv);
10159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
10160 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10161 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
10162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray broadcaster_delayed_payment_base, jbyteArray broadcaster_htlc_base, jbyteArray countersignatory_revocation_base, jbyteArray countersignatory_htlc_base) {
10166 LDKPublicKey per_commitment_point_ref;
10167 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10168 LDKPublicKey broadcaster_delayed_payment_base_ref;
10169 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10170 LDKPublicKey broadcaster_htlc_base_ref;
10171 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10172 LDKPublicKey countersignatory_revocation_base_ref;
10173 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10174 LDKPublicKey countersignatory_htlc_base_ref;
10175 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10176 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10177 *ret = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
10181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
10182 LDKPublicKey revocation_key_ref;
10183 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10184 LDKPublicKey broadcaster_delayed_payment_key_ref;
10185 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10186 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10187 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10192 LDKHTLCOutputInCommitment this_ptr_conv;
10193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10194 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10195 return HTLCOutputInCommitment_free(this_ptr_conv);
10198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10199 LDKHTLCOutputInCommitment orig_conv;
10200 orig_conv.inner = (void*)(orig & (~1));
10201 orig_conv.is_owned = (orig & 1) || (orig == 0);
10202 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10203 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10207 LDKHTLCOutputInCommitment this_ptr_conv;
10208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10210 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10214 LDKHTLCOutputInCommitment this_ptr_conv;
10215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10217 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10221 LDKHTLCOutputInCommitment this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10224 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10228 LDKHTLCOutputInCommitment this_ptr_conv;
10229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10231 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10234 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10235 LDKHTLCOutputInCommitment this_ptr_conv;
10236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10238 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10242 LDKHTLCOutputInCommitment this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10245 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10249 LDKHTLCOutputInCommitment this_ptr_conv;
10250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10252 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10253 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10258 LDKHTLCOutputInCommitment this_ptr_conv;
10259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10261 LDKThirtyTwoBytes val_ref;
10262 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10263 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10267 LDKHTLCOutputInCommitment obj_conv;
10268 obj_conv.inner = (void*)(obj & (~1));
10269 obj_conv.is_owned = (obj & 1) || (obj == 0);
10270 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10271 *ret = HTLCOutputInCommitment_write(&obj_conv);
10275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
10276 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10277 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
10278 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10282 LDKHTLCOutputInCommitment htlc_conv;
10283 htlc_conv.inner = (void*)(htlc & (~1));
10284 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10285 LDKTxCreationKeys keys_conv;
10286 keys_conv.inner = (void*)(keys & (~1));
10287 keys_conv.is_owned = (keys & 1) || (keys == 0);
10288 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10289 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10294 LDKPublicKey broadcaster_ref;
10295 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10296 LDKPublicKey countersignatory_ref;
10297 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10298 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10299 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) {
10304 unsigned char prev_hash_arr[32];
10305 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10306 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10307 LDKHTLCOutputInCommitment htlc_conv;
10308 htlc_conv.inner = (void*)(htlc & (~1));
10309 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10310 LDKPublicKey broadcaster_delayed_payment_key_ref;
10311 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10312 LDKPublicKey revocation_key_ref;
10313 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10314 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10315 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10320 LDKHolderCommitmentTransaction this_ptr_conv;
10321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10323 return HolderCommitmentTransaction_free(this_ptr_conv);
10326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10327 LDKHolderCommitmentTransaction orig_conv;
10328 orig_conv.inner = (void*)(orig & (~1));
10329 orig_conv.is_owned = (orig & 1) || (orig == 0);
10330 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10331 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10335 LDKHolderCommitmentTransaction this_ptr_conv;
10336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10338 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10339 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10344 LDKHolderCommitmentTransaction this_ptr_conv;
10345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10347 LDKTransaction val_conv = *(LDKTransaction*)val;
10349 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10353 LDKHolderCommitmentTransaction this_ptr_conv;
10354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10356 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
10357 *ret = HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv);
10361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10362 LDKHolderCommitmentTransaction this_ptr_conv;
10363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10365 LDKSignature val_conv = *(LDKSignature*)val;
10367 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_conv);
10370 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10371 LDKHolderCommitmentTransaction this_ptr_conv;
10372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10374 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10378 LDKHolderCommitmentTransaction this_ptr_conv;
10379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10381 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10385 LDKHolderCommitmentTransaction this_ptr_conv;
10386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10388 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10390 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
10393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jlong counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
10394 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
10395 FREE((void*)unsigned_tx);
10396 LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
10397 FREE((void*)counterparty_sig);
10398 LDKPublicKey holder_funding_key_ref;
10399 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
10400 LDKPublicKey counterparty_funding_key_ref;
10401 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
10402 LDKTxCreationKeys keys_conv;
10403 keys_conv.inner = (void*)(keys & (~1));
10404 keys_conv.is_owned = (keys & 1) || (keys == 0);
10405 if (keys_conv.inner != NULL)
10406 keys_conv = TxCreationKeys_clone(&keys_conv);
10407 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
10408 FREE((void*)htlc_data);
10409 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_conv, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_conv);
10410 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10414 LDKHolderCommitmentTransaction this_arg_conv;
10415 this_arg_conv.inner = (void*)(this_arg & (~1));
10416 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10417 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10418 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10421 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10422 LDKHolderCommitmentTransaction this_arg_conv;
10423 this_arg_conv.inner = (void*)(this_arg & (~1));
10424 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10425 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10426 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) {
10431 LDKHolderCommitmentTransaction this_arg_conv;
10432 this_arg_conv.inner = (void*)(this_arg & (~1));
10433 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10434 unsigned char funding_key_arr[32];
10435 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10436 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10437 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
10438 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
10439 *ret = HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
10443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jshort counterparty_selected_contest_delay) {
10444 LDKHolderCommitmentTransaction this_arg_conv;
10445 this_arg_conv.inner = (void*)(this_arg & (~1));
10446 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10447 unsigned char htlc_base_key_arr[32];
10448 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10449 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10450 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10451 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10456 LDKHolderCommitmentTransaction obj_conv;
10457 obj_conv.inner = (void*)(obj & (~1));
10458 obj_conv.is_owned = (obj & 1) || (obj == 0);
10459 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10460 *ret = HolderCommitmentTransaction_write(&obj_conv);
10464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
10465 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10466 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
10467 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10471 LDKInitFeatures this_ptr_conv;
10472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10474 return InitFeatures_free(this_ptr_conv);
10477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10478 LDKNodeFeatures this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10481 return NodeFeatures_free(this_ptr_conv);
10484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10485 LDKChannelFeatures this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10488 return ChannelFeatures_free(this_ptr_conv);
10491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10492 LDKRouteHop this_ptr_conv;
10493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10495 return RouteHop_free(this_ptr_conv);
10498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10499 LDKRouteHop orig_conv;
10500 orig_conv.inner = (void*)(orig & (~1));
10501 orig_conv.is_owned = (orig & 1) || (orig == 0);
10502 LDKRouteHop ret = RouteHop_clone(&orig_conv);
10503 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10506 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10507 LDKRouteHop this_ptr_conv;
10508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10510 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10511 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
10515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10516 LDKRouteHop this_ptr_conv;
10517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10519 LDKPublicKey val_ref;
10520 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10521 return RouteHop_set_pubkey(&this_ptr_conv, val_ref);
10524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10525 LDKRouteHop this_ptr_conv;
10526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10528 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
10529 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10533 LDKRouteHop this_ptr_conv;
10534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10536 LDKNodeFeatures val_conv;
10537 val_conv.inner = (void*)(val & (~1));
10538 val_conv.is_owned = (val & 1) || (val == 0);
10539 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
10542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10543 LDKRouteHop this_ptr_conv;
10544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10546 return RouteHop_get_short_channel_id(&this_ptr_conv);
10549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10550 LDKRouteHop this_ptr_conv;
10551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10553 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
10556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10557 LDKRouteHop this_ptr_conv;
10558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10560 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
10561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10565 LDKRouteHop this_ptr_conv;
10566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10568 LDKChannelFeatures val_conv;
10569 val_conv.inner = (void*)(val & (~1));
10570 val_conv.is_owned = (val & 1) || (val == 0);
10571 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10575 LDKRouteHop this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10578 return RouteHop_get_fee_msat(&this_ptr_conv);
10581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10582 LDKRouteHop this_ptr_conv;
10583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10585 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10588 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10589 LDKRouteHop this_ptr_conv;
10590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10592 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10596 LDKRouteHop this_ptr_conv;
10597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10599 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv * _env, jclass _b, jbyteArray pubkey_arg, jlong node_features_arg, jlong short_channel_id_arg, jlong channel_features_arg, jlong fee_msat_arg, jint cltv_expiry_delta_arg) {
10603 LDKPublicKey pubkey_arg_ref;
10604 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
10605 LDKNodeFeatures node_features_arg_conv;
10606 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10607 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10608 LDKChannelFeatures channel_features_arg_conv;
10609 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10610 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10611 LDKRouteHop ret = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
10612 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10616 LDKRoute this_ptr_conv;
10617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10619 return Route_free(this_ptr_conv);
10622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10623 LDKRoute orig_conv;
10624 orig_conv.inner = (void*)(orig & (~1));
10625 orig_conv.is_owned = (orig & 1) || (orig == 0);
10626 LDKRoute ret = Route_clone(&orig_conv);
10627 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10631 LDKRoute this_ptr_conv;
10632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10634 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10636 return Route_set_paths(&this_ptr_conv, val_conv);
10639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10640 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10641 FREE((void*)paths_arg);
10642 LDKRoute ret = Route_new(paths_arg_conv);
10643 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10648 obj_conv.inner = (void*)(obj & (~1));
10649 obj_conv.is_owned = (obj & 1) || (obj == 0);
10650 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10651 *ret = Route_write(&obj_conv);
10655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10656 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10657 LDKRoute ret = Route_read(ser_conv);
10658 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10662 LDKRouteHint this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10665 return RouteHint_free(this_ptr_conv);
10668 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10669 LDKRouteHint this_ptr_conv;
10670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10672 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10673 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
10677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10678 LDKRouteHint this_ptr_conv;
10679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10681 LDKPublicKey val_ref;
10682 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10683 return RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
10686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10687 LDKRouteHint this_ptr_conv;
10688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10690 return RouteHint_get_short_channel_id(&this_ptr_conv);
10693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10694 LDKRouteHint this_ptr_conv;
10695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10697 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10701 LDKRouteHint this_ptr_conv;
10702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10704 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10709 LDKRouteHint this_ptr_conv;
10710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10712 LDKRoutingFees val_conv;
10713 val_conv.inner = (void*)(val & (~1));
10714 val_conv.is_owned = (val & 1) || (val == 0);
10715 if (val_conv.inner != NULL)
10716 val_conv = RoutingFees_clone(&val_conv);
10717 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10720 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10721 LDKRouteHint this_ptr_conv;
10722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10724 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10728 LDKRouteHint this_ptr_conv;
10729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10731 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10735 LDKRouteHint this_ptr_conv;
10736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10738 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10742 LDKRouteHint this_ptr_conv;
10743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10745 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jbyteArray src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
10749 LDKPublicKey src_node_id_arg_ref;
10750 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
10751 LDKRoutingFees fees_arg_conv;
10752 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10753 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10754 if (fees_arg_conv.inner != NULL)
10755 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
10756 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10757 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jbyteArray our_node_id, jlong network, jbyteArray target, jlong first_hops, jlong last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
10761 LDKPublicKey our_node_id_ref;
10762 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
10763 LDKNetworkGraph network_conv;
10764 network_conv.inner = (void*)(network & (~1));
10765 network_conv.is_owned = (network & 1) || (network == 0);
10766 LDKPublicKey target_ref;
10767 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
10768 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10769 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10770 FREE((void*)last_hops);
10771 LDKLogger logger_conv = *(LDKLogger*)logger;
10772 if (logger_conv.free == LDKLogger_JCalls_free) {
10773 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10774 LDKLogger_JCalls_clone(logger_conv.this_arg);
10776 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10777 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10782 LDKNetworkGraph this_ptr_conv;
10783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10785 return NetworkGraph_free(this_ptr_conv);
10788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10789 LDKLockedNetworkGraph this_ptr_conv;
10790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10792 return LockedNetworkGraph_free(this_ptr_conv);
10795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10796 LDKNetGraphMsgHandler this_ptr_conv;
10797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10799 return NetGraphMsgHandler_free(this_ptr_conv);
10802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
10803 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10804 LDKLogger logger_conv = *(LDKLogger*)logger;
10805 if (logger_conv.free == LDKLogger_JCalls_free) {
10806 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10807 LDKLogger_JCalls_clone(logger_conv.this_arg);
10809 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
10810 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
10814 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10815 LDKLogger logger_conv = *(LDKLogger*)logger;
10816 if (logger_conv.free == LDKLogger_JCalls_free) {
10817 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10818 LDKLogger_JCalls_clone(logger_conv.this_arg);
10820 LDKNetworkGraph network_graph_conv;
10821 network_graph_conv.inner = (void*)(network_graph & (~1));
10822 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
10823 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
10824 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10828 LDKNetGraphMsgHandler this_arg_conv;
10829 this_arg_conv.inner = (void*)(this_arg & (~1));
10830 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10831 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
10832 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10836 LDKLockedNetworkGraph this_arg_conv;
10837 this_arg_conv.inner = (void*)(this_arg & (~1));
10838 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10839 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
10840 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
10844 LDKNetGraphMsgHandler this_arg_conv;
10845 this_arg_conv.inner = (void*)(this_arg & (~1));
10846 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10847 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10848 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10853 LDKDirectionalChannelInfo this_ptr_conv;
10854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10856 return DirectionalChannelInfo_free(this_ptr_conv);
10859 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10860 LDKDirectionalChannelInfo this_ptr_conv;
10861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10863 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
10866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10867 LDKDirectionalChannelInfo this_ptr_conv;
10868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10870 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
10873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
10874 LDKDirectionalChannelInfo this_ptr_conv;
10875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10877 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
10880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10881 LDKDirectionalChannelInfo this_ptr_conv;
10882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10884 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
10887 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10888 LDKDirectionalChannelInfo this_ptr_conv;
10889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10891 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
10894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10895 LDKDirectionalChannelInfo this_ptr_conv;
10896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10898 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
10901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10902 LDKDirectionalChannelInfo this_ptr_conv;
10903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10905 return DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
10908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10909 LDKDirectionalChannelInfo this_ptr_conv;
10910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10912 return DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
10915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10916 LDKDirectionalChannelInfo this_ptr_conv;
10917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10919 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
10920 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10924 LDKDirectionalChannelInfo this_ptr_conv;
10925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10927 LDKChannelUpdate val_conv;
10928 val_conv.inner = (void*)(val & (~1));
10929 val_conv.is_owned = (val & 1) || (val == 0);
10930 if (val_conv.inner != NULL)
10931 val_conv = ChannelUpdate_clone(&val_conv);
10932 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
10935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10936 LDKDirectionalChannelInfo obj_conv;
10937 obj_conv.inner = (void*)(obj & (~1));
10938 obj_conv.is_owned = (obj & 1) || (obj == 0);
10939 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10940 *ret = DirectionalChannelInfo_write(&obj_conv);
10944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10945 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10946 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
10947 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10951 LDKChannelInfo this_ptr_conv;
10952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10954 return ChannelInfo_free(this_ptr_conv);
10957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10958 LDKChannelInfo this_ptr_conv;
10959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10961 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
10962 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10966 LDKChannelInfo this_ptr_conv;
10967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10969 LDKChannelFeatures val_conv;
10970 val_conv.inner = (void*)(val & (~1));
10971 val_conv.is_owned = (val & 1) || (val == 0);
10972 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
10975 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10976 LDKChannelInfo this_ptr_conv;
10977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10979 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10980 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10985 LDKChannelInfo this_ptr_conv;
10986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10988 LDKPublicKey val_ref;
10989 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10990 return ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
10993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10994 LDKChannelInfo this_ptr_conv;
10995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10997 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
10998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11002 LDKChannelInfo this_ptr_conv;
11003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11005 LDKDirectionalChannelInfo val_conv;
11006 val_conv.inner = (void*)(val & (~1));
11007 val_conv.is_owned = (val & 1) || (val == 0);
11008 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11012 LDKChannelInfo this_ptr_conv;
11013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11015 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11016 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11021 LDKChannelInfo this_ptr_conv;
11022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11024 LDKPublicKey val_ref;
11025 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11026 return ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11030 LDKChannelInfo this_ptr_conv;
11031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11033 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11038 LDKChannelInfo this_ptr_conv;
11039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11041 LDKDirectionalChannelInfo val_conv;
11042 val_conv.inner = (void*)(val & (~1));
11043 val_conv.is_owned = (val & 1) || (val == 0);
11044 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11047 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11048 LDKChannelInfo this_ptr_conv;
11049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11051 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11052 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11056 LDKChannelInfo this_ptr_conv;
11057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11059 LDKChannelAnnouncement val_conv;
11060 val_conv.inner = (void*)(val & (~1));
11061 val_conv.is_owned = (val & 1) || (val == 0);
11062 if (val_conv.inner != NULL)
11063 val_conv = ChannelAnnouncement_clone(&val_conv);
11064 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11068 LDKChannelInfo obj_conv;
11069 obj_conv.inner = (void*)(obj & (~1));
11070 obj_conv.is_owned = (obj & 1) || (obj == 0);
11071 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11072 *ret = ChannelInfo_write(&obj_conv);
11076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11077 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11078 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
11079 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11083 LDKRoutingFees this_ptr_conv;
11084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11086 return RoutingFees_free(this_ptr_conv);
11089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11090 LDKRoutingFees orig_conv;
11091 orig_conv.inner = (void*)(orig & (~1));
11092 orig_conv.is_owned = (orig & 1) || (orig == 0);
11093 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11097 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11098 LDKRoutingFees this_ptr_conv;
11099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11101 return RoutingFees_get_base_msat(&this_ptr_conv);
11104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11105 LDKRoutingFees this_ptr_conv;
11106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11108 return RoutingFees_set_base_msat(&this_ptr_conv, val);
11111 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11112 LDKRoutingFees this_ptr_conv;
11113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11115 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
11118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11119 LDKRoutingFees this_ptr_conv;
11120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11122 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11126 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11127 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
11131 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11132 LDKRoutingFees ret = RoutingFees_read(ser_conv);
11133 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11137 LDKRoutingFees obj_conv;
11138 obj_conv.inner = (void*)(obj & (~1));
11139 obj_conv.is_owned = (obj & 1) || (obj == 0);
11140 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11141 *ret = RoutingFees_write(&obj_conv);
11145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11146 LDKNodeAnnouncementInfo this_ptr_conv;
11147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11149 return NodeAnnouncementInfo_free(this_ptr_conv);
11152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11153 LDKNodeAnnouncementInfo this_ptr_conv;
11154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11156 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11157 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11161 LDKNodeAnnouncementInfo this_ptr_conv;
11162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11164 LDKNodeFeatures val_conv;
11165 val_conv.inner = (void*)(val & (~1));
11166 val_conv.is_owned = (val & 1) || (val == 0);
11167 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11170 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11171 LDKNodeAnnouncementInfo this_ptr_conv;
11172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11174 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11178 LDKNodeAnnouncementInfo this_ptr_conv;
11179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11181 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11184 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11185 LDKNodeAnnouncementInfo this_ptr_conv;
11186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11188 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11189 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11194 LDKNodeAnnouncementInfo this_ptr_conv;
11195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11197 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
11199 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
11202 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11203 LDKNodeAnnouncementInfo this_ptr_conv;
11204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11206 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11207 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11212 LDKNodeAnnouncementInfo this_ptr_conv;
11213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11215 LDKThirtyTwoBytes val_ref;
11216 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11217 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11221 LDKNodeAnnouncementInfo this_ptr_conv;
11222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11224 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11226 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11230 LDKNodeAnnouncementInfo this_ptr_conv;
11231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11232 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11233 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11234 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11238 LDKNodeAnnouncementInfo this_ptr_conv;
11239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11241 LDKNodeAnnouncement val_conv;
11242 val_conv.inner = (void*)(val & (~1));
11243 val_conv.is_owned = (val & 1) || (val == 0);
11244 if (val_conv.inner != NULL)
11245 val_conv = NodeAnnouncement_clone(&val_conv);
11246 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jlong rgb_arg, jbyteArray alias_arg, jlong addresses_arg, jlong announcement_message_arg) {
11250 LDKNodeFeatures features_arg_conv;
11251 features_arg_conv.inner = (void*)(features_arg & (~1));
11252 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11253 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
11254 FREE((void*)rgb_arg);
11255 LDKThirtyTwoBytes alias_arg_ref;
11256 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11257 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11258 FREE((void*)addresses_arg);
11259 LDKNodeAnnouncement announcement_message_arg_conv;
11260 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11261 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11262 if (announcement_message_arg_conv.inner != NULL)
11263 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11264 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11265 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11269 LDKNodeAnnouncementInfo obj_conv;
11270 obj_conv.inner = (void*)(obj & (~1));
11271 obj_conv.is_owned = (obj & 1) || (obj == 0);
11272 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11273 *ret = NodeAnnouncementInfo_write(&obj_conv);
11277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11278 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11279 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
11280 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11284 LDKNodeInfo this_ptr_conv;
11285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11287 return NodeInfo_free(this_ptr_conv);
11290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11291 LDKNodeInfo this_ptr_conv;
11292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11294 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11296 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
11299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11300 LDKNodeInfo this_ptr_conv;
11301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11303 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11304 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11308 LDKNodeInfo this_ptr_conv;
11309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11311 LDKRoutingFees val_conv;
11312 val_conv.inner = (void*)(val & (~1));
11313 val_conv.is_owned = (val & 1) || (val == 0);
11314 if (val_conv.inner != NULL)
11315 val_conv = RoutingFees_clone(&val_conv);
11316 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
11319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
11320 LDKNodeInfo this_ptr_conv;
11321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11323 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
11324 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11328 LDKNodeInfo this_ptr_conv;
11329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11331 LDKNodeAnnouncementInfo val_conv;
11332 val_conv.inner = (void*)(val & (~1));
11333 val_conv.is_owned = (val & 1) || (val == 0);
11334 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
11337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, jclass _b, jlong channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
11338 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
11339 FREE((void*)channels_arg);
11340 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
11341 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
11342 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
11343 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
11344 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
11345 LDKNodeAnnouncementInfo announcement_info_arg_conv;
11346 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
11347 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
11348 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
11349 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11353 LDKNodeInfo obj_conv;
11354 obj_conv.inner = (void*)(obj & (~1));
11355 obj_conv.is_owned = (obj & 1) || (obj == 0);
11356 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11357 *ret = NodeInfo_write(&obj_conv);
11361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11362 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11363 LDKNodeInfo ret = NodeInfo_read(ser_conv);
11364 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
11368 LDKNetworkGraph obj_conv;
11369 obj_conv.inner = (void*)(obj & (~1));
11370 obj_conv.is_owned = (obj & 1) || (obj == 0);
11371 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11372 *ret = NetworkGraph_write(&obj_conv);
11376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
11377 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11378 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
11379 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
11383 LDKNetworkGraph ret = NetworkGraph_new();
11384 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong short_channel_id, jboolean is_permanent) {
11388 LDKNetworkGraph this_arg_conv;
11389 this_arg_conv.inner = (void*)(this_arg & (~1));
11390 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11391 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);