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 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {
175 LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
178 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
179 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
180 case 0: return LDKAccessError_UnknownChain;
181 case 1: return LDKAccessError_UnknownTx;
185 static jclass LDKAccessError_class = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
187 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
189 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
190 DO_ASSERT(LDKAccessError_class != NULL);
191 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
192 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownChain != NULL);
193 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
194 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownTx != NULL);
196 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
198 case LDKAccessError_UnknownChain:
199 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
200 case LDKAccessError_UnknownTx:
201 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
206 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
207 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
208 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
209 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
213 static jclass LDKChannelMonitorUpdateErr_class = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
215 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
216 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
217 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
218 DO_ASSERT(LDKChannelMonitorUpdateErr_class != NULL);
219 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
220 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
221 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
222 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
224 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
226 case LDKChannelMonitorUpdateErr_TemporaryFailure:
227 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
228 case LDKChannelMonitorUpdateErr_PermanentFailure:
229 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
234 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
235 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
236 case 0: return LDKConfirmationTarget_Background;
237 case 1: return LDKConfirmationTarget_Normal;
238 case 2: return LDKConfirmationTarget_HighPriority;
242 static jclass LDKConfirmationTarget_class = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
245 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
247 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
248 DO_ASSERT(LDKConfirmationTarget_class != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
251 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
252 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
253 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
254 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
256 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
258 case LDKConfirmationTarget_Background:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
260 case LDKConfirmationTarget_Normal:
261 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
262 case LDKConfirmationTarget_HighPriority:
263 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
268 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
269 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
270 case 0: return LDKLevel_Off;
271 case 1: return LDKLevel_Error;
272 case 2: return LDKLevel_Warn;
273 case 3: return LDKLevel_Info;
274 case 4: return LDKLevel_Debug;
275 case 5: return LDKLevel_Trace;
279 static jclass LDKLevel_class = NULL;
280 static jfieldID LDKLevel_LDKLevel_Off = NULL;
281 static jfieldID LDKLevel_LDKLevel_Error = NULL;
282 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
283 static jfieldID LDKLevel_LDKLevel_Info = NULL;
284 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
285 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
287 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
288 DO_ASSERT(LDKLevel_class != NULL);
289 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
290 DO_ASSERT(LDKLevel_LDKLevel_Off != NULL);
291 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
292 DO_ASSERT(LDKLevel_LDKLevel_Error != NULL);
293 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
294 DO_ASSERT(LDKLevel_LDKLevel_Warn != NULL);
295 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
296 DO_ASSERT(LDKLevel_LDKLevel_Info != NULL);
297 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
298 DO_ASSERT(LDKLevel_LDKLevel_Debug != NULL);
299 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
300 DO_ASSERT(LDKLevel_LDKLevel_Trace != NULL);
302 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
313 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
315 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
320 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
321 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
322 case 0: return LDKNetwork_Bitcoin;
323 case 1: return LDKNetwork_Testnet;
324 case 2: return LDKNetwork_Regtest;
328 static jclass LDKNetwork_class = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
331 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
333 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
334 DO_ASSERT(LDKNetwork_class != NULL);
335 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
336 DO_ASSERT(LDKNetwork_LDKNetwork_Bitcoin != NULL);
337 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
338 DO_ASSERT(LDKNetwork_LDKNetwork_Testnet != NULL);
339 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
340 DO_ASSERT(LDKNetwork_LDKNetwork_Regtest != NULL);
342 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
344 case LDKNetwork_Bitcoin:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
346 case LDKNetwork_Testnet:
347 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
348 case LDKNetwork_Regtest:
349 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
355 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
356 case 0: return LDKSecp256k1Error_IncorrectSignature;
357 case 1: return LDKSecp256k1Error_InvalidMessage;
358 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359 case 3: return LDKSecp256k1Error_InvalidSignature;
360 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
362 case 6: return LDKSecp256k1Error_InvalidTweak;
363 case 7: return LDKSecp256k1Error_NotEnoughMemory;
364 case 8: return LDKSecp256k1Error_CallbackPanicked;
368 static jclass LDKSecp256k1Error_class = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
377 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
379 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
380 DO_ASSERT(LDKSecp256k1Error_class != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
400 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
402 case LDKSecp256k1Error_IncorrectSignature:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
404 case LDKSecp256k1Error_InvalidMessage:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
406 case LDKSecp256k1Error_InvalidPublicKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
408 case LDKSecp256k1Error_InvalidSignature:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
410 case LDKSecp256k1Error_InvalidSecretKey:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
412 case LDKSecp256k1Error_InvalidRecoveryId:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
414 case LDKSecp256k1Error_InvalidTweak:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
416 case LDKSecp256k1Error_NotEnoughMemory:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
418 case LDKSecp256k1Error_CallbackPanicked:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
425 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
429 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
430 ret->datalen = (*env)->GetArrayLength(env, elems);
431 if (ret->datalen == 0) {
434 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
435 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
436 for (size_t i = 0; i < ret->datalen; i++) {
437 ret->data[i] = java_elems[i];
439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
444 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
446 LDKTransaction b_conv = *(LDKTransaction*)b;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
452 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
455 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
456 if (val->result_ok) {
457 return (long)val->contents.result;
459 return (long)val->contents.err;
462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
463 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
466 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
467 if (val->result_ok) {
468 return (long)val->contents.result;
470 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
474 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
476 a_conv.inner = (void*)(a & (~1));
477 a_conv.is_owned = (a & 1) || (a == 0);
479 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
484 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
485 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
486 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
489 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
490 ret->datalen = (*env)->GetArrayLength(env, elems);
491 if (ret->datalen == 0) {
494 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
495 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
496 for (size_t i = 0; i < ret->datalen; i++) {
497 jlong arr_elem = java_elems[i];
498 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
499 FREE((void*)arr_elem);
500 ret->data[i] = arr_elem_conv;
502 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
507 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
508 LDKThirtyTwoBytes a_ref;
509 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
511 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
517 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
522 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
523 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
524 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
527 LDKCVecTempl_Signature *ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
528 ret->datalen = (*env)->GetArrayLength(env, elems);
529 if (ret->datalen == 0) {
532 ret->data = MALLOC(sizeof(LDKSignature) * ret->datalen, "LDKCVecTempl_Signature Data");
533 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
534 for (size_t i = 0; i < ret->datalen; i++) {
535 jlong arr_elem = java_elems[i];
536 LDKSignature arr_elem_conv = *(LDKSignature*)arr_elem;
537 FREE((void*)arr_elem);
538 ret->data[i] = arr_elem_conv;
540 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
545 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
546 LDKSignature a_conv = *(LDKSignature*)a;
549 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
555 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
558 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
559 if (val->result_ok) {
560 return (long)val->contents.result;
562 return (long)val->contents.err;
565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
566 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
569 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
570 if (val->result_ok) {
571 return (long)val->contents.result;
573 return (long)val->contents.err;
576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
577 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
580 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
581 if (val->result_ok) {
582 return (long)val->contents.result;
584 return (long)val->contents.err;
587 static jclass LDKAPIError_APIMisuseError_class = NULL;
588 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
589 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
590 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
591 static jclass LDKAPIError_RouteError_class = NULL;
592 static jmethodID LDKAPIError_RouteError_meth = NULL;
593 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
594 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
595 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
596 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
598 LDKAPIError_APIMisuseError_class =
599 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
600 DO_ASSERT(LDKAPIError_APIMisuseError_class != NULL);
601 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
602 DO_ASSERT(LDKAPIError_APIMisuseError_meth != NULL);
603 LDKAPIError_FeeRateTooHigh_class =
604 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
605 DO_ASSERT(LDKAPIError_FeeRateTooHigh_class != NULL);
606 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
607 DO_ASSERT(LDKAPIError_FeeRateTooHigh_meth != NULL);
608 LDKAPIError_RouteError_class =
609 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
610 DO_ASSERT(LDKAPIError_RouteError_class != NULL);
611 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
612 DO_ASSERT(LDKAPIError_RouteError_meth != NULL);
613 LDKAPIError_ChannelUnavailable_class =
614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
615 DO_ASSERT(LDKAPIError_ChannelUnavailable_class != NULL);
616 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
617 DO_ASSERT(LDKAPIError_ChannelUnavailable_meth != NULL);
618 LDKAPIError_MonitorUpdateFailed_class =
619 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
620 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_class != NULL);
621 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
622 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_meth != NULL);
624 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
625 LDKAPIError *obj = (LDKAPIError*)ptr;
627 case LDKAPIError_APIMisuseError: {
628 long err_ref = (long)&obj->api_misuse_error.err;
629 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
631 case LDKAPIError_FeeRateTooHigh: {
632 long err_ref = (long)&obj->fee_rate_too_high.err;
633 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
635 case LDKAPIError_RouteError: {
636 long err_ref = (long)&obj->route_error.err;
637 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
639 case LDKAPIError_ChannelUnavailable: {
640 long err_ref = (long)&obj->channel_unavailable.err;
641 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
643 case LDKAPIError_MonitorUpdateFailed: {
644 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
650 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
653 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
654 if (val->result_ok) {
655 return (long)val->contents.result;
657 return (long)val->contents.err;
660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
661 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
664 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
665 if (val->result_ok) {
666 return (long)val->contents.result;
668 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
671 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) {
672 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
673 LDKChannelAnnouncement a_conv;
674 a_conv.inner = (void*)(a & (~1));
675 a_conv.is_owned = (a & 1) || (a == 0);
677 LDKChannelUpdate b_conv;
678 b_conv.inner = (void*)(b & (~1));
679 b_conv.is_owned = (b & 1) || (b == 0);
681 LDKChannelUpdate c_conv;
682 c_conv.inner = (void*)(c & (~1));
683 c_conv.is_owned = (c & 1) || (c == 0);
687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
688 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
691 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
692 if (val->result_ok) {
693 return (long)val->contents.result;
695 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
699 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
700 LDKHTLCOutputInCommitment a_conv;
701 a_conv.inner = (void*)(a & (~1));
702 a_conv.is_owned = (a & 1) || (a == 0);
704 LDKSignature b_conv = *(LDKSignature*)b;
709 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
710 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
711 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
712 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
713 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
714 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
716 LDKSpendableOutputDescriptor_StaticOutput_class =
717 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
718 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
719 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
720 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
721 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
722 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
723 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
724 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
725 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
726 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
728 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
729 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
730 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
732 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
733 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
735 case LDKSpendableOutputDescriptor_StaticOutput: {
736 LDKOutPoint outpoint_var = obj->static_output.outpoint;
737 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
738 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
740 if (outpoint_var.is_owned) {
741 outpoint_ref = (long)outpoint_var.inner | 1;
743 outpoint_ref = (long)&outpoint_var;
745 long output_ref = (long)&obj->static_output.output;
746 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
748 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
749 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
750 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
751 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
753 if (outpoint_var.is_owned) {
754 outpoint_ref = (long)outpoint_var.inner | 1;
756 outpoint_ref = (long)&outpoint_var;
758 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
759 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
760 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
761 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
762 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
763 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
764 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);
766 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
767 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
768 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
769 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
771 if (outpoint_var.is_owned) {
772 outpoint_ref = (long)outpoint_var.inner | 1;
774 outpoint_ref = (long)&outpoint_var;
776 long output_ref = (long)&obj->static_output_counterparty_payment.output;
777 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
778 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
783 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
784 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
785 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
788 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
789 ret->datalen = (*env)->GetArrayLength(env, elems);
790 if (ret->datalen == 0) {
793 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
794 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
795 for (size_t i = 0; i < ret->datalen; i++) {
796 jlong arr_elem = java_elems[i];
797 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
798 FREE((void*)arr_elem);
799 ret->data[i] = arr_elem_conv;
801 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
805 static jclass LDKEvent_FundingGenerationReady_class = NULL;
806 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
807 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
808 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
809 static jclass LDKEvent_PaymentReceived_class = NULL;
810 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
811 static jclass LDKEvent_PaymentSent_class = NULL;
812 static jmethodID LDKEvent_PaymentSent_meth = NULL;
813 static jclass LDKEvent_PaymentFailed_class = NULL;
814 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
815 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
816 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
817 static jclass LDKEvent_SpendableOutputs_class = NULL;
818 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
820 LDKEvent_FundingGenerationReady_class =
821 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
822 DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL);
823 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
824 DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL);
825 LDKEvent_FundingBroadcastSafe_class =
826 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
827 DO_ASSERT(LDKEvent_FundingBroadcastSafe_class != NULL);
828 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
829 DO_ASSERT(LDKEvent_FundingBroadcastSafe_meth != NULL);
830 LDKEvent_PaymentReceived_class =
831 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
832 DO_ASSERT(LDKEvent_PaymentReceived_class != NULL);
833 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
834 DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL);
835 LDKEvent_PaymentSent_class =
836 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
837 DO_ASSERT(LDKEvent_PaymentSent_class != NULL);
838 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
839 DO_ASSERT(LDKEvent_PaymentSent_meth != NULL);
840 LDKEvent_PaymentFailed_class =
841 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
842 DO_ASSERT(LDKEvent_PaymentFailed_class != NULL);
843 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
844 DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL);
845 LDKEvent_PendingHTLCsForwardable_class =
846 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
847 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_class != NULL);
848 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
849 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_meth != NULL);
850 LDKEvent_SpendableOutputs_class =
851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
852 DO_ASSERT(LDKEvent_SpendableOutputs_class != NULL);
853 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
854 DO_ASSERT(LDKEvent_SpendableOutputs_meth != NULL);
856 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
857 LDKEvent *obj = (LDKEvent*)ptr;
859 case LDKEvent_FundingGenerationReady: {
860 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
861 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
862 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
863 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);
865 case LDKEvent_FundingBroadcastSafe: {
866 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
867 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
868 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
869 long funding_txo_ref;
870 if (funding_txo_var.is_owned) {
871 funding_txo_ref = (long)funding_txo_var.inner | 1;
873 funding_txo_ref = (long)&funding_txo_var;
875 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
877 case LDKEvent_PaymentReceived: {
878 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
879 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
880 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
881 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
882 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
884 case LDKEvent_PaymentSent: {
885 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
886 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
887 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
889 case LDKEvent_PaymentFailed: {
890 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
891 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
892 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
894 case LDKEvent_PendingHTLCsForwardable: {
895 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
897 case LDKEvent_SpendableOutputs: {
898 long outputs_ref = (long)&obj->spendable_outputs.outputs;
899 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
904 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
905 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
906 static jclass LDKErrorAction_IgnoreError_class = NULL;
907 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
908 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
909 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
911 LDKErrorAction_DisconnectPeer_class =
912 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
913 DO_ASSERT(LDKErrorAction_DisconnectPeer_class != NULL);
914 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
915 DO_ASSERT(LDKErrorAction_DisconnectPeer_meth != NULL);
916 LDKErrorAction_IgnoreError_class =
917 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
918 DO_ASSERT(LDKErrorAction_IgnoreError_class != NULL);
919 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
920 DO_ASSERT(LDKErrorAction_IgnoreError_meth != NULL);
921 LDKErrorAction_SendErrorMessage_class =
922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
923 DO_ASSERT(LDKErrorAction_SendErrorMessage_class != NULL);
924 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
925 DO_ASSERT(LDKErrorAction_SendErrorMessage_meth != NULL);
927 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
928 LDKErrorAction *obj = (LDKErrorAction*)ptr;
930 case LDKErrorAction_DisconnectPeer: {
931 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
932 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
933 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
935 if (msg_var.is_owned) {
936 msg_ref = (long)msg_var.inner | 1;
938 msg_ref = (long)&msg_var;
940 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
942 case LDKErrorAction_IgnoreError: {
943 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
945 case LDKErrorAction_SendErrorMessage: {
946 LDKErrorMessage msg_var = obj->send_error_message.msg;
947 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
948 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 if (msg_var.is_owned) {
951 msg_ref = (long)msg_var.inner | 1;
953 msg_ref = (long)&msg_var;
955 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
960 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
961 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
962 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
963 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
964 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
965 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
967 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
968 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
969 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
970 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
971 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
972 LDKHTLCFailChannelUpdate_ChannelClosed_class =
973 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
974 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
975 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
976 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
977 LDKHTLCFailChannelUpdate_NodeFailure_class =
978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
979 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
980 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
981 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
983 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
984 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
986 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
987 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
988 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
989 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
991 if (msg_var.is_owned) {
992 msg_ref = (long)msg_var.inner | 1;
994 msg_ref = (long)&msg_var;
996 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
998 case LDKHTLCFailChannelUpdate_ChannelClosed: {
999 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1001 case LDKHTLCFailChannelUpdate_NodeFailure: {
1002 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1003 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1004 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1009 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1010 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1011 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1012 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1013 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1014 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1015 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1016 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1017 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1018 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1019 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1020 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1021 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1022 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1023 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1024 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1025 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1026 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1027 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1028 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1029 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1030 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1031 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1032 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1033 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1034 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1035 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1036 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1037 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1038 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1039 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1040 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1042 LDKMessageSendEvent_SendAcceptChannel_class =
1043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1044 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1045 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1046 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1047 LDKMessageSendEvent_SendOpenChannel_class =
1048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1049 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1050 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1051 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1052 LDKMessageSendEvent_SendFundingCreated_class =
1053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1054 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1055 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1056 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1057 LDKMessageSendEvent_SendFundingSigned_class =
1058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1059 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1060 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1061 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1062 LDKMessageSendEvent_SendFundingLocked_class =
1063 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1064 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1065 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1066 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1067 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1068 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1069 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1070 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1071 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1072 LDKMessageSendEvent_UpdateHTLCs_class =
1073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1074 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1075 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1076 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1077 LDKMessageSendEvent_SendRevokeAndACK_class =
1078 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1079 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1080 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1081 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1082 LDKMessageSendEvent_SendClosingSigned_class =
1083 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1084 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1085 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1086 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1087 LDKMessageSendEvent_SendShutdown_class =
1088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1089 DO_ASSERT(LDKMessageSendEvent_SendShutdown_class != NULL);
1090 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1091 DO_ASSERT(LDKMessageSendEvent_SendShutdown_meth != NULL);
1092 LDKMessageSendEvent_SendChannelReestablish_class =
1093 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1094 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1095 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1096 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1097 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1099 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1100 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1101 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1102 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1104 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1105 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1106 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1107 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1108 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1109 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1110 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1111 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1112 LDKMessageSendEvent_HandleError_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1114 DO_ASSERT(LDKMessageSendEvent_HandleError_class != NULL);
1115 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1116 DO_ASSERT(LDKMessageSendEvent_HandleError_meth != NULL);
1117 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1119 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1120 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1121 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1123 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1124 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1126 case LDKMessageSendEvent_SendAcceptChannel: {
1127 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1128 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1129 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1130 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1131 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1133 if (msg_var.is_owned) {
1134 msg_ref = (long)msg_var.inner | 1;
1136 msg_ref = (long)&msg_var;
1138 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1140 case LDKMessageSendEvent_SendOpenChannel: {
1141 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1142 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1143 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1144 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 if (msg_var.is_owned) {
1148 msg_ref = (long)msg_var.inner | 1;
1150 msg_ref = (long)&msg_var;
1152 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1154 case LDKMessageSendEvent_SendFundingCreated: {
1155 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1156 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1157 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1158 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1159 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1161 if (msg_var.is_owned) {
1162 msg_ref = (long)msg_var.inner | 1;
1164 msg_ref = (long)&msg_var;
1166 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1168 case LDKMessageSendEvent_SendFundingSigned: {
1169 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1170 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1171 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1172 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1173 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1175 if (msg_var.is_owned) {
1176 msg_ref = (long)msg_var.inner | 1;
1178 msg_ref = (long)&msg_var;
1180 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1182 case LDKMessageSendEvent_SendFundingLocked: {
1183 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1184 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1185 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1186 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1189 if (msg_var.is_owned) {
1190 msg_ref = (long)msg_var.inner | 1;
1192 msg_ref = (long)&msg_var;
1194 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1196 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1197 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1198 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1199 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1200 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1201 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1203 if (msg_var.is_owned) {
1204 msg_ref = (long)msg_var.inner | 1;
1206 msg_ref = (long)&msg_var;
1208 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1210 case LDKMessageSendEvent_UpdateHTLCs: {
1211 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1212 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1213 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1214 DO_ASSERT((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1215 DO_ASSERT((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 if (updates_var.is_owned) {
1218 updates_ref = (long)updates_var.inner | 1;
1220 updates_ref = (long)&updates_var;
1222 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1224 case LDKMessageSendEvent_SendRevokeAndACK: {
1225 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1226 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1227 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1228 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1229 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1231 if (msg_var.is_owned) {
1232 msg_ref = (long)msg_var.inner | 1;
1234 msg_ref = (long)&msg_var;
1236 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1238 case LDKMessageSendEvent_SendClosingSigned: {
1239 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1240 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1241 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1242 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1243 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1245 if (msg_var.is_owned) {
1246 msg_ref = (long)msg_var.inner | 1;
1248 msg_ref = (long)&msg_var;
1250 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1252 case LDKMessageSendEvent_SendShutdown: {
1253 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1254 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1255 LDKShutdown msg_var = obj->send_shutdown.msg;
1256 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1257 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1259 if (msg_var.is_owned) {
1260 msg_ref = (long)msg_var.inner | 1;
1262 msg_ref = (long)&msg_var;
1264 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1266 case LDKMessageSendEvent_SendChannelReestablish: {
1267 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1268 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1269 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1270 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1271 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1273 if (msg_var.is_owned) {
1274 msg_ref = (long)msg_var.inner | 1;
1276 msg_ref = (long)&msg_var;
1278 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1280 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1281 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1282 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1285 if (msg_var.is_owned) {
1286 msg_ref = (long)msg_var.inner | 1;
1288 msg_ref = (long)&msg_var;
1290 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1291 DO_ASSERT((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1292 DO_ASSERT((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1293 long update_msg_ref;
1294 if (update_msg_var.is_owned) {
1295 update_msg_ref = (long)update_msg_var.inner | 1;
1297 update_msg_ref = (long)&update_msg_var;
1299 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1301 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1302 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1303 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1304 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1306 if (msg_var.is_owned) {
1307 msg_ref = (long)msg_var.inner | 1;
1309 msg_ref = (long)&msg_var;
1311 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1313 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1314 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1315 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1316 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1318 if (msg_var.is_owned) {
1319 msg_ref = (long)msg_var.inner | 1;
1321 msg_ref = (long)&msg_var;
1323 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1325 case LDKMessageSendEvent_HandleError: {
1326 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1327 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1328 long action_ref = (long)&obj->handle_error.action;
1329 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1331 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1332 long update_ref = (long)&obj->payment_failure_network_update.update;
1333 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1338 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1339 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1340 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1343 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1344 ret->datalen = (*env)->GetArrayLength(env, elems);
1345 if (ret->datalen == 0) {
1348 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1349 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1350 for (size_t i = 0; i < ret->datalen; i++) {
1351 jlong arr_elem = java_elems[i];
1352 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1353 FREE((void*)arr_elem);
1354 ret->data[i] = arr_elem_conv;
1356 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1360 typedef struct LDKMessageSendEventsProvider_JCalls {
1361 atomic_size_t refcnt;
1364 jmethodID get_and_clear_pending_msg_events_meth;
1365 } LDKMessageSendEventsProvider_JCalls;
1366 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1367 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1369 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1371 DO_ASSERT(obj != NULL);
1372 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1373 LDKCVec_MessageSendEventZ res = *ret;
1377 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1378 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1379 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1381 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1382 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1386 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1387 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1388 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1389 return (void*) this_arg;
1391 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1392 jclass c = (*env)->GetObjectClass(env, o);
1393 DO_ASSERT(c != NULL);
1394 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1395 atomic_init(&calls->refcnt, 1);
1396 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1397 calls->o = (*env)->NewWeakGlobalRef(env, o);
1398 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1399 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1401 LDKMessageSendEventsProvider ret = {
1402 .this_arg = (void*) calls,
1403 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1404 .free = LDKMessageSendEventsProvider_JCalls_free,
1408 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1409 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1410 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1411 return (long)res_ptr;
1413 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1414 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1415 DO_ASSERT(ret != NULL);
1418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) {
1419 LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg;
1420 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1421 *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg);
1425 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1426 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1427 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1430 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1431 ret->datalen = (*env)->GetArrayLength(env, elems);
1432 if (ret->datalen == 0) {
1435 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1436 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1437 for (size_t i = 0; i < ret->datalen; i++) {
1438 jlong arr_elem = java_elems[i];
1439 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1440 FREE((void*)arr_elem);
1441 ret->data[i] = arr_elem_conv;
1443 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1447 typedef struct LDKEventsProvider_JCalls {
1448 atomic_size_t refcnt;
1451 jmethodID get_and_clear_pending_events_meth;
1452 } LDKEventsProvider_JCalls;
1453 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1454 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1456 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1457 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1458 DO_ASSERT(obj != NULL);
1459 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1460 LDKCVec_EventZ res = *ret;
1464 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1465 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1466 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1468 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1469 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1473 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1474 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1475 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1476 return (void*) this_arg;
1478 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1479 jclass c = (*env)->GetObjectClass(env, o);
1480 DO_ASSERT(c != NULL);
1481 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1482 atomic_init(&calls->refcnt, 1);
1483 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1484 calls->o = (*env)->NewWeakGlobalRef(env, o);
1485 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1486 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1488 LDKEventsProvider ret = {
1489 .this_arg = (void*) calls,
1490 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1491 .free = LDKEventsProvider_JCalls_free,
1495 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1496 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1497 *res_ptr = LDKEventsProvider_init(env, _a, o);
1498 return (long)res_ptr;
1500 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1501 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1502 DO_ASSERT(ret != NULL);
1505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) {
1506 LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg;
1507 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1508 *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg);
1512 typedef struct LDKLogger_JCalls {
1513 atomic_size_t refcnt;
1518 void log_jcall(const void* this_arg, const char *record) {
1519 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1521 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1522 jstring record_conv = (*env)->NewStringUTF(env, record);
1523 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1524 DO_ASSERT(obj != NULL);
1525 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1527 static void LDKLogger_JCalls_free(void* this_arg) {
1528 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1529 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1531 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1532 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1536 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1537 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1538 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1539 return (void*) this_arg;
1541 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1542 jclass c = (*env)->GetObjectClass(env, o);
1543 DO_ASSERT(c != NULL);
1544 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1545 atomic_init(&calls->refcnt, 1);
1546 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1547 calls->o = (*env)->NewWeakGlobalRef(env, o);
1548 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1549 DO_ASSERT(calls->log_meth != NULL);
1552 .this_arg = (void*) calls,
1554 .free = LDKLogger_JCalls_free,
1558 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1559 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1560 *res_ptr = LDKLogger_init(env, _a, o);
1561 return (long)res_ptr;
1563 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1564 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1565 DO_ASSERT(ret != NULL);
1568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1569 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1572 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1573 if (val->result_ok) {
1574 return (long)val->contents.result;
1576 return (long)val->contents.err;
1579 typedef struct LDKAccess_JCalls {
1580 atomic_size_t refcnt;
1583 jmethodID get_utxo_meth;
1585 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1586 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1589 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1590 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1591 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1592 DO_ASSERT(obj != NULL);
1593 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1594 LDKCResult_TxOutAccessErrorZ res = *ret;
1598 static void LDKAccess_JCalls_free(void* this_arg) {
1599 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1600 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1602 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1603 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1607 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1608 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1609 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1610 return (void*) this_arg;
1612 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1613 jclass c = (*env)->GetObjectClass(env, o);
1614 DO_ASSERT(c != NULL);
1615 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1616 atomic_init(&calls->refcnt, 1);
1617 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1618 calls->o = (*env)->NewWeakGlobalRef(env, o);
1619 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1620 DO_ASSERT(calls->get_utxo_meth != NULL);
1623 .this_arg = (void*) calls,
1624 .get_utxo = get_utxo_jcall,
1625 .free = LDKAccess_JCalls_free,
1629 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1630 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1631 *res_ptr = LDKAccess_init(env, _a, o);
1632 return (long)res_ptr;
1634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1635 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1636 DO_ASSERT(ret != NULL);
1639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong arg, jbyteArray genesis_hash, jlong short_channel_id) {
1640 LDKAccess* arg_conv = (LDKAccess*)arg;
1641 unsigned char genesis_hash_arr[32];
1642 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1643 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1644 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1645 *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1649 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1650 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1651 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1652 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1653 for (size_t i = 0; i < vec->datalen; i++) {
1654 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1655 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1657 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1661 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1662 ret->datalen = (*env)->GetArrayLength(env, elems);
1663 if (ret->datalen == 0) {
1666 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1667 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1668 for (size_t i = 0; i < ret->datalen; i++) {
1669 jlong arr_elem = java_elems[i];
1670 LDKHTLCOutputInCommitment arr_elem_conv;
1671 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1672 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1673 ret->data[i] = arr_elem_conv;
1675 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1679 typedef struct LDKChannelKeys_JCalls {
1680 atomic_size_t refcnt;
1683 jmethodID get_per_commitment_point_meth;
1684 jmethodID release_commitment_secret_meth;
1685 jmethodID key_derivation_params_meth;
1686 jmethodID sign_counterparty_commitment_meth;
1687 jmethodID sign_holder_commitment_meth;
1688 jmethodID sign_holder_commitment_htlc_transactions_meth;
1689 jmethodID sign_justice_transaction_meth;
1690 jmethodID sign_counterparty_htlc_transaction_meth;
1691 jmethodID sign_closing_transaction_meth;
1692 jmethodID sign_channel_announcement_meth;
1693 jmethodID on_accept_meth;
1694 } LDKChannelKeys_JCalls;
1695 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1696 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1698 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1699 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1700 DO_ASSERT(obj != NULL);
1701 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1703 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1706 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1707 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1709 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1710 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1711 DO_ASSERT(obj != NULL);
1712 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1713 LDKThirtyTwoBytes ret;
1714 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1717 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1718 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1720 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1721 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1722 DO_ASSERT(obj != NULL);
1723 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1724 LDKC2Tuple_u64u64Z res = *ret;
1728 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) {
1729 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1731 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1732 long commitment_tx_ref = (long)&commitment_tx;
1733 long htlcs_ref = (long)&htlcs;
1734 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1735 DO_ASSERT(obj != NULL);
1736 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);
1737 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1741 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1742 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1744 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1745 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1746 DO_ASSERT(obj != NULL);
1747 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1748 LDKCResult_SignatureNoneZ res = *ret;
1752 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1753 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1755 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1756 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1757 DO_ASSERT(obj != NULL);
1758 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1759 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1763 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) {
1764 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1766 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1767 long justice_tx_ref = (long)&justice_tx;
1768 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1769 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1770 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1771 DO_ASSERT(obj != NULL);
1772 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);
1773 LDKCResult_SignatureNoneZ res = *ret;
1777 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) {
1778 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1780 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1781 long htlc_tx_ref = (long)&htlc_tx;
1782 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1783 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1784 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1785 DO_ASSERT(obj != NULL);
1786 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);
1787 LDKCResult_SignatureNoneZ res = *ret;
1791 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1792 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1794 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1795 long closing_tx_ref = (long)&closing_tx;
1796 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1797 DO_ASSERT(obj != NULL);
1798 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1799 LDKCResult_SignatureNoneZ res = *ret;
1803 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1804 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1806 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1808 DO_ASSERT(obj != NULL);
1809 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1810 LDKCResult_SignatureNoneZ res = *ret;
1814 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1815 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1817 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1818 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1819 DO_ASSERT(obj != NULL);
1820 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1822 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1823 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1824 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1826 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1827 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1831 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1832 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1833 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1834 return (void*) this_arg;
1836 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1837 jclass c = (*env)->GetObjectClass(env, o);
1838 DO_ASSERT(c != NULL);
1839 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1840 atomic_init(&calls->refcnt, 1);
1841 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1842 calls->o = (*env)->NewWeakGlobalRef(env, o);
1843 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1844 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1845 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1846 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1847 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1848 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1849 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1850 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1851 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1852 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1853 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1854 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1855 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1856 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1857 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1858 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1859 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1860 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1861 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1862 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1863 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1864 DO_ASSERT(calls->on_accept_meth != NULL);
1866 LDKChannelKeys ret = {
1867 .this_arg = (void*) calls,
1868 .get_per_commitment_point = get_per_commitment_point_jcall,
1869 .release_commitment_secret = release_commitment_secret_jcall,
1870 .key_derivation_params = key_derivation_params_jcall,
1871 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1872 .sign_holder_commitment = sign_holder_commitment_jcall,
1873 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1874 .sign_justice_transaction = sign_justice_transaction_jcall,
1875 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1876 .sign_closing_transaction = sign_closing_transaction_jcall,
1877 .sign_channel_announcement = sign_channel_announcement_jcall,
1878 .on_accept = on_accept_jcall,
1879 .clone = LDKChannelKeys_JCalls_clone,
1880 .free = LDKChannelKeys_JCalls_free,
1884 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1885 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1886 *res_ptr = LDKChannelKeys_init(env, _a, o);
1887 return (long)res_ptr;
1889 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1890 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1891 DO_ASSERT(ret != NULL);
1894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1895 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1896 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1897 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx).compressed_form);
1901 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1902 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1903 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1904 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data);
1908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) {
1909 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1910 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1911 *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg);
1915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1916 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1917 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1918 FREE((void*)commitment_tx);
1919 LDKPreCalculatedTxCreationKeys keys_conv;
1920 keys_conv.inner = (void*)(keys & (~1));
1921 keys_conv.is_owned = (keys & 1) || (keys == 0);
1922 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1924 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1925 *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1930 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1931 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1932 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1933 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1934 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1935 *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, &holder_commitment_tx_conv);
1939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1940 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1941 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1942 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1943 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1944 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1945 *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, &holder_commitment_tx_conv);
1949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1950 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1951 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1952 FREE((void*)justice_tx);
1953 unsigned char per_commitment_key_arr[32];
1954 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1955 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1956 LDKHTLCOutputInCommitment htlc_conv;
1957 htlc_conv.inner = (void*)(htlc & (~1));
1958 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1959 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1960 *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1965 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1966 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1967 FREE((void*)htlc_tx);
1968 LDKPublicKey per_commitment_point_ref;
1969 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1970 LDKHTLCOutputInCommitment htlc_conv;
1971 htlc_conv.inner = (void*)(htlc & (~1));
1972 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1973 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1974 *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) {
1979 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1980 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1981 FREE((void*)closing_tx);
1982 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1983 *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv);
1987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
1988 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1989 LDKUnsignedChannelAnnouncement msg_conv;
1990 msg_conv.inner = (void*)(msg & (~1));
1991 msg_conv.is_owned = (msg & 1) || (msg == 0);
1992 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1993 *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, &msg_conv);
1997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
1998 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1999 LDKChannelPublicKeys channel_points_conv;
2000 channel_points_conv.inner = (void*)(channel_points & (~1));
2001 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2002 return (arg_conv->on_accept)(arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2005 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2006 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2007 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2008 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2009 for (size_t i = 0; i < vec->datalen; i++) {
2010 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2011 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2013 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2017 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2018 ret->datalen = (*env)->GetArrayLength(env, elems);
2019 if (ret->datalen == 0) {
2022 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2023 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2024 for (size_t i = 0; i < ret->datalen; i++) {
2025 jlong arr_elem = java_elems[i];
2026 LDKMonitorEvent arr_elem_conv;
2027 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2028 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2029 ret->data[i] = arr_elem_conv;
2031 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2035 typedef struct LDKWatch_JCalls {
2036 atomic_size_t refcnt;
2039 jmethodID watch_channel_meth;
2040 jmethodID update_channel_meth;
2041 jmethodID release_pending_monitor_events_meth;
2043 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2044 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2046 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2047 LDKOutPoint funding_txo_var = funding_txo;
2048 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2049 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2050 long funding_txo_ref;
2051 if (funding_txo_var.is_owned) {
2052 funding_txo_ref = (long)funding_txo_var.inner | 1;
2054 funding_txo_ref = (long)&funding_txo_var;
2056 LDKChannelMonitor monitor_var = monitor;
2057 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2058 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2060 if (monitor_var.is_owned) {
2061 monitor_ref = (long)monitor_var.inner | 1;
2063 monitor_ref = (long)&monitor_var;
2065 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2066 DO_ASSERT(obj != NULL);
2067 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2068 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2072 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2073 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2075 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2076 LDKOutPoint funding_txo_var = funding_txo;
2077 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2078 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2079 long funding_txo_ref;
2080 if (funding_txo_var.is_owned) {
2081 funding_txo_ref = (long)funding_txo_var.inner | 1;
2083 funding_txo_ref = (long)&funding_txo_var;
2085 LDKChannelMonitorUpdate update_var = update;
2086 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2087 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 if (update_var.is_owned) {
2090 update_ref = (long)update_var.inner | 1;
2092 update_ref = (long)&update_var;
2094 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2095 DO_ASSERT(obj != NULL);
2096 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2097 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2101 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2102 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2104 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2105 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2106 DO_ASSERT(obj != NULL);
2107 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2108 LDKCVec_MonitorEventZ res = *ret;
2112 static void LDKWatch_JCalls_free(void* this_arg) {
2113 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2114 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2116 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2117 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2121 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2122 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2123 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2124 return (void*) this_arg;
2126 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2127 jclass c = (*env)->GetObjectClass(env, o);
2128 DO_ASSERT(c != NULL);
2129 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2130 atomic_init(&calls->refcnt, 1);
2131 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2132 calls->o = (*env)->NewWeakGlobalRef(env, o);
2133 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2134 DO_ASSERT(calls->watch_channel_meth != NULL);
2135 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2136 DO_ASSERT(calls->update_channel_meth != NULL);
2137 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2138 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2141 .this_arg = (void*) calls,
2142 .watch_channel = watch_channel_jcall,
2143 .update_channel = update_channel_jcall,
2144 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2145 .free = LDKWatch_JCalls_free,
2149 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2150 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2151 *res_ptr = LDKWatch_init(env, _a, o);
2152 return (long)res_ptr;
2154 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2155 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2156 DO_ASSERT(ret != NULL);
2159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) {
2160 LDKWatch* arg_conv = (LDKWatch*)arg;
2161 LDKOutPoint funding_txo_conv;
2162 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2163 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2164 LDKChannelMonitor monitor_conv;
2165 monitor_conv.inner = (void*)(monitor & (~1));
2166 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2167 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2168 *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv);
2172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) {
2173 LDKWatch* arg_conv = (LDKWatch*)arg;
2174 LDKOutPoint funding_txo_conv;
2175 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2176 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2177 LDKChannelMonitorUpdate update_conv;
2178 update_conv.inner = (void*)(update & (~1));
2179 update_conv.is_owned = (update & 1) || (update == 0);
2180 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2181 *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv);
2185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) {
2186 LDKWatch* arg_conv = (LDKWatch*)arg;
2187 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2188 *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg);
2192 typedef struct LDKFilter_JCalls {
2193 atomic_size_t refcnt;
2196 jmethodID register_tx_meth;
2197 jmethodID register_output_meth;
2199 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2200 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2202 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2203 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2204 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2205 long script_pubkey_ref = (long)&script_pubkey;
2206 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2207 DO_ASSERT(obj != NULL);
2208 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2210 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2211 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2213 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2214 long script_pubkey_ref = (long)&script_pubkey;
2215 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2216 DO_ASSERT(obj != NULL);
2217 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2219 static void LDKFilter_JCalls_free(void* this_arg) {
2220 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2221 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2223 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2224 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2228 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2229 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2230 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2231 return (void*) this_arg;
2233 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2234 jclass c = (*env)->GetObjectClass(env, o);
2235 DO_ASSERT(c != NULL);
2236 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2237 atomic_init(&calls->refcnt, 1);
2238 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2239 calls->o = (*env)->NewWeakGlobalRef(env, o);
2240 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2241 DO_ASSERT(calls->register_tx_meth != NULL);
2242 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2243 DO_ASSERT(calls->register_output_meth != NULL);
2246 .this_arg = (void*) calls,
2247 .register_tx = register_tx_jcall,
2248 .register_output = register_output_jcall,
2249 .free = LDKFilter_JCalls_free,
2253 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2254 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2255 *res_ptr = LDKFilter_init(env, _a, o);
2256 return (long)res_ptr;
2258 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2259 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2260 DO_ASSERT(ret != NULL);
2263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) {
2264 LDKFilter* arg_conv = (LDKFilter*)arg;
2265 unsigned char txid_arr[32];
2266 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2267 unsigned char (*txid_ref)[32] = &txid_arr;
2268 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2269 return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv);
2272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) {
2273 LDKFilter* arg_conv = (LDKFilter*)arg;
2274 LDKOutPoint outpoint_conv;
2275 outpoint_conv.inner = (void*)(outpoint & (~1));
2276 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2277 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2278 return (arg_conv->register_output)(arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2281 typedef struct LDKBroadcasterInterface_JCalls {
2282 atomic_size_t refcnt;
2285 jmethodID broadcast_transaction_meth;
2286 } LDKBroadcasterInterface_JCalls;
2287 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2288 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2290 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2291 long tx_ref = (long)&tx;
2292 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2293 DO_ASSERT(obj != NULL);
2294 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2296 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2297 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2298 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2300 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2301 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2305 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2306 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2307 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2308 return (void*) this_arg;
2310 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2311 jclass c = (*env)->GetObjectClass(env, o);
2312 DO_ASSERT(c != NULL);
2313 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2314 atomic_init(&calls->refcnt, 1);
2315 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2316 calls->o = (*env)->NewWeakGlobalRef(env, o);
2317 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2318 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2320 LDKBroadcasterInterface ret = {
2321 .this_arg = (void*) calls,
2322 .broadcast_transaction = broadcast_transaction_jcall,
2323 .free = LDKBroadcasterInterface_JCalls_free,
2327 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2328 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2329 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2330 return (long)res_ptr;
2332 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2333 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2334 DO_ASSERT(ret != NULL);
2337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) {
2338 LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg;
2339 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2341 return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv);
2344 typedef struct LDKFeeEstimator_JCalls {
2345 atomic_size_t refcnt;
2348 jmethodID get_est_sat_per_1000_weight_meth;
2349 } LDKFeeEstimator_JCalls;
2350 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2351 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2353 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2354 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2355 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2356 DO_ASSERT(obj != NULL);
2357 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2359 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2360 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2361 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2364 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2368 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2369 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2370 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2371 return (void*) this_arg;
2373 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2374 jclass c = (*env)->GetObjectClass(env, o);
2375 DO_ASSERT(c != NULL);
2376 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2377 atomic_init(&calls->refcnt, 1);
2378 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2379 calls->o = (*env)->NewWeakGlobalRef(env, o);
2380 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2381 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2383 LDKFeeEstimator ret = {
2384 .this_arg = (void*) calls,
2385 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2386 .free = LDKFeeEstimator_JCalls_free,
2390 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2391 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2392 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2393 return (long)res_ptr;
2395 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2396 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2397 DO_ASSERT(ret != NULL);
2400 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong arg, jclass confirmation_target) {
2401 LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg;
2402 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2403 return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv);
2406 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2407 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2408 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2411 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2412 ret->datalen = (*env)->GetArrayLength(env, elems);
2413 if (ret->datalen == 0) {
2416 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2417 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2418 for (size_t i = 0; i < ret->datalen; i++) {
2419 jlong arr_elem = java_elems[i];
2420 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2421 FREE((void*)arr_elem);
2422 ret->data[i] = arr_elem_conv;
2424 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2428 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2429 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2430 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2433 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2434 ret->datalen = (*env)->GetArrayLength(env, elems);
2435 if (ret->datalen == 0) {
2438 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2439 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2440 for (size_t i = 0; i < ret->datalen; i++) {
2441 jlong arr_elem = java_elems[i];
2442 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2443 FREE((void*)arr_elem);
2444 ret->data[i] = arr_elem_conv;
2446 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2450 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2451 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2452 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2455 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2456 ret->datalen = (*env)->GetArrayLength(env, elems);
2457 if (ret->datalen == 0) {
2460 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2461 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2462 for (size_t i = 0; i < ret->datalen; i++) {
2463 jlong arr_elem = java_elems[i];
2464 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2465 FREE((void*)arr_elem);
2466 ret->data[i] = arr_elem_conv;
2468 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2472 typedef struct LDKKeysInterface_JCalls {
2473 atomic_size_t refcnt;
2476 jmethodID get_node_secret_meth;
2477 jmethodID get_destination_script_meth;
2478 jmethodID get_shutdown_pubkey_meth;
2479 jmethodID get_channel_keys_meth;
2480 jmethodID get_secure_random_bytes_meth;
2481 } LDKKeysInterface_JCalls;
2482 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2483 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2485 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2486 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2487 DO_ASSERT(obj != NULL);
2488 LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth);
2489 LDKSecretKey res = *ret;
2493 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2494 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2496 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2497 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2498 DO_ASSERT(obj != NULL);
2499 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2500 LDKCVec_u8Z res = *ret;
2504 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2505 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2507 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2508 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2509 DO_ASSERT(obj != NULL);
2510 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2512 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2515 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2516 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2518 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2519 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2520 DO_ASSERT(obj != NULL);
2521 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2522 LDKChannelKeys res = *ret;
2526 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2527 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2529 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2530 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2531 DO_ASSERT(obj != NULL);
2532 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2533 LDKThirtyTwoBytes ret;
2534 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2537 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2538 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2539 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2541 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2542 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2546 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2547 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2548 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2549 return (void*) this_arg;
2551 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2552 jclass c = (*env)->GetObjectClass(env, o);
2553 DO_ASSERT(c != NULL);
2554 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2555 atomic_init(&calls->refcnt, 1);
2556 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2557 calls->o = (*env)->NewWeakGlobalRef(env, o);
2558 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
2559 DO_ASSERT(calls->get_node_secret_meth != NULL);
2560 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2561 DO_ASSERT(calls->get_destination_script_meth != NULL);
2562 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2563 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2564 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2565 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2566 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2567 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2569 LDKKeysInterface ret = {
2570 .this_arg = (void*) calls,
2571 .get_node_secret = get_node_secret_jcall,
2572 .get_destination_script = get_destination_script_jcall,
2573 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2574 .get_channel_keys = get_channel_keys_jcall,
2575 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2576 .free = LDKKeysInterface_JCalls_free,
2580 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2581 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2582 *res_ptr = LDKKeysInterface_init(env, _a, o);
2583 return (long)res_ptr;
2585 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2586 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2587 DO_ASSERT(ret != NULL);
2590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) {
2591 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2592 LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
2593 *ret = (arg_conv->get_node_secret)(arg_conv->this_arg);
2597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) {
2598 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2599 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2600 *ret = (arg_conv->get_destination_script)(arg_conv->this_arg);
2604 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) {
2605 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2606 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2607 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg).compressed_form);
2611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong arg, jboolean inbound, jlong channel_value_satoshis) {
2612 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2613 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2614 *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis);
2618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) {
2619 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2620 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2621 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data);
2625 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2626 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2627 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2628 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2629 for (size_t i = 0; i < vec->datalen; i++) {
2630 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2631 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2633 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2637 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2638 ret->datalen = (*env)->GetArrayLength(env, elems);
2639 if (ret->datalen == 0) {
2642 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2643 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2644 for (size_t i = 0; i < ret->datalen; i++) {
2645 jlong arr_elem = java_elems[i];
2646 LDKChannelDetails arr_elem_conv;
2647 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2648 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2649 ret->data[i] = arr_elem_conv;
2651 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2655 static jclass LDKNetAddress_IPv4_class = NULL;
2656 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2657 static jclass LDKNetAddress_IPv6_class = NULL;
2658 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2659 static jclass LDKNetAddress_OnionV2_class = NULL;
2660 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2661 static jclass LDKNetAddress_OnionV3_class = NULL;
2662 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2664 LDKNetAddress_IPv4_class =
2665 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2666 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2667 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2668 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2669 LDKNetAddress_IPv6_class =
2670 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2671 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2672 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2673 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2674 LDKNetAddress_OnionV2_class =
2675 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2676 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2677 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2678 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2679 LDKNetAddress_OnionV3_class =
2680 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2681 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2682 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2683 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2685 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2686 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2688 case LDKNetAddress_IPv4: {
2689 long addr_ref = (long)&obj->i_pv4.addr;
2690 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2692 case LDKNetAddress_IPv6: {
2693 long addr_ref = (long)&obj->i_pv6.addr;
2694 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2696 case LDKNetAddress_OnionV2: {
2697 long addr_ref = (long)&obj->onion_v2.addr;
2698 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2700 case LDKNetAddress_OnionV3: {
2701 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2702 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2703 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);
2708 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2709 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2710 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2713 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2714 ret->datalen = (*env)->GetArrayLength(env, elems);
2715 if (ret->datalen == 0) {
2718 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2719 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2720 for (size_t i = 0; i < ret->datalen; i++) {
2721 jlong arr_elem = java_elems[i];
2722 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2723 FREE((void*)arr_elem);
2724 ret->data[i] = arr_elem_conv;
2726 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2730 typedef struct LDKChannelMessageHandler_JCalls {
2731 atomic_size_t refcnt;
2734 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2735 jmethodID handle_open_channel_meth;
2736 jmethodID handle_accept_channel_meth;
2737 jmethodID handle_funding_created_meth;
2738 jmethodID handle_funding_signed_meth;
2739 jmethodID handle_funding_locked_meth;
2740 jmethodID handle_shutdown_meth;
2741 jmethodID handle_closing_signed_meth;
2742 jmethodID handle_update_add_htlc_meth;
2743 jmethodID handle_update_fulfill_htlc_meth;
2744 jmethodID handle_update_fail_htlc_meth;
2745 jmethodID handle_update_fail_malformed_htlc_meth;
2746 jmethodID handle_commitment_signed_meth;
2747 jmethodID handle_revoke_and_ack_meth;
2748 jmethodID handle_update_fee_meth;
2749 jmethodID handle_announcement_signatures_meth;
2750 jmethodID peer_disconnected_meth;
2751 jmethodID peer_connected_meth;
2752 jmethodID handle_channel_reestablish_meth;
2753 jmethodID handle_error_meth;
2754 } LDKChannelMessageHandler_JCalls;
2755 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2756 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2758 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2759 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2760 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2761 LDKInitFeatures their_features_var = their_features;
2762 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2763 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2764 long their_features_ref;
2765 if (their_features_var.is_owned) {
2766 their_features_ref = (long)their_features_var.inner | 1;
2768 their_features_ref = (long)&their_features_var;
2770 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2771 DO_ASSERT(obj != NULL);
2772 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2774 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2775 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2777 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2778 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2779 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2780 LDKInitFeatures their_features_var = their_features;
2781 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2782 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2783 long their_features_ref;
2784 if (their_features_var.is_owned) {
2785 their_features_ref = (long)their_features_var.inner | 1;
2787 their_features_ref = (long)&their_features_var;
2789 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2790 DO_ASSERT(obj != NULL);
2791 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2793 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2794 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2796 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2797 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2798 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2799 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2800 DO_ASSERT(obj != NULL);
2801 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2803 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2804 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2806 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2807 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2808 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2809 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2810 DO_ASSERT(obj != NULL);
2811 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2813 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2814 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2817 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2818 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2819 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2820 DO_ASSERT(obj != NULL);
2821 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2823 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2824 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2826 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2827 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2828 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2830 DO_ASSERT(obj != NULL);
2831 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2833 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2834 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2837 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2838 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2839 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2840 DO_ASSERT(obj != NULL);
2841 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2843 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2844 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2846 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2847 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2848 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2849 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2850 DO_ASSERT(obj != NULL);
2851 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2853 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2854 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2856 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2857 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2858 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2859 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2860 DO_ASSERT(obj != NULL);
2861 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2863 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2864 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2866 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2867 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2868 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2869 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2870 DO_ASSERT(obj != NULL);
2871 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2873 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2874 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2876 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2877 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2878 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2879 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2880 DO_ASSERT(obj != NULL);
2881 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2883 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2884 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2886 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2887 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2888 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2889 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2890 DO_ASSERT(obj != NULL);
2891 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2893 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2894 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2896 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2897 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2898 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2899 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2900 DO_ASSERT(obj != NULL);
2901 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2903 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2904 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2906 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2907 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2908 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2909 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2910 DO_ASSERT(obj != NULL);
2911 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2913 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2914 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2916 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2917 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2918 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2919 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2920 DO_ASSERT(obj != NULL);
2921 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2923 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2924 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2926 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2927 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2928 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2929 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2930 DO_ASSERT(obj != NULL);
2931 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2933 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2934 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2936 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2937 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2938 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2939 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2940 DO_ASSERT(obj != NULL);
2941 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
2943 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2944 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2946 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2947 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2948 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2949 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2950 DO_ASSERT(obj != NULL);
2951 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2953 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2954 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2956 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2957 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2958 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2959 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2960 DO_ASSERT(obj != NULL);
2961 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
2963 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2964 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2965 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2967 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2968 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2972 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2973 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2974 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2975 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2976 return (void*) this_arg;
2978 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2979 jclass c = (*env)->GetObjectClass(env, o);
2980 DO_ASSERT(c != NULL);
2981 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
2982 atomic_init(&calls->refcnt, 1);
2983 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2984 calls->o = (*env)->NewWeakGlobalRef(env, o);
2985 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
2986 DO_ASSERT(calls->handle_open_channel_meth != NULL);
2987 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
2988 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
2989 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
2990 DO_ASSERT(calls->handle_funding_created_meth != NULL);
2991 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
2992 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
2993 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
2994 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
2995 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
2996 DO_ASSERT(calls->handle_shutdown_meth != NULL);
2997 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
2998 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
2999 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3000 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
3001 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3002 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
3003 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3004 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
3005 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3006 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
3007 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3008 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
3009 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3010 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
3011 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3012 DO_ASSERT(calls->handle_update_fee_meth != NULL);
3013 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3014 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
3015 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3016 DO_ASSERT(calls->peer_disconnected_meth != NULL);
3017 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3018 DO_ASSERT(calls->peer_connected_meth != NULL);
3019 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3020 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
3021 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3022 DO_ASSERT(calls->handle_error_meth != NULL);
3024 LDKChannelMessageHandler ret = {
3025 .this_arg = (void*) calls,
3026 .handle_open_channel = handle_open_channel_jcall,
3027 .handle_accept_channel = handle_accept_channel_jcall,
3028 .handle_funding_created = handle_funding_created_jcall,
3029 .handle_funding_signed = handle_funding_signed_jcall,
3030 .handle_funding_locked = handle_funding_locked_jcall,
3031 .handle_shutdown = handle_shutdown_jcall,
3032 .handle_closing_signed = handle_closing_signed_jcall,
3033 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3034 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3035 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3036 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3037 .handle_commitment_signed = handle_commitment_signed_jcall,
3038 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3039 .handle_update_fee = handle_update_fee_jcall,
3040 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3041 .peer_disconnected = peer_disconnected_jcall,
3042 .peer_connected = peer_connected_jcall,
3043 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3044 .handle_error = handle_error_jcall,
3045 .free = LDKChannelMessageHandler_JCalls_free,
3046 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3048 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3051 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3052 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3053 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3054 return (long)res_ptr;
3056 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3057 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3058 DO_ASSERT(ret != NULL);
3061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3062 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3063 LDKPublicKey their_node_id_ref;
3064 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3065 LDKInitFeatures their_features_conv;
3066 their_features_conv.inner = (void*)(their_features & (~1));
3067 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3068 LDKOpenChannel msg_conv;
3069 msg_conv.inner = (void*)(msg & (~1));
3070 msg_conv.is_owned = (msg & 1) || (msg == 0);
3071 return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3075 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3076 LDKPublicKey their_node_id_ref;
3077 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3078 LDKInitFeatures their_features_conv;
3079 their_features_conv.inner = (void*)(their_features & (~1));
3080 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3081 LDKAcceptChannel msg_conv;
3082 msg_conv.inner = (void*)(msg & (~1));
3083 msg_conv.is_owned = (msg & 1) || (msg == 0);
3084 return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3088 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3089 LDKPublicKey their_node_id_ref;
3090 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3091 LDKFundingCreated msg_conv;
3092 msg_conv.inner = (void*)(msg & (~1));
3093 msg_conv.is_owned = (msg & 1) || (msg == 0);
3094 return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3098 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3099 LDKPublicKey their_node_id_ref;
3100 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3101 LDKFundingSigned msg_conv;
3102 msg_conv.inner = (void*)(msg & (~1));
3103 msg_conv.is_owned = (msg & 1) || (msg == 0);
3104 return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3108 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3109 LDKPublicKey their_node_id_ref;
3110 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3111 LDKFundingLocked msg_conv;
3112 msg_conv.inner = (void*)(msg & (~1));
3113 msg_conv.is_owned = (msg & 1) || (msg == 0);
3114 return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3118 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3119 LDKPublicKey their_node_id_ref;
3120 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3121 LDKShutdown msg_conv;
3122 msg_conv.inner = (void*)(msg & (~1));
3123 msg_conv.is_owned = (msg & 1) || (msg == 0);
3124 return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3128 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3129 LDKPublicKey their_node_id_ref;
3130 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3131 LDKClosingSigned msg_conv;
3132 msg_conv.inner = (void*)(msg & (~1));
3133 msg_conv.is_owned = (msg & 1) || (msg == 0);
3134 return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3138 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3139 LDKPublicKey their_node_id_ref;
3140 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3141 LDKUpdateAddHTLC msg_conv;
3142 msg_conv.inner = (void*)(msg & (~1));
3143 msg_conv.is_owned = (msg & 1) || (msg == 0);
3144 return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3148 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3149 LDKPublicKey their_node_id_ref;
3150 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3151 LDKUpdateFulfillHTLC msg_conv;
3152 msg_conv.inner = (void*)(msg & (~1));
3153 msg_conv.is_owned = (msg & 1) || (msg == 0);
3154 return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3158 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3159 LDKPublicKey their_node_id_ref;
3160 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3161 LDKUpdateFailHTLC msg_conv;
3162 msg_conv.inner = (void*)(msg & (~1));
3163 msg_conv.is_owned = (msg & 1) || (msg == 0);
3164 return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3168 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3169 LDKPublicKey their_node_id_ref;
3170 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3171 LDKUpdateFailMalformedHTLC msg_conv;
3172 msg_conv.inner = (void*)(msg & (~1));
3173 msg_conv.is_owned = (msg & 1) || (msg == 0);
3174 return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3178 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3179 LDKPublicKey their_node_id_ref;
3180 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3181 LDKCommitmentSigned msg_conv;
3182 msg_conv.inner = (void*)(msg & (~1));
3183 msg_conv.is_owned = (msg & 1) || (msg == 0);
3184 return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3188 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3189 LDKPublicKey their_node_id_ref;
3190 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3191 LDKRevokeAndACK msg_conv;
3192 msg_conv.inner = (void*)(msg & (~1));
3193 msg_conv.is_owned = (msg & 1) || (msg == 0);
3194 return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3198 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3199 LDKPublicKey their_node_id_ref;
3200 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3201 LDKUpdateFee msg_conv;
3202 msg_conv.inner = (void*)(msg & (~1));
3203 msg_conv.is_owned = (msg & 1) || (msg == 0);
3204 return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3208 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3209 LDKPublicKey their_node_id_ref;
3210 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3211 LDKAnnouncementSignatures msg_conv;
3212 msg_conv.inner = (void*)(msg & (~1));
3213 msg_conv.is_owned = (msg & 1) || (msg == 0);
3214 return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jboolean no_connection_possible) {
3218 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3219 LDKPublicKey their_node_id_ref;
3220 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3221 return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3225 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3226 LDKPublicKey their_node_id_ref;
3227 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3229 msg_conv.inner = (void*)(msg & (~1));
3230 msg_conv.is_owned = (msg & 1) || (msg == 0);
3231 return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3235 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3236 LDKPublicKey their_node_id_ref;
3237 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3238 LDKChannelReestablish msg_conv;
3239 msg_conv.inner = (void*)(msg & (~1));
3240 msg_conv.is_owned = (msg & 1) || (msg == 0);
3241 return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3245 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3246 LDKPublicKey their_node_id_ref;
3247 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3248 LDKErrorMessage msg_conv;
3249 msg_conv.inner = (void*)(msg & (~1));
3250 msg_conv.is_owned = (msg & 1) || (msg == 0);
3251 return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3254 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3255 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3256 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3257 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3258 for (size_t i = 0; i < vec->datalen; i++) {
3259 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3260 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3262 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3266 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3267 ret->datalen = (*env)->GetArrayLength(env, elems);
3268 if (ret->datalen == 0) {
3271 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3272 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3273 for (size_t i = 0; i < ret->datalen; i++) {
3274 jlong arr_elem = java_elems[i];
3275 LDKChannelMonitor arr_elem_conv;
3276 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3277 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3278 ret->data[i] = arr_elem_conv;
3280 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3284 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3285 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3286 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3289 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3290 ret->datalen = (*env)->GetArrayLength(env, elems);
3291 if (ret->datalen == 0) {
3294 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3295 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3296 for (size_t i = 0; i < ret->datalen; i++) {
3297 ret->data[i] = java_elems[i];
3299 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3303 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3304 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3305 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3306 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3307 for (size_t i = 0; i < vec->datalen; i++) {
3308 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3309 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3311 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3314 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3315 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3316 ret->datalen = (*env)->GetArrayLength(env, elems);
3317 if (ret->datalen == 0) {
3320 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3321 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3322 for (size_t i = 0; i < ret->datalen; i++) {
3323 jlong arr_elem = java_elems[i];
3324 LDKUpdateAddHTLC arr_elem_conv;
3325 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3326 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3327 ret->data[i] = arr_elem_conv;
3329 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3333 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3334 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3335 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3336 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3337 for (size_t i = 0; i < vec->datalen; i++) {
3338 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3339 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3341 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3345 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3346 ret->datalen = (*env)->GetArrayLength(env, elems);
3347 if (ret->datalen == 0) {
3350 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3351 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3352 for (size_t i = 0; i < ret->datalen; i++) {
3353 jlong arr_elem = java_elems[i];
3354 LDKUpdateFulfillHTLC arr_elem_conv;
3355 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3356 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3357 ret->data[i] = arr_elem_conv;
3359 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3363 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3364 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3365 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3366 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3367 for (size_t i = 0; i < vec->datalen; i++) {
3368 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3369 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3371 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3375 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3376 ret->datalen = (*env)->GetArrayLength(env, elems);
3377 if (ret->datalen == 0) {
3380 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3381 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3382 for (size_t i = 0; i < ret->datalen; i++) {
3383 jlong arr_elem = java_elems[i];
3384 LDKUpdateFailHTLC arr_elem_conv;
3385 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3386 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3387 ret->data[i] = arr_elem_conv;
3389 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3393 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3394 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3395 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3396 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3397 for (size_t i = 0; i < vec->datalen; i++) {
3398 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3399 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3401 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3405 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3406 ret->datalen = (*env)->GetArrayLength(env, elems);
3407 if (ret->datalen == 0) {
3410 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3411 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3412 for (size_t i = 0; i < ret->datalen; i++) {
3413 jlong arr_elem = java_elems[i];
3414 LDKUpdateFailMalformedHTLC arr_elem_conv;
3415 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3416 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3417 ret->data[i] = arr_elem_conv;
3419 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3423 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3424 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3427 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3428 if (val->result_ok) {
3429 return (long)val->contents.result;
3431 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3434 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3435 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3436 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3439 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3440 ret->datalen = (*env)->GetArrayLength(env, elems);
3441 if (ret->datalen == 0) {
3444 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3445 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3446 for (size_t i = 0; i < ret->datalen; i++) {
3447 jlong arr_elem = java_elems[i];
3448 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3449 FREE((void*)arr_elem);
3450 ret->data[i] = arr_elem_conv;
3452 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3456 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3457 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3458 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3459 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3460 for (size_t i = 0; i < vec->datalen; i++) {
3461 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3462 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3464 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3468 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3469 ret->datalen = (*env)->GetArrayLength(env, elems);
3470 if (ret->datalen == 0) {
3473 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3474 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3475 for (size_t i = 0; i < ret->datalen; i++) {
3476 jlong arr_elem = java_elems[i];
3477 LDKNodeAnnouncement arr_elem_conv;
3478 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3479 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3480 ret->data[i] = arr_elem_conv;
3482 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3486 typedef struct LDKRoutingMessageHandler_JCalls {
3487 atomic_size_t refcnt;
3490 jmethodID handle_node_announcement_meth;
3491 jmethodID handle_channel_announcement_meth;
3492 jmethodID handle_channel_update_meth;
3493 jmethodID handle_htlc_fail_channel_update_meth;
3494 jmethodID get_next_channel_announcements_meth;
3495 jmethodID get_next_node_announcements_meth;
3496 jmethodID should_request_full_sync_meth;
3497 } LDKRoutingMessageHandler_JCalls;
3498 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3499 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3501 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3503 DO_ASSERT(obj != NULL);
3504 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3505 LDKCResult_boolLightningErrorZ res = *ret;
3509 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3510 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3512 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3513 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3514 DO_ASSERT(obj != NULL);
3515 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3516 LDKCResult_boolLightningErrorZ res = *ret;
3520 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3521 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3523 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3524 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3525 DO_ASSERT(obj != NULL);
3526 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3527 LDKCResult_boolLightningErrorZ res = *ret;
3531 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3532 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3534 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3535 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3536 DO_ASSERT(obj != NULL);
3537 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3539 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3540 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3542 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3543 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3544 DO_ASSERT(obj != NULL);
3545 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3546 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3550 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3551 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3553 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3554 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3555 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3556 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3557 DO_ASSERT(obj != NULL);
3558 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3559 LDKCVec_NodeAnnouncementZ res = *ret;
3563 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
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 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3568 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3569 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3570 DO_ASSERT(obj != NULL);
3571 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3573 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3574 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3575 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3577 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3578 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3582 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3583 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3584 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3585 return (void*) this_arg;
3587 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3588 jclass c = (*env)->GetObjectClass(env, o);
3589 DO_ASSERT(c != NULL);
3590 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3591 atomic_init(&calls->refcnt, 1);
3592 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3593 calls->o = (*env)->NewWeakGlobalRef(env, o);
3594 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3595 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3596 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3597 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3598 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3599 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3600 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3601 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3602 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3603 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3604 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3605 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3606 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3607 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3609 LDKRoutingMessageHandler ret = {
3610 .this_arg = (void*) calls,
3611 .handle_node_announcement = handle_node_announcement_jcall,
3612 .handle_channel_announcement = handle_channel_announcement_jcall,
3613 .handle_channel_update = handle_channel_update_jcall,
3614 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3615 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3616 .get_next_node_announcements = get_next_node_announcements_jcall,
3617 .should_request_full_sync = should_request_full_sync_jcall,
3618 .free = LDKRoutingMessageHandler_JCalls_free,
3622 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3623 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3624 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3625 return (long)res_ptr;
3627 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3628 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3629 DO_ASSERT(ret != NULL);
3632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3633 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3634 LDKNodeAnnouncement msg_conv;
3635 msg_conv.inner = (void*)(msg & (~1));
3636 msg_conv.is_owned = (msg & 1) || (msg == 0);
3637 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3638 *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, &msg_conv);
3642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3643 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3644 LDKChannelAnnouncement msg_conv;
3645 msg_conv.inner = (void*)(msg & (~1));
3646 msg_conv.is_owned = (msg & 1) || (msg == 0);
3647 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3648 *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, &msg_conv);
3652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3653 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3654 LDKChannelUpdate msg_conv;
3655 msg_conv.inner = (void*)(msg & (~1));
3656 msg_conv.is_owned = (msg & 1) || (msg == 0);
3657 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3658 *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, &msg_conv);
3662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) {
3663 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3664 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3665 return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv);
3668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) {
3669 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3670 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3671 *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount);
3675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong arg, jbyteArray starting_point, jbyte batch_amount) {
3676 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3677 LDKPublicKey starting_point_ref;
3678 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3679 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3680 *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_ref, batch_amount);
3684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jbyteArray node_id) {
3685 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3686 LDKPublicKey node_id_ref;
3687 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3688 return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_ref);
3691 typedef struct LDKSocketDescriptor_JCalls {
3692 atomic_size_t refcnt;
3695 jmethodID send_data_meth;
3696 jmethodID disconnect_socket_meth;
3698 jmethodID hash_meth;
3699 } LDKSocketDescriptor_JCalls;
3700 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3701 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3703 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3704 long data_ref = (long)&data;
3705 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3706 DO_ASSERT(obj != NULL);
3707 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_ref, resume_read);
3709 void disconnect_socket_jcall(void* this_arg) {
3710 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3712 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3713 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3714 DO_ASSERT(obj != NULL);
3715 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3717 bool eq_jcall(const void* this_arg, const void *other_arg) {
3718 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3720 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3721 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3722 DO_ASSERT(obj != NULL);
3723 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3725 uint64_t hash_jcall(const void* this_arg) {
3726 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3728 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3729 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3730 DO_ASSERT(obj != NULL);
3731 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3733 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3734 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3735 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3737 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3738 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3742 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3743 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3744 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3745 return (void*) this_arg;
3747 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3748 jclass c = (*env)->GetObjectClass(env, o);
3749 DO_ASSERT(c != NULL);
3750 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3751 atomic_init(&calls->refcnt, 1);
3752 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3753 calls->o = (*env)->NewWeakGlobalRef(env, o);
3754 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3755 DO_ASSERT(calls->send_data_meth != NULL);
3756 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3757 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3758 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3759 DO_ASSERT(calls->eq_meth != NULL);
3760 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3761 DO_ASSERT(calls->hash_meth != NULL);
3763 LDKSocketDescriptor ret = {
3764 .this_arg = (void*) calls,
3765 .send_data = send_data_jcall,
3766 .disconnect_socket = disconnect_socket_jcall,
3769 .clone = LDKSocketDescriptor_JCalls_clone,
3770 .free = LDKSocketDescriptor_JCalls_free,
3774 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3775 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3776 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3777 return (long)res_ptr;
3779 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3780 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3781 DO_ASSERT(ret != NULL);
3784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) {
3785 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3786 LDKu8slice data_conv = *(LDKu8slice*)data;
3787 return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read);
3790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) {
3791 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3792 return (arg_conv->disconnect_socket)(arg_conv->this_arg);
3795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) {
3796 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3797 return (arg_conv->hash)(arg_conv->this_arg);
3800 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3801 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3802 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3805 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3808 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3809 if (val->result_ok) {
3810 return (long)val->contents.result;
3812 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3815 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3816 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3819 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3820 if (val->result_ok) {
3821 return (long)val->contents.result;
3823 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3827 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3830 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3831 if (val->result_ok) {
3832 return (long)val->contents.result;
3834 return (long)val->contents.err;
3837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3838 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3841 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3842 if (val->result_ok) {
3843 return (long)val->contents.result;
3845 return (long)val->contents.err;
3848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3849 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3852 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3853 if (val->result_ok) {
3854 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3856 return (long)val->contents.err;
3859 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3860 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3861 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3864 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3865 ret->datalen = (*env)->GetArrayLength(env, elems);
3866 if (ret->datalen == 0) {
3869 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3870 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3871 for (size_t i = 0; i < ret->datalen; i++) {
3872 jlong arr_elem = java_elems[i];
3873 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3874 FREE((void*)arr_elem);
3875 ret->data[i] = arr_elem_conv;
3877 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3881 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3882 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3883 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3884 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3885 for (size_t i = 0; i < vec->datalen; i++) {
3886 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3887 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3889 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3892 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3893 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3894 ret->datalen = (*env)->GetArrayLength(env, elems);
3895 if (ret->datalen == 0) {
3898 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3899 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3900 for (size_t i = 0; i < ret->datalen; i++) {
3901 jlong arr_elem = java_elems[i];
3902 LDKRouteHop arr_elem_conv;
3903 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3904 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3905 ret->data[i] = arr_elem_conv;
3907 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3911 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3912 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3913 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3916 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3917 ret->datalen = (*env)->GetArrayLength(env, elems);
3918 if (ret->datalen == 0) {
3921 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3922 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3923 for (size_t i = 0; i < ret->datalen; i++) {
3924 jlong arr_elem = java_elems[i];
3925 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3926 FREE((void*)arr_elem);
3927 ret->data[i] = arr_elem_conv;
3929 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3934 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3937 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3938 if (val->result_ok) {
3939 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3941 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3944 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3945 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3946 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3947 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3948 for (size_t i = 0; i < vec->datalen; i++) {
3949 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3950 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3952 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3956 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3957 ret->datalen = (*env)->GetArrayLength(env, elems);
3958 if (ret->datalen == 0) {
3961 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
3962 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3963 for (size_t i = 0; i < ret->datalen; i++) {
3964 jlong arr_elem = java_elems[i];
3965 LDKRouteHint arr_elem_conv;
3966 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3967 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3968 ret->data[i] = arr_elem_conv;
3970 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3975 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
3977 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
3980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3981 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
3983 return C2Tuple_OutPointScriptZ_free(arg_conv);
3986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3987 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
3989 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
3992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3993 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
3995 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
3998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
3999 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4001 return C2Tuple_u64u64Z_free(arg_conv);
4004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4005 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4007 return C2Tuple_usizeTransactionZ_free(arg_conv);
4010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4011 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4013 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4017 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4019 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4023 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4025 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4026 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4031 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4033 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
4036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4037 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4039 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4040 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4045 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4047 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4048 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4053 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4055 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4059 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4061 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4062 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4067 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4069 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4070 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4075 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4077 return CResult_NoneAPIErrorZ_free(arg_conv);
4080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4081 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4083 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4084 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4089 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4091 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4095 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4097 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4098 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4103 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4105 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4109 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4111 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4112 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4117 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4119 return CResult_NonePaymentSendFailureZ_free(arg_conv);
4122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4123 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4125 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4126 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4131 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4133 return CResult_NonePeerHandleErrorZ_free(arg_conv);
4136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4137 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4139 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4140 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4145 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4147 return CResult_PublicKeySecpErrorZ_free(arg_conv);
4150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4151 LDKPublicKey arg_ref;
4152 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4153 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4154 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4159 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4161 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4162 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4167 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4169 return CResult_RouteLightningErrorZ_free(arg_conv);
4172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4173 LDKRoute arg_conv = *(LDKRoute*)arg;
4175 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4176 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4181 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4183 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4184 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4189 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4191 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4195 LDKSecretKey arg_conv = *(LDKSecretKey*)arg;
4197 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4198 *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv);
4202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4203 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4205 return CResult_SignatureNoneZ_free(arg_conv);
4208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4209 LDKSignature arg_conv = *(LDKSignature*)arg;
4211 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4212 *ret = CResult_SignatureNoneZ_ok(arg_conv);
4216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4217 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4219 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4220 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4225 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4227 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4231 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4233 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4234 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4239 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4241 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4242 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4247 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4249 return CResult_TxOutAccessErrorZ_free(arg_conv);
4252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4253 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4255 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4256 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4261 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4263 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4264 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4269 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4271 return CResult_boolLightningErrorZ_free(arg_conv);
4274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4275 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4276 *ret = CResult_boolLightningErrorZ_ok(arg);
4280 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4281 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4283 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4284 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4289 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4291 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4295 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4296 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4301 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4303 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4307 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4309 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4313 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4315 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4319 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4321 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4325 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4327 return CVec_CVec_RouteHopZZ_free(arg_conv);
4330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4331 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4333 return CVec_ChannelDetailsZ_free(arg_conv);
4336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4337 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4339 return CVec_ChannelMonitorZ_free(arg_conv);
4342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4343 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4345 return CVec_EventZ_free(arg_conv);
4348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4349 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4351 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4355 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4357 return CVec_MessageSendEventZ_free(arg_conv);
4360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4361 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4363 return CVec_MonitorEventZ_free(arg_conv);
4366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4367 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4369 return CVec_NetAddressZ_free(arg_conv);
4372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4373 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4375 return CVec_NodeAnnouncementZ_free(arg_conv);
4378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4379 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4381 return CVec_PublicKeyZ_free(arg_conv);
4384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4385 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4387 return CVec_RouteHintZ_free(arg_conv);
4390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4391 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4393 return CVec_RouteHopZ_free(arg_conv);
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4397 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4399 return CVec_SignatureZ_free(arg_conv);
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4403 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4405 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4409 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4411 return CVec_TransactionZ_free(arg_conv);
4414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4415 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4417 return CVec_TxOutZ_free(arg_conv);
4420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4421 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4423 return CVec_UpdateAddHTLCZ_free(arg_conv);
4426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4427 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4429 return CVec_UpdateFailHTLCZ_free(arg_conv);
4432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4433 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4435 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4439 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4441 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4445 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4447 return CVec_u64Z_free(arg_conv);
4450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4451 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4453 return CVec_u8Z_free(arg_conv);
4456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4457 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4459 return Transaction_free(_res_conv);
4462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4463 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4465 return TxOut_free(_res_conv);
4468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4469 LDKTransaction b_conv = *(LDKTransaction*)b;
4471 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4472 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4477 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4478 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4483 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4484 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4490 a_conv.inner = (void*)(a & (~1));
4491 a_conv.is_owned = (a & 1) || (a == 0);
4492 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4494 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4495 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4500 LDKThirtyTwoBytes a_ref;
4501 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4502 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4504 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4505 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4510 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4511 *ret = C2Tuple_u64u64Z_new(a, b);
4515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4516 LDKSignature a_conv = *(LDKSignature*)a;
4518 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4520 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4521 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
4525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4526 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4527 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4532 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4533 *ret = CResult_SignatureNoneZ_err();
4537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4538 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4539 *ret = CResult_CVec_SignatureZNoneZ_err();
4543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4544 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4545 *ret = CResult_NoneAPIErrorZ_ok();
4549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4550 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4551 *ret = CResult_NonePaymentSendFailureZ_ok();
4555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4556 LDKChannelAnnouncement a_conv;
4557 a_conv.inner = (void*)(a & (~1));
4558 a_conv.is_owned = (a & 1) || (a == 0);
4559 LDKChannelUpdate b_conv;
4560 b_conv.inner = (void*)(b & (~1));
4561 b_conv.is_owned = (b & 1) || (b == 0);
4562 LDKChannelUpdate c_conv;
4563 c_conv.inner = (void*)(c & (~1));
4564 c_conv.is_owned = (c & 1) || (c == 0);
4565 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4566 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4571 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4572 *ret = CResult_NonePeerHandleErrorZ_ok();
4576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4577 LDKHTLCOutputInCommitment a_conv;
4578 a_conv.inner = (void*)(a & (~1));
4579 a_conv.is_owned = (a & 1) || (a == 0);
4580 LDKSignature b_conv = *(LDKSignature*)b;
4582 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4583 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
4587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4588 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4589 FREE((void*)this_ptr);
4590 return Event_free(this_ptr_conv);
4593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4594 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4595 FREE((void*)this_ptr);
4596 return MessageSendEvent_free(this_ptr_conv);
4599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4600 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4601 FREE((void*)this_ptr);
4602 return MessageSendEventsProvider_free(this_ptr_conv);
4605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4606 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4607 FREE((void*)this_ptr);
4608 return EventsProvider_free(this_ptr_conv);
4611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4612 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4613 FREE((void*)this_ptr);
4614 return APIError_free(this_ptr_conv);
4617 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4618 jclass ret = LDKLevel_to_java(_env, Level_max());
4622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4623 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4624 FREE((void*)this_ptr);
4625 return Logger_free(this_ptr_conv);
4628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4629 LDKChannelHandshakeConfig this_ptr_conv;
4630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4632 return ChannelHandshakeConfig_free(this_ptr_conv);
4635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4636 LDKChannelHandshakeConfig orig_conv;
4637 orig_conv.inner = (void*)(orig & (~1));
4638 orig_conv.is_owned = (orig & 1) || (orig == 0);
4639 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4640 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4643 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4644 LDKChannelHandshakeConfig this_ptr_conv;
4645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4647 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4651 LDKChannelHandshakeConfig this_ptr_conv;
4652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4654 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4657 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4658 LDKChannelHandshakeConfig this_ptr_conv;
4659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4661 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
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_set_our_to_self_delay(&this_ptr_conv, val);
4671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4672 LDKChannelHandshakeConfig this_ptr_conv;
4673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4675 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4679 LDKChannelHandshakeConfig this_ptr_conv;
4680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4682 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4685 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) {
4686 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4687 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4691 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4692 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4696 LDKChannelHandshakeLimits this_ptr_conv;
4697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4699 return ChannelHandshakeLimits_free(this_ptr_conv);
4702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4703 LDKChannelHandshakeLimits this_ptr_conv;
4704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4706 return ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4710 LDKChannelHandshakeLimits this_ptr_conv;
4711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4713 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4717 LDKChannelHandshakeLimits this_ptr_conv;
4718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4720 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4724 LDKChannelHandshakeLimits this_ptr_conv;
4725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4727 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4731 LDKChannelHandshakeLimits this_ptr_conv;
4732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4734 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4737 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) {
4738 LDKChannelHandshakeLimits this_ptr_conv;
4739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4741 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4745 LDKChannelHandshakeLimits this_ptr_conv;
4746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4748 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4752 LDKChannelHandshakeLimits this_ptr_conv;
4753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4755 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4758 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4759 LDKChannelHandshakeLimits this_ptr_conv;
4760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4762 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4766 LDKChannelHandshakeLimits this_ptr_conv;
4767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4769 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4773 LDKChannelHandshakeLimits this_ptr_conv;
4774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4776 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4780 LDKChannelHandshakeLimits this_ptr_conv;
4781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4783 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4787 LDKChannelHandshakeLimits this_ptr_conv;
4788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4790 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4794 LDKChannelHandshakeLimits this_ptr_conv;
4795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4797 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4800 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4801 LDKChannelHandshakeLimits this_ptr_conv;
4802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4804 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4808 LDKChannelHandshakeLimits this_ptr_conv;
4809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4811 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4815 LDKChannelHandshakeLimits this_ptr_conv;
4816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4817 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4818 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4822 LDKChannelHandshakeLimits this_ptr_conv;
4823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4825 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4828 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4829 LDKChannelHandshakeLimits this_ptr_conv;
4830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4832 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4836 LDKChannelHandshakeLimits this_ptr_conv;
4837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4839 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4842 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) {
4843 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);
4844 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4848 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4849 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4853 LDKChannelConfig this_ptr_conv;
4854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4856 return ChannelConfig_free(this_ptr_conv);
4859 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4860 LDKChannelConfig this_ptr_conv;
4861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4863 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4867 LDKChannelConfig this_ptr_conv;
4868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4870 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4874 LDKChannelConfig this_ptr_conv;
4875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4877 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4881 LDKChannelConfig this_ptr_conv;
4882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4884 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4888 LDKChannelConfig this_ptr_conv;
4889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4891 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4895 LDKChannelConfig this_ptr_conv;
4896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4898 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4901 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) {
4902 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4903 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4906 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4907 LDKChannelConfig ret = ChannelConfig_default();
4908 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4912 LDKChannelConfig obj_conv;
4913 obj_conv.inner = (void*)(obj & (~1));
4914 obj_conv.is_owned = (obj & 1) || (obj == 0);
4915 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4916 *ret = ChannelConfig_write(&obj_conv);
4920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4921 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4922 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4923 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4927 LDKUserConfig this_ptr_conv;
4928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4930 return UserConfig_free(this_ptr_conv);
4933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4934 LDKUserConfig this_ptr_conv;
4935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4937 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
4938 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4942 LDKUserConfig this_ptr_conv;
4943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4945 LDKChannelHandshakeConfig val_conv;
4946 val_conv.inner = (void*)(val & (~1));
4947 val_conv.is_owned = (val & 1) || (val == 0);
4948 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
4951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
4952 LDKUserConfig this_ptr_conv;
4953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4955 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
4956 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4960 LDKUserConfig this_ptr_conv;
4961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4963 LDKChannelHandshakeLimits val_conv;
4964 val_conv.inner = (void*)(val & (~1));
4965 val_conv.is_owned = (val & 1) || (val == 0);
4966 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
4969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
4970 LDKUserConfig this_ptr_conv;
4971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4973 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
4974 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4978 LDKUserConfig this_ptr_conv;
4979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4981 LDKChannelConfig val_conv;
4982 val_conv.inner = (void*)(val & (~1));
4983 val_conv.is_owned = (val & 1) || (val == 0);
4984 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
4987 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) {
4988 LDKChannelHandshakeConfig own_channel_config_arg_conv;
4989 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
4990 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
4991 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
4992 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
4993 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
4994 LDKChannelConfig channel_options_arg_conv;
4995 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
4996 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
4997 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
4998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5002 LDKUserConfig ret = UserConfig_default();
5003 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5007 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5008 FREE((void*)this_ptr);
5009 return Access_free(this_ptr_conv);
5012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5013 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5014 FREE((void*)this_ptr);
5015 return Watch_free(this_ptr_conv);
5018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5019 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5020 FREE((void*)this_ptr);
5021 return Filter_free(this_ptr_conv);
5024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5025 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5026 FREE((void*)this_ptr);
5027 return BroadcasterInterface_free(this_ptr_conv);
5030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5031 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5032 FREE((void*)this_ptr);
5033 return FeeEstimator_free(this_ptr_conv);
5036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5037 LDKChainMonitor this_ptr_conv;
5038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5040 return ChainMonitor_free(this_ptr_conv);
5043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5044 LDKChainMonitor this_arg_conv;
5045 this_arg_conv.inner = (void*)(this_arg & (~1));
5046 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5047 unsigned char header_arr[80];
5048 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5049 unsigned char (*header_ref)[80] = &header_arr;
5050 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5051 FREE((void*)txdata);
5052 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5056 LDKChainMonitor this_arg_conv;
5057 this_arg_conv.inner = (void*)(this_arg & (~1));
5058 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5059 unsigned char header_arr[80];
5060 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5061 unsigned char (*header_ref)[80] = &header_arr;
5062 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5066 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5067 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5068 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5069 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5070 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5072 LDKLogger logger_conv = *(LDKLogger*)logger;
5073 if (logger_conv.free == LDKLogger_JCalls_free) {
5074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5075 LDKLogger_JCalls_clone(logger_conv.this_arg);
5077 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5078 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5079 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5080 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5082 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5083 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5087 LDKChainMonitor this_arg_conv;
5088 this_arg_conv.inner = (void*)(this_arg & (~1));
5089 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5090 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5091 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5096 LDKChainMonitor this_arg_conv;
5097 this_arg_conv.inner = (void*)(this_arg & (~1));
5098 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5099 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5100 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5105 LDKChannelMonitorUpdate this_ptr_conv;
5106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5108 return ChannelMonitorUpdate_free(this_ptr_conv);
5111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5112 LDKChannelMonitorUpdate this_ptr_conv;
5113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5115 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5119 LDKChannelMonitorUpdate this_ptr_conv;
5120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5122 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5126 LDKChannelMonitorUpdate obj_conv;
5127 obj_conv.inner = (void*)(obj & (~1));
5128 obj_conv.is_owned = (obj & 1) || (obj == 0);
5129 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5130 *ret = ChannelMonitorUpdate_write(&obj_conv);
5134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5135 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5136 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
5137 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5141 LDKMonitorUpdateError this_ptr_conv;
5142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5144 return MonitorUpdateError_free(this_ptr_conv);
5147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5148 LDKMonitorEvent this_ptr_conv;
5149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5151 return MonitorEvent_free(this_ptr_conv);
5154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5155 LDKHTLCUpdate this_ptr_conv;
5156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5158 return HTLCUpdate_free(this_ptr_conv);
5161 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5162 LDKHTLCUpdate obj_conv;
5163 obj_conv.inner = (void*)(obj & (~1));
5164 obj_conv.is_owned = (obj & 1) || (obj == 0);
5165 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5166 *ret = HTLCUpdate_write(&obj_conv);
5170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5171 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5172 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5173 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5177 LDKChannelMonitor 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 ChannelMonitor_free(this_ptr_conv);
5183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5184 LDKChannelMonitor this_arg_conv;
5185 this_arg_conv.inner = (void*)(this_arg & (~1));
5186 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5187 LDKChannelMonitorUpdate updates_conv;
5188 updates_conv.inner = (void*)(updates & (~1));
5189 updates_conv.is_owned = (updates & 1) || (updates == 0);
5190 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5191 LDKLogger* logger_conv = (LDKLogger*)logger;
5192 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5193 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5198 LDKChannelMonitor this_arg_conv;
5199 this_arg_conv.inner = (void*)(this_arg & (~1));
5200 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5201 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5205 LDKChannelMonitor this_arg_conv;
5206 this_arg_conv.inner = (void*)(this_arg & (~1));
5207 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5208 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5209 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5214 LDKChannelMonitor this_arg_conv;
5215 this_arg_conv.inner = (void*)(this_arg & (~1));
5216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5217 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5218 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5223 LDKChannelMonitor this_arg_conv;
5224 this_arg_conv.inner = (void*)(this_arg & (~1));
5225 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5226 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5227 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5232 LDKChannelMonitor this_arg_conv;
5233 this_arg_conv.inner = (void*)(this_arg & (~1));
5234 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5235 LDKLogger* logger_conv = (LDKLogger*)logger;
5236 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5237 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5241 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) {
5242 LDKChannelMonitor this_arg_conv;
5243 this_arg_conv.inner = (void*)(this_arg & (~1));
5244 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5245 unsigned char header_arr[80];
5246 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5247 unsigned char (*header_ref)[80] = &header_arr;
5248 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5249 FREE((void*)txdata);
5250 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5251 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5252 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5253 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5255 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5256 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5257 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5258 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5260 LDKLogger logger_conv = *(LDKLogger*)logger;
5261 if (logger_conv.free == LDKLogger_JCalls_free) {
5262 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5263 LDKLogger_JCalls_clone(logger_conv.this_arg);
5265 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5266 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5270 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) {
5271 LDKChannelMonitor this_arg_conv;
5272 this_arg_conv.inner = (void*)(this_arg & (~1));
5273 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5274 unsigned char header_arr[80];
5275 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5276 unsigned char (*header_ref)[80] = &header_arr;
5277 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5278 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5279 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5280 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5282 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5283 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5284 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5285 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5287 LDKLogger logger_conv = *(LDKLogger*)logger;
5288 if (logger_conv.free == LDKLogger_JCalls_free) {
5289 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5290 LDKLogger_JCalls_clone(logger_conv.this_arg);
5292 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5296 LDKOutPoint this_ptr_conv;
5297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5299 return OutPoint_free(this_ptr_conv);
5302 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5303 LDKOutPoint this_ptr_conv;
5304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5306 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5307 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5312 LDKOutPoint this_ptr_conv;
5313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5315 LDKThirtyTwoBytes val_ref;
5316 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5317 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5320 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5321 LDKOutPoint this_ptr_conv;
5322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5324 return OutPoint_get_index(&this_ptr_conv);
5327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5328 LDKOutPoint this_ptr_conv;
5329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5331 return OutPoint_set_index(&this_ptr_conv, val);
5334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5335 LDKThirtyTwoBytes txid_arg_ref;
5336 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5337 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5338 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5342 LDKOutPoint this_arg_conv;
5343 this_arg_conv.inner = (void*)(this_arg & (~1));
5344 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5345 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5346 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5351 LDKOutPoint obj_conv;
5352 obj_conv.inner = (void*)(obj & (~1));
5353 obj_conv.is_owned = (obj & 1) || (obj == 0);
5354 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5355 *ret = OutPoint_write(&obj_conv);
5359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5360 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5361 LDKOutPoint ret = OutPoint_read(ser_conv);
5362 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5366 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5367 FREE((void*)this_ptr);
5368 return SpendableOutputDescriptor_free(this_ptr_conv);
5371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5372 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5373 FREE((void*)this_ptr);
5374 return ChannelKeys_free(this_ptr_conv);
5377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5378 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5379 FREE((void*)this_ptr);
5380 return KeysInterface_free(this_ptr_conv);
5383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5384 LDKInMemoryChannelKeys this_ptr_conv;
5385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5387 return InMemoryChannelKeys_free(this_ptr_conv);
5390 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5391 LDKInMemoryChannelKeys this_ptr_conv;
5392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5394 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5395 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5400 LDKInMemoryChannelKeys this_ptr_conv;
5401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5403 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5405 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_conv);
5408 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5409 LDKInMemoryChannelKeys this_ptr_conv;
5410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5412 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5413 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5418 LDKInMemoryChannelKeys this_ptr_conv;
5419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5421 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5423 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_conv);
5426 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5427 LDKInMemoryChannelKeys this_ptr_conv;
5428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5430 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5431 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5436 LDKInMemoryChannelKeys this_ptr_conv;
5437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5439 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5441 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_conv);
5444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5445 LDKInMemoryChannelKeys this_ptr_conv;
5446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5448 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5449 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5454 LDKInMemoryChannelKeys this_ptr_conv;
5455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5457 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5459 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_conv);
5462 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5463 LDKInMemoryChannelKeys this_ptr_conv;
5464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5466 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5467 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5472 LDKInMemoryChannelKeys this_ptr_conv;
5473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5475 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5477 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_conv);
5480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5481 LDKInMemoryChannelKeys this_ptr_conv;
5482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5484 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5485 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5490 LDKInMemoryChannelKeys this_ptr_conv;
5491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5493 LDKThirtyTwoBytes val_ref;
5494 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5495 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
5499 LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
5500 FREE((void*)funding_key);
5501 LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
5502 FREE((void*)revocation_base_key);
5503 LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
5504 FREE((void*)payment_key);
5505 LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
5506 FREE((void*)delayed_payment_base_key);
5507 LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
5508 FREE((void*)htlc_base_key);
5509 LDKThirtyTwoBytes commitment_seed_ref;
5510 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5511 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5512 FREE((void*)key_derivation_params);
5513 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
5514 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5518 LDKInMemoryChannelKeys this_arg_conv;
5519 this_arg_conv.inner = (void*)(this_arg & (~1));
5520 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5521 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5522 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5525 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5526 LDKInMemoryChannelKeys this_arg_conv;
5527 this_arg_conv.inner = (void*)(this_arg & (~1));
5528 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5529 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5532 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5533 LDKInMemoryChannelKeys this_arg_conv;
5534 this_arg_conv.inner = (void*)(this_arg & (~1));
5535 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5536 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5540 LDKInMemoryChannelKeys this_arg_conv;
5541 this_arg_conv.inner = (void*)(this_arg & (~1));
5542 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5543 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5544 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5549 LDKInMemoryChannelKeys obj_conv;
5550 obj_conv.inner = (void*)(obj & (~1));
5551 obj_conv.is_owned = (obj & 1) || (obj == 0);
5552 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5553 *ret = InMemoryChannelKeys_write(&obj_conv);
5557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5558 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5559 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5560 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5564 LDKKeysManager this_ptr_conv;
5565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5567 return KeysManager_free(this_ptr_conv);
5570 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) {
5571 unsigned char seed_arr[32];
5572 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5573 unsigned char (*seed_ref)[32] = &seed_arr;
5574 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5575 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5576 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5579 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) {
5580 LDKKeysManager this_arg_conv;
5581 this_arg_conv.inner = (void*)(this_arg & (~1));
5582 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5583 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5584 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5588 LDKKeysManager this_arg_conv;
5589 this_arg_conv.inner = (void*)(this_arg & (~1));
5590 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5591 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5592 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5597 LDKChannelManager this_ptr_conv;
5598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5600 return ChannelManager_free(this_ptr_conv);
5603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5604 LDKChannelDetails this_ptr_conv;
5605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5607 return ChannelDetails_free(this_ptr_conv);
5610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5611 LDKChannelDetails this_ptr_conv;
5612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5614 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5615 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5620 LDKChannelDetails this_ptr_conv;
5621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5623 LDKThirtyTwoBytes val_ref;
5624 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5625 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5629 LDKChannelDetails this_ptr_conv;
5630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5632 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5633 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5638 LDKChannelDetails this_ptr_conv;
5639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5641 LDKPublicKey val_ref;
5642 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5643 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5647 LDKChannelDetails this_ptr_conv;
5648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5650 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5651 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5655 LDKChannelDetails this_ptr_conv;
5656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5658 LDKInitFeatures val_conv;
5659 val_conv.inner = (void*)(val & (~1));
5660 val_conv.is_owned = (val & 1) || (val == 0);
5661 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5665 LDKChannelDetails this_ptr_conv;
5666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5668 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5672 LDKChannelDetails this_ptr_conv;
5673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5675 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5679 LDKChannelDetails this_ptr_conv;
5680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5682 return ChannelDetails_get_user_id(&this_ptr_conv);
5685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5686 LDKChannelDetails this_ptr_conv;
5687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5689 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5693 LDKChannelDetails this_ptr_conv;
5694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5696 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5700 LDKChannelDetails this_ptr_conv;
5701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5703 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5707 LDKChannelDetails this_ptr_conv;
5708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5710 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5714 LDKChannelDetails this_ptr_conv;
5715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5717 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5720 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5721 LDKChannelDetails this_ptr_conv;
5722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5724 return ChannelDetails_get_is_live(&this_ptr_conv);
5727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5728 LDKChannelDetails this_ptr_conv;
5729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5731 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5735 LDKPaymentSendFailure 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 return PaymentSendFailure_free(this_ptr_conv);
5741 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) {
5742 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5743 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5744 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5745 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5746 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5748 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5749 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5750 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5751 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5753 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5754 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5755 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5756 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5758 LDKLogger logger_conv = *(LDKLogger*)logger;
5759 if (logger_conv.free == LDKLogger_JCalls_free) {
5760 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5761 LDKLogger_JCalls_clone(logger_conv.this_arg);
5763 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5764 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5765 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5766 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5768 LDKUserConfig config_conv;
5769 config_conv.inner = (void*)(config & (~1));
5770 config_conv.is_owned = (config & 1) || (config == 0);
5771 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);
5772 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5775 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) {
5776 LDKChannelManager this_arg_conv;
5777 this_arg_conv.inner = (void*)(this_arg & (~1));
5778 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5779 LDKPublicKey their_network_key_ref;
5780 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
5781 LDKUserConfig override_config_conv;
5782 override_config_conv.inner = (void*)(override_config & (~1));
5783 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5784 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5785 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
5789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5790 LDKChannelManager this_arg_conv;
5791 this_arg_conv.inner = (void*)(this_arg & (~1));
5792 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5793 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5794 *ret = ChannelManager_list_channels(&this_arg_conv);
5798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5799 LDKChannelManager this_arg_conv;
5800 this_arg_conv.inner = (void*)(this_arg & (~1));
5801 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5802 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5803 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5808 LDKChannelManager this_arg_conv;
5809 this_arg_conv.inner = (void*)(this_arg & (~1));
5810 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5811 unsigned char channel_id_arr[32];
5812 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5813 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5814 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5815 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5820 LDKChannelManager this_arg_conv;
5821 this_arg_conv.inner = (void*)(this_arg & (~1));
5822 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5823 unsigned char channel_id_arr[32];
5824 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5825 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5826 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5830 LDKChannelManager this_arg_conv;
5831 this_arg_conv.inner = (void*)(this_arg & (~1));
5832 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5833 return ChannelManager_force_close_all_channels(&this_arg_conv);
5836 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) {
5837 LDKChannelManager this_arg_conv;
5838 this_arg_conv.inner = (void*)(this_arg & (~1));
5839 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5840 LDKRoute route_conv;
5841 route_conv.inner = (void*)(route & (~1));
5842 route_conv.is_owned = (route & 1) || (route == 0);
5843 LDKThirtyTwoBytes payment_hash_ref;
5844 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
5845 LDKThirtyTwoBytes payment_secret_ref;
5846 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5847 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5848 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
5852 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) {
5853 LDKChannelManager this_arg_conv;
5854 this_arg_conv.inner = (void*)(this_arg & (~1));
5855 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5856 unsigned char temporary_channel_id_arr[32];
5857 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
5858 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
5859 LDKOutPoint funding_txo_conv;
5860 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5861 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5862 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
5865 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) {
5866 LDKChannelManager this_arg_conv;
5867 this_arg_conv.inner = (void*)(this_arg & (~1));
5868 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5869 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
5871 LDKThirtyTwoBytes alias_ref;
5872 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
5873 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
5874 FREE((void*)addresses);
5875 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
5878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
5879 LDKChannelManager this_arg_conv;
5880 this_arg_conv.inner = (void*)(this_arg & (~1));
5881 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5882 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
5885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
5886 LDKChannelManager this_arg_conv;
5887 this_arg_conv.inner = (void*)(this_arg & (~1));
5888 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5889 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
5892 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) {
5893 LDKChannelManager this_arg_conv;
5894 this_arg_conv.inner = (void*)(this_arg & (~1));
5895 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5896 unsigned char payment_hash_arr[32];
5897 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
5898 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
5899 LDKThirtyTwoBytes payment_secret_ref;
5900 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5901 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
5904 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) {
5905 LDKChannelManager this_arg_conv;
5906 this_arg_conv.inner = (void*)(this_arg & (~1));
5907 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5908 LDKThirtyTwoBytes payment_preimage_ref;
5909 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
5910 LDKThirtyTwoBytes payment_secret_ref;
5911 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5912 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
5915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5916 LDKChannelManager this_arg_conv;
5917 this_arg_conv.inner = (void*)(this_arg & (~1));
5918 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5919 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5920 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
5924 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) {
5925 LDKChannelManager this_arg_conv;
5926 this_arg_conv.inner = (void*)(this_arg & (~1));
5927 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5928 LDKOutPoint funding_txo_conv;
5929 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5930 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5931 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
5934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5935 LDKChannelManager this_arg_conv;
5936 this_arg_conv.inner = (void*)(this_arg & (~1));
5937 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5938 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5939 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
5943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5944 LDKChannelManager this_arg_conv;
5945 this_arg_conv.inner = (void*)(this_arg & (~1));
5946 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5947 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5948 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
5952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5953 LDKChannelManager this_arg_conv;
5954 this_arg_conv.inner = (void*)(this_arg & (~1));
5955 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5956 unsigned char header_arr[80];
5957 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5958 unsigned char (*header_ref)[80] = &header_arr;
5959 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5960 FREE((void*)txdata);
5961 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
5965 LDKChannelManager this_arg_conv;
5966 this_arg_conv.inner = (void*)(this_arg & (~1));
5967 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5968 unsigned char header_arr[80];
5969 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5970 unsigned char (*header_ref)[80] = &header_arr;
5971 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
5974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
5975 LDKChannelManager this_arg_conv;
5976 this_arg_conv.inner = (void*)(this_arg & (~1));
5977 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5978 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5979 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
5983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5984 LDKChannelManagerReadArgs this_ptr_conv;
5985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5987 return ChannelManagerReadArgs_free(this_ptr_conv);
5990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
5991 LDKChannelManagerReadArgs this_ptr_conv;
5992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5994 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
5998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5999 LDKChannelManagerReadArgs this_ptr_conv;
6000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6002 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6003 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6004 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6005 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6007 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6011 LDKChannelManagerReadArgs this_ptr_conv;
6012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6014 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6019 LDKChannelManagerReadArgs this_ptr_conv;
6020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6022 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6023 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6024 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6025 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6027 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6031 LDKChannelManagerReadArgs this_ptr_conv;
6032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6034 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6039 LDKChannelManagerReadArgs this_ptr_conv;
6040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6042 LDKWatch val_conv = *(LDKWatch*)val;
6043 if (val_conv.free == LDKWatch_JCalls_free) {
6044 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6045 LDKWatch_JCalls_clone(val_conv.this_arg);
6047 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6051 LDKChannelManagerReadArgs this_ptr_conv;
6052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6054 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6059 LDKChannelManagerReadArgs this_ptr_conv;
6060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6062 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6063 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6065 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6067 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6071 LDKChannelManagerReadArgs this_ptr_conv;
6072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6074 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6079 LDKChannelManagerReadArgs this_ptr_conv;
6080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6082 LDKLogger val_conv = *(LDKLogger*)val;
6083 if (val_conv.free == LDKLogger_JCalls_free) {
6084 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6085 LDKLogger_JCalls_clone(val_conv.this_arg);
6087 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6091 LDKChannelManagerReadArgs this_ptr_conv;
6092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6094 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6095 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6099 LDKChannelManagerReadArgs this_ptr_conv;
6100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6102 LDKUserConfig val_conv;
6103 val_conv.inner = (void*)(val & (~1));
6104 val_conv.is_owned = (val & 1) || (val == 0);
6105 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6108 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) {
6109 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6110 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6111 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6112 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6114 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6115 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6116 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6117 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6119 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6120 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6121 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6122 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6124 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6125 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6126 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6127 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6129 LDKLogger logger_conv = *(LDKLogger*)logger;
6130 if (logger_conv.free == LDKLogger_JCalls_free) {
6131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6132 LDKLogger_JCalls_clone(logger_conv.this_arg);
6134 LDKUserConfig default_config_conv;
6135 default_config_conv.inner = (void*)(default_config & (~1));
6136 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6137 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6138 FREE((void*)channel_monitors);
6139 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6140 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6144 LDKDecodeError this_ptr_conv;
6145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6147 return DecodeError_free(this_ptr_conv);
6150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6151 LDKInit 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 return Init_free(this_ptr_conv);
6157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6158 LDKErrorMessage this_ptr_conv;
6159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6161 return ErrorMessage_free(this_ptr_conv);
6164 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6165 LDKErrorMessage this_ptr_conv;
6166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6168 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6169 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6174 LDKErrorMessage this_ptr_conv;
6175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6177 LDKThirtyTwoBytes val_ref;
6178 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6179 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6183 LDKErrorMessage 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 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6187 *ret = ErrorMessage_get_data(&this_ptr_conv);
6191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6192 LDKErrorMessage this_ptr_conv;
6193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6194 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6195 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6197 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6200 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6201 LDKThirtyTwoBytes channel_id_arg_ref;
6202 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6203 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6204 FREE((void*)data_arg);
6205 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6206 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6210 LDKPing this_ptr_conv;
6211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6213 return Ping_free(this_ptr_conv);
6216 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6217 LDKPing this_ptr_conv;
6218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6220 return Ping_get_ponglen(&this_ptr_conv);
6223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6224 LDKPing this_ptr_conv;
6225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6226 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6227 return Ping_set_ponglen(&this_ptr_conv, val);
6230 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6231 LDKPing this_ptr_conv;
6232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6234 return Ping_get_byteslen(&this_ptr_conv);
6237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6238 LDKPing this_ptr_conv;
6239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6241 return Ping_set_byteslen(&this_ptr_conv, val);
6244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6245 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6246 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6250 LDKPong this_ptr_conv;
6251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6253 return Pong_free(this_ptr_conv);
6256 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6257 LDKPong this_ptr_conv;
6258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6260 return Pong_get_byteslen(&this_ptr_conv);
6263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6264 LDKPong this_ptr_conv;
6265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6267 return Pong_set_byteslen(&this_ptr_conv, val);
6270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6271 LDKPong ret = Pong_new(byteslen_arg);
6272 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6276 LDKOpenChannel this_ptr_conv;
6277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6279 return OpenChannel_free(this_ptr_conv);
6282 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6283 LDKOpenChannel this_ptr_conv;
6284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6285 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6286 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6287 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6292 LDKOpenChannel this_ptr_conv;
6293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6295 LDKThirtyTwoBytes val_ref;
6296 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6297 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6300 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6301 LDKOpenChannel this_ptr_conv;
6302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6304 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6305 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6310 LDKOpenChannel this_ptr_conv;
6311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6313 LDKThirtyTwoBytes val_ref;
6314 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6315 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6319 LDKOpenChannel this_ptr_conv;
6320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6322 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6326 LDKOpenChannel this_ptr_conv;
6327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6329 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6333 LDKOpenChannel this_ptr_conv;
6334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6336 return OpenChannel_get_push_msat(&this_ptr_conv);
6339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6340 LDKOpenChannel this_ptr_conv;
6341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6343 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6347 LDKOpenChannel this_ptr_conv;
6348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6350 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6354 LDKOpenChannel this_ptr_conv;
6355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6357 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6361 LDKOpenChannel this_ptr_conv;
6362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6364 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6367 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) {
6368 LDKOpenChannel this_ptr_conv;
6369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6371 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6375 LDKOpenChannel this_ptr_conv;
6376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6378 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6382 LDKOpenChannel this_ptr_conv;
6383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6385 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6389 LDKOpenChannel this_ptr_conv;
6390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6392 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6396 LDKOpenChannel this_ptr_conv;
6397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6399 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6402 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6403 LDKOpenChannel this_ptr_conv;
6404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6406 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6410 LDKOpenChannel this_ptr_conv;
6411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6413 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6416 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6417 LDKOpenChannel this_ptr_conv;
6418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6420 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort 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 return OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6430 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6431 LDKOpenChannel this_ptr_conv;
6432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6434 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6438 LDKOpenChannel this_ptr_conv;
6439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6441 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6445 LDKOpenChannel this_ptr_conv;
6446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6448 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6449 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6454 LDKOpenChannel this_ptr_conv;
6455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6457 LDKPublicKey val_ref;
6458 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6459 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6462 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6463 LDKOpenChannel this_ptr_conv;
6464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6466 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6467 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
6476 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6477 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6481 LDKOpenChannel this_ptr_conv;
6482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6484 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6485 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6490 LDKOpenChannel this_ptr_conv;
6491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6493 LDKPublicKey val_ref;
6494 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6495 return OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6498 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6499 LDKOpenChannel this_ptr_conv;
6500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6502 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6503 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6508 LDKOpenChannel this_ptr_conv;
6509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6511 LDKPublicKey val_ref;
6512 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6513 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6516 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6517 LDKOpenChannel this_ptr_conv;
6518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6520 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6521 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6526 LDKOpenChannel this_ptr_conv;
6527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6529 LDKPublicKey val_ref;
6530 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6531 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6534 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6539 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6544 LDKOpenChannel this_ptr_conv;
6545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6547 LDKPublicKey val_ref;
6548 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6549 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6552 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6553 LDKOpenChannel this_ptr_conv;
6554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6556 return OpenChannel_get_channel_flags(&this_ptr_conv);
6559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6560 LDKOpenChannel this_ptr_conv;
6561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6563 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6567 LDKAcceptChannel this_ptr_conv;
6568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6570 return AcceptChannel_free(this_ptr_conv);
6573 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6574 LDKAcceptChannel this_ptr_conv;
6575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6577 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6578 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6583 LDKAcceptChannel this_ptr_conv;
6584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6586 LDKThirtyTwoBytes val_ref;
6587 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6588 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6592 LDKAcceptChannel this_ptr_conv;
6593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6595 return AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6599 LDKAcceptChannel this_ptr_conv;
6600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6602 return AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6606 LDKAcceptChannel this_ptr_conv;
6607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6609 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6612 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) {
6613 LDKAcceptChannel 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 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6620 LDKAcceptChannel this_ptr_conv;
6621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6623 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6627 LDKAcceptChannel this_ptr_conv;
6628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6630 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6634 LDKAcceptChannel this_ptr_conv;
6635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6637 return AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6641 LDKAcceptChannel this_ptr_conv;
6642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6644 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6647 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6648 LDKAcceptChannel this_ptr_conv;
6649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6651 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6655 LDKAcceptChannel this_ptr_conv;
6656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6658 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6661 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6662 LDKAcceptChannel this_ptr_conv;
6663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6665 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6669 LDKAcceptChannel this_ptr_conv;
6670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6672 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6675 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6676 LDKAcceptChannel 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 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6683 LDKAcceptChannel this_ptr_conv;
6684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6686 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6690 LDKAcceptChannel this_ptr_conv;
6691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
6703 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6704 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6707 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6708 LDKAcceptChannel this_ptr_conv;
6709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6711 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6712 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6717 LDKAcceptChannel this_ptr_conv;
6718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6720 LDKPublicKey val_ref;
6721 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6722 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6725 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6726 LDKAcceptChannel this_ptr_conv;
6727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6729 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6730 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
6734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6735 LDKAcceptChannel this_ptr_conv;
6736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6738 LDKPublicKey val_ref;
6739 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6740 return AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
6743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6744 LDKAcceptChannel this_ptr_conv;
6745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6747 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6748 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
6757 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6758 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6761 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6762 LDKAcceptChannel this_ptr_conv;
6763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6765 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6766 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6771 LDKAcceptChannel this_ptr_conv;
6772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6774 LDKPublicKey val_ref;
6775 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6776 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6779 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6780 LDKAcceptChannel this_ptr_conv;
6781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6783 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6784 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6789 LDKAcceptChannel this_ptr_conv;
6790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6792 LDKPublicKey val_ref;
6793 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6794 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6798 LDKFundingCreated this_ptr_conv;
6799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6801 return FundingCreated_free(this_ptr_conv);
6804 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6805 LDKFundingCreated this_ptr_conv;
6806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6808 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6809 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
6813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6814 LDKFundingCreated this_ptr_conv;
6815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6817 LDKThirtyTwoBytes val_ref;
6818 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6819 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
6822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6823 LDKFundingCreated 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6827 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
6831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6832 LDKFundingCreated this_ptr_conv;
6833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6835 LDKThirtyTwoBytes val_ref;
6836 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6837 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
6840 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6841 LDKFundingCreated this_ptr_conv;
6842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6844 return FundingCreated_get_funding_output_index(&this_ptr_conv);
6847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6848 LDKFundingCreated 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 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
6854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6855 LDKFundingCreated this_ptr_conv;
6856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6858 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6859 *ret = FundingCreated_get_signature(&this_ptr_conv);
6863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6864 LDKFundingCreated this_ptr_conv;
6865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6867 LDKSignature val_conv = *(LDKSignature*)val;
6869 return FundingCreated_set_signature(&this_ptr_conv, val_conv);
6872 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) {
6873 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
6874 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
6875 LDKThirtyTwoBytes funding_txid_arg_ref;
6876 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
6877 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6878 FREE((void*)signature_arg);
6879 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv);
6880 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6884 LDKFundingSigned 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 return FundingSigned_free(this_ptr_conv);
6890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6891 LDKFundingSigned this_ptr_conv;
6892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6894 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6895 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
6899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6900 LDKFundingSigned this_ptr_conv;
6901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6903 LDKThirtyTwoBytes val_ref;
6904 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6905 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
6908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6909 LDKFundingSigned this_ptr_conv;
6910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6912 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6913 *ret = FundingSigned_get_signature(&this_ptr_conv);
6917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6918 LDKFundingSigned this_ptr_conv;
6919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6921 LDKSignature val_conv = *(LDKSignature*)val;
6923 return FundingSigned_set_signature(&this_ptr_conv, val_conv);
6926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) {
6927 LDKThirtyTwoBytes channel_id_arg_ref;
6928 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6929 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6930 FREE((void*)signature_arg);
6931 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv);
6932 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6936 LDKFundingLocked this_ptr_conv;
6937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6939 return FundingLocked_free(this_ptr_conv);
6942 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6943 LDKFundingLocked this_ptr_conv;
6944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6946 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6947 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
6951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6952 LDKFundingLocked this_ptr_conv;
6953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6955 LDKThirtyTwoBytes val_ref;
6956 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6957 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
6960 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6961 LDKFundingLocked this_ptr_conv;
6962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6964 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6965 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
6969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6970 LDKFundingLocked this_ptr_conv;
6971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6973 LDKPublicKey val_ref;
6974 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6975 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
6978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
6979 LDKThirtyTwoBytes channel_id_arg_ref;
6980 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6981 LDKPublicKey next_per_commitment_point_arg_ref;
6982 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
6983 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
6984 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6988 LDKShutdown this_ptr_conv;
6989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6991 return Shutdown_free(this_ptr_conv);
6994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6995 LDKShutdown this_ptr_conv;
6996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6997 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6998 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6999 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7004 LDKShutdown this_ptr_conv;
7005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7007 LDKThirtyTwoBytes val_ref;
7008 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7009 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7013 LDKShutdown this_ptr_conv;
7014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7016 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
7017 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
7021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7022 LDKShutdown this_ptr_conv;
7023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7025 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7027 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7031 LDKThirtyTwoBytes channel_id_arg_ref;
7032 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7033 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7034 FREE((void*)scriptpubkey_arg);
7035 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7036 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7040 LDKClosingSigned this_ptr_conv;
7041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7043 return ClosingSigned_free(this_ptr_conv);
7046 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7047 LDKClosingSigned 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, *ClosingSigned_get_channel_id(&this_ptr_conv));
7055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7056 LDKClosingSigned 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 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7065 LDKClosingSigned 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 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7072 LDKClosingSigned this_ptr_conv;
7073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7075 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7079 LDKClosingSigned this_ptr_conv;
7080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7082 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7083 *ret = ClosingSigned_get_signature(&this_ptr_conv);
7087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7088 LDKClosingSigned this_ptr_conv;
7089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7091 LDKSignature val_conv = *(LDKSignature*)val;
7093 return ClosingSigned_set_signature(&this_ptr_conv, val_conv);
7096 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) {
7097 LDKThirtyTwoBytes channel_id_arg_ref;
7098 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7099 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7100 FREE((void*)signature_arg);
7101 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv);
7102 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7106 LDKUpdateAddHTLC this_ptr_conv;
7107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7109 return UpdateAddHTLC_free(this_ptr_conv);
7112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7113 LDKUpdateAddHTLC this_ptr_conv;
7114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7116 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7117 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7122 LDKUpdateAddHTLC this_ptr_conv;
7123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7125 LDKThirtyTwoBytes val_ref;
7126 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7127 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7131 LDKUpdateAddHTLC this_ptr_conv;
7132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7134 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7138 LDKUpdateAddHTLC this_ptr_conv;
7139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7141 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7145 LDKUpdateAddHTLC this_ptr_conv;
7146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7148 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7152 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7158 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7159 LDKUpdateAddHTLC this_ptr_conv;
7160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7162 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7163 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7168 LDKUpdateAddHTLC this_ptr_conv;
7169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7171 LDKThirtyTwoBytes val_ref;
7172 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7173 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7176 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7177 LDKUpdateAddHTLC this_ptr_conv;
7178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7180 return UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7184 LDKUpdateAddHTLC this_ptr_conv;
7185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7187 return UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7191 LDKUpdateFulfillHTLC this_ptr_conv;
7192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7194 return UpdateFulfillHTLC_free(this_ptr_conv);
7197 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7198 LDKUpdateFulfillHTLC this_ptr_conv;
7199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7201 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7202 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7207 LDKUpdateFulfillHTLC this_ptr_conv;
7208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7210 LDKThirtyTwoBytes val_ref;
7211 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7212 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7216 LDKUpdateFulfillHTLC this_ptr_conv;
7217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7219 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7223 LDKUpdateFulfillHTLC this_ptr_conv;
7224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7225 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7226 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7230 LDKUpdateFulfillHTLC this_ptr_conv;
7231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7232 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7233 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7234 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7239 LDKUpdateFulfillHTLC this_ptr_conv;
7240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7242 LDKThirtyTwoBytes val_ref;
7243 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7244 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7247 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) {
7248 LDKThirtyTwoBytes channel_id_arg_ref;
7249 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7250 LDKThirtyTwoBytes payment_preimage_arg_ref;
7251 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7252 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7253 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7257 LDKUpdateFailHTLC this_ptr_conv;
7258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7260 return UpdateFailHTLC_free(this_ptr_conv);
7263 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7264 LDKUpdateFailHTLC this_ptr_conv;
7265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7267 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7268 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7273 LDKUpdateFailHTLC this_ptr_conv;
7274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7276 LDKThirtyTwoBytes val_ref;
7277 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7278 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7282 LDKUpdateFailHTLC this_ptr_conv;
7283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7285 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7289 LDKUpdateFailHTLC this_ptr_conv;
7290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7292 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7296 LDKUpdateFailMalformedHTLC this_ptr_conv;
7297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7299 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7302 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7303 LDKUpdateFailMalformedHTLC this_ptr_conv;
7304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7306 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7307 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7312 LDKUpdateFailMalformedHTLC this_ptr_conv;
7313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7315 LDKThirtyTwoBytes val_ref;
7316 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7317 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7321 LDKUpdateFailMalformedHTLC this_ptr_conv;
7322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7324 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7328 LDKUpdateFailMalformedHTLC this_ptr_conv;
7329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7331 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7334 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7335 LDKUpdateFailMalformedHTLC this_ptr_conv;
7336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7338 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7342 LDKUpdateFailMalformedHTLC this_ptr_conv;
7343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7345 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7349 LDKCommitmentSigned this_ptr_conv;
7350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7352 return CommitmentSigned_free(this_ptr_conv);
7355 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7356 LDKCommitmentSigned 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7360 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7365 LDKCommitmentSigned 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 LDKThirtyTwoBytes val_ref;
7369 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7370 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7374 LDKCommitmentSigned this_ptr_conv;
7375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7377 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7378 *ret = CommitmentSigned_get_signature(&this_ptr_conv);
7382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7383 LDKCommitmentSigned this_ptr_conv;
7384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7386 LDKSignature val_conv = *(LDKSignature*)val;
7388 return CommitmentSigned_set_signature(&this_ptr_conv, val_conv);
7391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7392 LDKCommitmentSigned this_ptr_conv;
7393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7395 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7397 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7400 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) {
7401 LDKThirtyTwoBytes channel_id_arg_ref;
7402 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7403 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7404 FREE((void*)signature_arg);
7405 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7406 FREE((void*)htlc_signatures_arg);
7407 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv);
7408 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7412 LDKRevokeAndACK 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 RevokeAndACK_free(this_ptr_conv);
7418 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7419 LDKRevokeAndACK 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7423 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7428 LDKRevokeAndACK this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7431 LDKThirtyTwoBytes val_ref;
7432 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7433 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7436 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7437 LDKRevokeAndACK this_ptr_conv;
7438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7440 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7441 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7446 LDKRevokeAndACK this_ptr_conv;
7447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7449 LDKThirtyTwoBytes val_ref;
7450 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7451 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7454 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7455 LDKRevokeAndACK this_ptr_conv;
7456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7458 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7459 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7464 LDKRevokeAndACK this_ptr_conv;
7465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7467 LDKPublicKey val_ref;
7468 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7469 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7472 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) {
7473 LDKThirtyTwoBytes channel_id_arg_ref;
7474 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7475 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7476 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7477 LDKPublicKey next_per_commitment_point_arg_ref;
7478 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7479 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7484 LDKUpdateFee this_ptr_conv;
7485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7487 return UpdateFee_free(this_ptr_conv);
7490 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7491 LDKUpdateFee this_ptr_conv;
7492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7494 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7495 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7500 LDKUpdateFee 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 LDKThirtyTwoBytes val_ref;
7504 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7505 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7508 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7509 LDKUpdateFee this_ptr_conv;
7510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7512 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7516 LDKUpdateFee this_ptr_conv;
7517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7519 return UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7523 LDKThirtyTwoBytes channel_id_arg_ref;
7524 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7525 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7526 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7530 LDKDataLossProtect this_ptr_conv;
7531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7532 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7533 return DataLossProtect_free(this_ptr_conv);
7536 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7537 LDKDataLossProtect this_ptr_conv;
7538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7540 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7541 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7546 LDKDataLossProtect this_ptr_conv;
7547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7549 LDKThirtyTwoBytes val_ref;
7550 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7551 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7554 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7555 LDKDataLossProtect this_ptr_conv;
7556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7558 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7559 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
7563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7564 LDKDataLossProtect this_ptr_conv;
7565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7567 LDKPublicKey val_ref;
7568 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7569 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
7572 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) {
7573 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7574 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7575 LDKPublicKey my_current_per_commitment_point_arg_ref;
7576 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
7577 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
7578 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7582 LDKChannelReestablish this_ptr_conv;
7583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7585 return ChannelReestablish_free(this_ptr_conv);
7588 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7589 LDKChannelReestablish this_ptr_conv;
7590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7592 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7593 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7598 LDKChannelReestablish this_ptr_conv;
7599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7601 LDKThirtyTwoBytes val_ref;
7602 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7603 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7607 LDKChannelReestablish this_ptr_conv;
7608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7610 return ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7614 LDKChannelReestablish this_ptr_conv;
7615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7617 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7621 LDKChannelReestablish this_ptr_conv;
7622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7624 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7628 LDKChannelReestablish this_ptr_conv;
7629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7631 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
7634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7635 LDKAnnouncementSignatures this_ptr_conv;
7636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7638 return AnnouncementSignatures_free(this_ptr_conv);
7641 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7642 LDKAnnouncementSignatures this_ptr_conv;
7643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7644 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7645 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7646 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
7650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7651 LDKAnnouncementSignatures this_ptr_conv;
7652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7654 LDKThirtyTwoBytes val_ref;
7655 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7656 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
7659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7660 LDKAnnouncementSignatures this_ptr_conv;
7661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7663 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
7666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7667 LDKAnnouncementSignatures this_ptr_conv;
7668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7670 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
7673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7674 LDKAnnouncementSignatures 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7678 *ret = AnnouncementSignatures_get_node_signature(&this_ptr_conv);
7682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7683 LDKAnnouncementSignatures 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 LDKSignature val_conv = *(LDKSignature*)val;
7688 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_conv);
7691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7692 LDKAnnouncementSignatures 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7696 *ret = AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv);
7700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7701 LDKAnnouncementSignatures this_ptr_conv;
7702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7704 LDKSignature val_conv = *(LDKSignature*)val;
7706 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_conv);
7709 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) {
7710 LDKThirtyTwoBytes channel_id_arg_ref;
7711 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7712 LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
7713 FREE((void*)node_signature_arg);
7714 LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
7715 FREE((void*)bitcoin_signature_arg);
7716 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
7717 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7721 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
7722 FREE((void*)this_ptr);
7723 return NetAddress_free(this_ptr_conv);
7726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7727 LDKUnsignedNodeAnnouncement 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 return UnsignedNodeAnnouncement_free(this_ptr_conv);
7733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7734 LDKUnsignedNodeAnnouncement this_ptr_conv;
7735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7737 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
7738 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7742 LDKUnsignedNodeAnnouncement this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7745 LDKNodeFeatures val_conv;
7746 val_conv.inner = (void*)(val & (~1));
7747 val_conv.is_owned = (val & 1) || (val == 0);
7748 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
7751 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
7752 LDKUnsignedNodeAnnouncement 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 UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
7758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7759 LDKUnsignedNodeAnnouncement this_ptr_conv;
7760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7762 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
7765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7766 LDKUnsignedNodeAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7770 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
7774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7775 LDKUnsignedNodeAnnouncement this_ptr_conv;
7776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7778 LDKPublicKey val_ref;
7779 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7780 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
7783 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
7784 LDKUnsignedNodeAnnouncement this_ptr_conv;
7785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7787 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
7788 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
7792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7793 LDKUnsignedNodeAnnouncement this_ptr_conv;
7794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7796 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
7798 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
7801 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
7802 LDKUnsignedNodeAnnouncement this_ptr_conv;
7803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7805 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7806 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
7810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7811 LDKUnsignedNodeAnnouncement this_ptr_conv;
7812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7814 LDKThirtyTwoBytes val_ref;
7815 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7816 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
7819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7820 LDKUnsignedNodeAnnouncement this_ptr_conv;
7821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7823 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
7825 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
7828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7829 LDKNodeAnnouncement this_ptr_conv;
7830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7832 return NodeAnnouncement_free(this_ptr_conv);
7835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7836 LDKNodeAnnouncement this_ptr_conv;
7837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7839 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7840 *ret = NodeAnnouncement_get_signature(&this_ptr_conv);
7844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7845 LDKNodeAnnouncement this_ptr_conv;
7846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7848 LDKSignature val_conv = *(LDKSignature*)val;
7850 return NodeAnnouncement_set_signature(&this_ptr_conv, val_conv);
7853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
7854 LDKNodeAnnouncement this_ptr_conv;
7855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7857 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
7858 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7862 LDKNodeAnnouncement this_ptr_conv;
7863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7865 LDKUnsignedNodeAnnouncement val_conv;
7866 val_conv.inner = (void*)(val & (~1));
7867 val_conv.is_owned = (val & 1) || (val == 0);
7868 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
7871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
7872 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7873 FREE((void*)signature_arg);
7874 LDKUnsignedNodeAnnouncement contents_arg_conv;
7875 contents_arg_conv.inner = (void*)(contents_arg & (~1));
7876 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
7877 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
7878 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7882 LDKUnsignedChannelAnnouncement this_ptr_conv;
7883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7885 return UnsignedChannelAnnouncement_free(this_ptr_conv);
7888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7889 LDKUnsignedChannelAnnouncement this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7892 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
7893 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7897 LDKUnsignedChannelAnnouncement this_ptr_conv;
7898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7900 LDKChannelFeatures val_conv;
7901 val_conv.inner = (void*)(val & (~1));
7902 val_conv.is_owned = (val & 1) || (val == 0);
7903 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
7906 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7907 LDKUnsignedChannelAnnouncement this_ptr_conv;
7908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7910 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7911 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
7915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7916 LDKUnsignedChannelAnnouncement this_ptr_conv;
7917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7919 LDKThirtyTwoBytes val_ref;
7920 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7921 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
7924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7925 LDKUnsignedChannelAnnouncement this_ptr_conv;
7926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7928 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
7931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7932 LDKUnsignedChannelAnnouncement this_ptr_conv;
7933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7935 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
7938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7939 LDKUnsignedChannelAnnouncement this_ptr_conv;
7940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7942 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7943 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
7947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7948 LDKUnsignedChannelAnnouncement this_ptr_conv;
7949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7951 LDKPublicKey val_ref;
7952 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7953 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
7956 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7957 LDKUnsignedChannelAnnouncement this_ptr_conv;
7958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7960 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7961 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
7965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7966 LDKUnsignedChannelAnnouncement this_ptr_conv;
7967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7969 LDKPublicKey val_ref;
7970 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7971 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
7974 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7975 LDKUnsignedChannelAnnouncement this_ptr_conv;
7976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7978 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7979 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
7983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7984 LDKUnsignedChannelAnnouncement this_ptr_conv;
7985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7987 LDKPublicKey val_ref;
7988 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7989 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
7992 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7993 LDKUnsignedChannelAnnouncement this_ptr_conv;
7994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7996 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7997 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8002 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
8006 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8007 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8011 LDKChannelAnnouncement this_ptr_conv;
8012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8014 return ChannelAnnouncement_free(this_ptr_conv);
8017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8018 LDKChannelAnnouncement this_ptr_conv;
8019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8021 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8022 *ret = ChannelAnnouncement_get_node_signature_1(&this_ptr_conv);
8026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8027 LDKChannelAnnouncement 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 LDKSignature val_conv = *(LDKSignature*)val;
8032 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_conv);
8035 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8036 LDKChannelAnnouncement this_ptr_conv;
8037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8039 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8040 *ret = ChannelAnnouncement_get_node_signature_2(&this_ptr_conv);
8044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8045 LDKChannelAnnouncement this_ptr_conv;
8046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8048 LDKSignature val_conv = *(LDKSignature*)val;
8050 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_conv);
8053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8054 LDKChannelAnnouncement this_ptr_conv;
8055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8057 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8058 *ret = ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv);
8062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8063 LDKChannelAnnouncement this_ptr_conv;
8064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8066 LDKSignature val_conv = *(LDKSignature*)val;
8068 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_conv);
8071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8072 LDKChannelAnnouncement this_ptr_conv;
8073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8075 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8076 *ret = ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv);
8080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8081 LDKChannelAnnouncement this_ptr_conv;
8082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8084 LDKSignature val_conv = *(LDKSignature*)val;
8086 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_conv);
8089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8090 LDKChannelAnnouncement this_ptr_conv;
8091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8093 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8098 LDKChannelAnnouncement this_ptr_conv;
8099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8101 LDKUnsignedChannelAnnouncement val_conv;
8102 val_conv.inner = (void*)(val & (~1));
8103 val_conv.is_owned = (val & 1) || (val == 0);
8104 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8107 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) {
8108 LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
8109 FREE((void*)node_signature_1_arg);
8110 LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
8111 FREE((void*)node_signature_2_arg);
8112 LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
8113 FREE((void*)bitcoin_signature_1_arg);
8114 LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
8115 FREE((void*)bitcoin_signature_2_arg);
8116 LDKUnsignedChannelAnnouncement contents_arg_conv;
8117 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8118 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8119 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);
8120 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8124 LDKUnsignedChannelUpdate this_ptr_conv;
8125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8127 return UnsignedChannelUpdate_free(this_ptr_conv);
8130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8131 LDKUnsignedChannelUpdate this_ptr_conv;
8132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8134 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8135 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8140 LDKUnsignedChannelUpdate this_ptr_conv;
8141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8143 LDKThirtyTwoBytes val_ref;
8144 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8145 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8149 LDKUnsignedChannelUpdate this_ptr_conv;
8150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8151 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8152 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8156 LDKUnsignedChannelUpdate this_ptr_conv;
8157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8159 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8162 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8163 LDKUnsignedChannelUpdate this_ptr_conv;
8164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8166 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8170 LDKUnsignedChannelUpdate this_ptr_conv;
8171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8173 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8176 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8177 LDKUnsignedChannelUpdate 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 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8184 LDKUnsignedChannelUpdate this_ptr_conv;
8185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8187 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8190 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8191 LDKUnsignedChannelUpdate this_ptr_conv;
8192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8194 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8198 LDKUnsignedChannelUpdate this_ptr_conv;
8199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8201 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8205 LDKUnsignedChannelUpdate this_ptr_conv;
8206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8208 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8212 LDKUnsignedChannelUpdate this_ptr_conv;
8213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8215 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8218 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8219 LDKUnsignedChannelUpdate this_ptr_conv;
8220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8221 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8222 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8226 LDKUnsignedChannelUpdate this_ptr_conv;
8227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8229 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8232 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8233 LDKUnsignedChannelUpdate this_ptr_conv;
8234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8236 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8240 LDKUnsignedChannelUpdate this_ptr_conv;
8241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8243 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8247 LDKChannelUpdate this_ptr_conv;
8248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8250 return ChannelUpdate_free(this_ptr_conv);
8253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8254 LDKChannelUpdate 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8258 *ret = ChannelUpdate_get_signature(&this_ptr_conv);
8262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8263 LDKChannelUpdate 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 LDKSignature val_conv = *(LDKSignature*)val;
8268 return ChannelUpdate_set_signature(&this_ptr_conv, val_conv);
8271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8272 LDKChannelUpdate 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 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8276 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8280 LDKChannelUpdate this_ptr_conv;
8281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8283 LDKUnsignedChannelUpdate val_conv;
8284 val_conv.inner = (void*)(val & (~1));
8285 val_conv.is_owned = (val & 1) || (val == 0);
8286 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8290 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8291 FREE((void*)signature_arg);
8292 LDKUnsignedChannelUpdate contents_arg_conv;
8293 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8294 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8295 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
8296 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8300 LDKQueryChannelRange this_ptr_conv;
8301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8303 return QueryChannelRange_free(this_ptr_conv);
8306 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8307 LDKQueryChannelRange this_ptr_conv;
8308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8310 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8311 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8316 LDKQueryChannelRange this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8319 LDKThirtyTwoBytes val_ref;
8320 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8321 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8324 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8325 LDKQueryChannelRange this_ptr_conv;
8326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8328 return QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8332 LDKQueryChannelRange 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 return QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8338 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8339 LDKQueryChannelRange this_ptr_conv;
8340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8342 return QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8346 LDKQueryChannelRange this_ptr_conv;
8347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8349 return QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8352 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) {
8353 LDKThirtyTwoBytes chain_hash_arg_ref;
8354 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8355 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8356 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8360 LDKReplyChannelRange this_ptr_conv;
8361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8363 return ReplyChannelRange_free(this_ptr_conv);
8366 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8367 LDKReplyChannelRange this_ptr_conv;
8368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8370 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8371 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8376 LDKReplyChannelRange this_ptr_conv;
8377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8379 LDKThirtyTwoBytes val_ref;
8380 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8381 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8384 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8385 LDKReplyChannelRange this_ptr_conv;
8386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8388 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8392 LDKReplyChannelRange this_ptr_conv;
8393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8395 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8398 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8399 LDKReplyChannelRange this_ptr_conv;
8400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8402 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8406 LDKReplyChannelRange this_ptr_conv;
8407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8409 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8413 LDKReplyChannelRange this_ptr_conv;
8414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8416 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8420 LDKReplyChannelRange this_ptr_conv;
8421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8423 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8427 LDKReplyChannelRange this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8430 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8432 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8435 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) {
8436 LDKThirtyTwoBytes chain_hash_arg_ref;
8437 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8438 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8439 FREE((void*)short_channel_ids_arg);
8440 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8441 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8445 LDKQueryShortChannelIds this_ptr_conv;
8446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8448 return QueryShortChannelIds_free(this_ptr_conv);
8451 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8452 LDKQueryShortChannelIds this_ptr_conv;
8453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8455 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8456 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8461 LDKQueryShortChannelIds this_ptr_conv;
8462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8464 LDKThirtyTwoBytes val_ref;
8465 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8466 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8470 LDKQueryShortChannelIds this_ptr_conv;
8471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8473 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8475 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8479 LDKThirtyTwoBytes chain_hash_arg_ref;
8480 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8481 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8482 FREE((void*)short_channel_ids_arg);
8483 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8484 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8488 LDKReplyShortChannelIdsEnd this_ptr_conv;
8489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8491 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8494 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8495 LDKReplyShortChannelIdsEnd this_ptr_conv;
8496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8498 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8499 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
8503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8504 LDKReplyShortChannelIdsEnd this_ptr_conv;
8505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8507 LDKThirtyTwoBytes val_ref;
8508 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8509 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
8512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8513 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8520 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
8526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
8527 LDKThirtyTwoBytes chain_hash_arg_ref;
8528 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8529 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
8530 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8534 LDKGossipTimestampFilter 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 GossipTimestampFilter_free(this_ptr_conv);
8540 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8541 LDKGossipTimestampFilter 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8545 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
8549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8550 LDKGossipTimestampFilter this_ptr_conv;
8551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8553 LDKThirtyTwoBytes val_ref;
8554 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8555 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
8558 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8559 LDKGossipTimestampFilter this_ptr_conv;
8560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8562 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
8565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8566 LDKGossipTimestampFilter this_ptr_conv;
8567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8569 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
8572 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
8573 LDKGossipTimestampFilter this_ptr_conv;
8574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8576 return GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
8579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8580 LDKGossipTimestampFilter this_ptr_conv;
8581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8583 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
8586 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) {
8587 LDKThirtyTwoBytes chain_hash_arg_ref;
8588 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8589 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
8590 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8594 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
8595 FREE((void*)this_ptr);
8596 return ErrorAction_free(this_ptr_conv);
8599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8600 LDKLightningError this_ptr_conv;
8601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8603 return LightningError_free(this_ptr_conv);
8606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
8607 LDKLightningError this_ptr_conv;
8608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8610 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
8611 *ret = LightningError_get_err(&this_ptr_conv);
8615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8616 LDKLightningError this_ptr_conv;
8617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8619 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
8621 return LightningError_set_err(&this_ptr_conv, val_conv);
8624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
8625 LDKLightningError this_ptr_conv;
8626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8628 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
8629 *ret = LightningError_get_action(&this_ptr_conv);
8633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8634 LDKLightningError this_ptr_conv;
8635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8637 LDKErrorAction val_conv = *(LDKErrorAction*)val;
8639 return LightningError_set_action(&this_ptr_conv, val_conv);
8642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
8643 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
8644 FREE((void*)err_arg);
8645 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
8646 FREE((void*)action_arg);
8647 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
8648 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8652 LDKCommitmentUpdate this_ptr_conv;
8653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8655 return CommitmentUpdate_free(this_ptr_conv);
8658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8659 LDKCommitmentUpdate this_ptr_conv;
8660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8662 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
8664 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
8667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8668 LDKCommitmentUpdate this_ptr_conv;
8669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8671 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
8673 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
8676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8677 LDKCommitmentUpdate this_ptr_conv;
8678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8680 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
8682 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
8685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8686 LDKCommitmentUpdate this_ptr_conv;
8687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8689 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
8691 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
8694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
8695 LDKCommitmentUpdate this_ptr_conv;
8696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8698 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
8699 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8703 LDKCommitmentUpdate 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 LDKUpdateFee val_conv;
8707 val_conv.inner = (void*)(val & (~1));
8708 val_conv.is_owned = (val & 1) || (val == 0);
8709 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
8712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
8713 LDKCommitmentUpdate this_ptr_conv;
8714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8716 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
8717 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8721 LDKCommitmentUpdate 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 LDKCommitmentSigned val_conv;
8725 val_conv.inner = (void*)(val & (~1));
8726 val_conv.is_owned = (val & 1) || (val == 0);
8727 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
8730 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) {
8731 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
8732 FREE((void*)update_add_htlcs_arg);
8733 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
8734 FREE((void*)update_fulfill_htlcs_arg);
8735 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
8736 FREE((void*)update_fail_htlcs_arg);
8737 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
8738 FREE((void*)update_fail_malformed_htlcs_arg);
8739 LDKUpdateFee update_fee_arg_conv;
8740 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
8741 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
8742 LDKCommitmentSigned commitment_signed_arg_conv;
8743 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
8744 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
8745 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);
8746 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8750 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
8751 FREE((void*)this_ptr);
8752 return HTLCFailChannelUpdate_free(this_ptr_conv);
8755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8756 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
8757 FREE((void*)this_ptr);
8758 return ChannelMessageHandler_free(this_ptr_conv);
8761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8762 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
8763 FREE((void*)this_ptr);
8764 return RoutingMessageHandler_free(this_ptr_conv);
8767 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8768 LDKAcceptChannel obj_conv;
8769 obj_conv.inner = (void*)(obj & (~1));
8770 obj_conv.is_owned = (obj & 1) || (obj == 0);
8771 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8772 *ret = AcceptChannel_write(&obj_conv);
8776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8777 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8778 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
8779 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
8783 LDKAnnouncementSignatures obj_conv;
8784 obj_conv.inner = (void*)(obj & (~1));
8785 obj_conv.is_owned = (obj & 1) || (obj == 0);
8786 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8787 *ret = AnnouncementSignatures_write(&obj_conv);
8791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
8792 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8793 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
8794 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
8798 LDKChannelReestablish obj_conv;
8799 obj_conv.inner = (void*)(obj & (~1));
8800 obj_conv.is_owned = (obj & 1) || (obj == 0);
8801 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8802 *ret = ChannelReestablish_write(&obj_conv);
8806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
8807 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8808 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
8809 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8813 LDKClosingSigned obj_conv;
8814 obj_conv.inner = (void*)(obj & (~1));
8815 obj_conv.is_owned = (obj & 1) || (obj == 0);
8816 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8817 *ret = ClosingSigned_write(&obj_conv);
8821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8822 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8823 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
8824 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8828 LDKCommitmentSigned obj_conv;
8829 obj_conv.inner = (void*)(obj & (~1));
8830 obj_conv.is_owned = (obj & 1) || (obj == 0);
8831 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8832 *ret = CommitmentSigned_write(&obj_conv);
8836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8837 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8838 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
8839 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
8843 LDKFundingCreated obj_conv;
8844 obj_conv.inner = (void*)(obj & (~1));
8845 obj_conv.is_owned = (obj & 1) || (obj == 0);
8846 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8847 *ret = FundingCreated_write(&obj_conv);
8851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
8852 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8853 LDKFundingCreated ret = FundingCreated_read(ser_conv);
8854 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8858 LDKFundingSigned obj_conv;
8859 obj_conv.inner = (void*)(obj & (~1));
8860 obj_conv.is_owned = (obj & 1) || (obj == 0);
8861 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8862 *ret = FundingSigned_write(&obj_conv);
8866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8867 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8868 LDKFundingSigned ret = FundingSigned_read(ser_conv);
8869 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
8873 LDKFundingLocked obj_conv;
8874 obj_conv.inner = (void*)(obj & (~1));
8875 obj_conv.is_owned = (obj & 1) || (obj == 0);
8876 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8877 *ret = FundingLocked_write(&obj_conv);
8881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
8882 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8883 LDKFundingLocked ret = FundingLocked_read(ser_conv);
8884 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
8889 obj_conv.inner = (void*)(obj & (~1));
8890 obj_conv.is_owned = (obj & 1) || (obj == 0);
8891 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8892 *ret = Init_write(&obj_conv);
8896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
8897 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8898 LDKInit ret = Init_read(ser_conv);
8899 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8903 LDKOpenChannel obj_conv;
8904 obj_conv.inner = (void*)(obj & (~1));
8905 obj_conv.is_owned = (obj & 1) || (obj == 0);
8906 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8907 *ret = OpenChannel_write(&obj_conv);
8911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8912 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8913 LDKOpenChannel ret = OpenChannel_read(ser_conv);
8914 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
8918 LDKRevokeAndACK obj_conv;
8919 obj_conv.inner = (void*)(obj & (~1));
8920 obj_conv.is_owned = (obj & 1) || (obj == 0);
8921 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8922 *ret = RevokeAndACK_write(&obj_conv);
8926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
8927 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8928 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
8929 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
8933 LDKShutdown obj_conv;
8934 obj_conv.inner = (void*)(obj & (~1));
8935 obj_conv.is_owned = (obj & 1) || (obj == 0);
8936 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8937 *ret = Shutdown_write(&obj_conv);
8941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
8942 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8943 LDKShutdown ret = Shutdown_read(ser_conv);
8944 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8948 LDKUpdateFailHTLC obj_conv;
8949 obj_conv.inner = (void*)(obj & (~1));
8950 obj_conv.is_owned = (obj & 1) || (obj == 0);
8951 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8952 *ret = UpdateFailHTLC_write(&obj_conv);
8956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8957 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8958 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
8959 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8963 LDKUpdateFailMalformedHTLC obj_conv;
8964 obj_conv.inner = (void*)(obj & (~1));
8965 obj_conv.is_owned = (obj & 1) || (obj == 0);
8966 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8967 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
8971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8972 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8973 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
8974 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
8978 LDKUpdateFee obj_conv;
8979 obj_conv.inner = (void*)(obj & (~1));
8980 obj_conv.is_owned = (obj & 1) || (obj == 0);
8981 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8982 *ret = UpdateFee_write(&obj_conv);
8986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
8987 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8988 LDKUpdateFee ret = UpdateFee_read(ser_conv);
8989 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8992 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8993 LDKUpdateFulfillHTLC obj_conv;
8994 obj_conv.inner = (void*)(obj & (~1));
8995 obj_conv.is_owned = (obj & 1) || (obj == 0);
8996 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8997 *ret = UpdateFulfillHTLC_write(&obj_conv);
9001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9002 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9003 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
9004 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9008 LDKUpdateAddHTLC obj_conv;
9009 obj_conv.inner = (void*)(obj & (~1));
9010 obj_conv.is_owned = (obj & 1) || (obj == 0);
9011 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9012 *ret = UpdateAddHTLC_write(&obj_conv);
9016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9017 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9018 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
9019 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9024 obj_conv.inner = (void*)(obj & (~1));
9025 obj_conv.is_owned = (obj & 1) || (obj == 0);
9026 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9027 *ret = Ping_write(&obj_conv);
9031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
9032 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9033 LDKPing ret = Ping_read(ser_conv);
9034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9039 obj_conv.inner = (void*)(obj & (~1));
9040 obj_conv.is_owned = (obj & 1) || (obj == 0);
9041 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9042 *ret = Pong_write(&obj_conv);
9046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
9047 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9048 LDKPong ret = Pong_read(ser_conv);
9049 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9053 LDKUnsignedChannelAnnouncement obj_conv;
9054 obj_conv.inner = (void*)(obj & (~1));
9055 obj_conv.is_owned = (obj & 1) || (obj == 0);
9056 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9057 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9062 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9063 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
9064 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9068 LDKChannelAnnouncement obj_conv;
9069 obj_conv.inner = (void*)(obj & (~1));
9070 obj_conv.is_owned = (obj & 1) || (obj == 0);
9071 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9072 *ret = ChannelAnnouncement_write(&obj_conv);
9076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9077 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9078 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
9079 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9083 LDKUnsignedChannelUpdate obj_conv;
9084 obj_conv.inner = (void*)(obj & (~1));
9085 obj_conv.is_owned = (obj & 1) || (obj == 0);
9086 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9087 *ret = UnsignedChannelUpdate_write(&obj_conv);
9091 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9092 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9093 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
9094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9097 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9098 LDKChannelUpdate obj_conv;
9099 obj_conv.inner = (void*)(obj & (~1));
9100 obj_conv.is_owned = (obj & 1) || (obj == 0);
9101 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9102 *ret = ChannelUpdate_write(&obj_conv);
9106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9107 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9108 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
9109 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9113 LDKErrorMessage obj_conv;
9114 obj_conv.inner = (void*)(obj & (~1));
9115 obj_conv.is_owned = (obj & 1) || (obj == 0);
9116 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9117 *ret = ErrorMessage_write(&obj_conv);
9121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
9122 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9123 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
9124 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9128 LDKUnsignedNodeAnnouncement obj_conv;
9129 obj_conv.inner = (void*)(obj & (~1));
9130 obj_conv.is_owned = (obj & 1) || (obj == 0);
9131 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9132 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9137 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9138 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
9139 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9143 LDKNodeAnnouncement obj_conv;
9144 obj_conv.inner = (void*)(obj & (~1));
9145 obj_conv.is_owned = (obj & 1) || (obj == 0);
9146 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9147 *ret = NodeAnnouncement_write(&obj_conv);
9151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9152 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9153 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9154 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9158 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9159 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9160 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9164 LDKQueryShortChannelIds obj_conv;
9165 obj_conv.inner = (void*)(obj & (~1));
9166 obj_conv.is_owned = (obj & 1) || (obj == 0);
9167 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9168 *ret = QueryShortChannelIds_write(&obj_conv);
9172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9173 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9174 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9175 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9179 LDKReplyShortChannelIdsEnd obj_conv;
9180 obj_conv.inner = (void*)(obj & (~1));
9181 obj_conv.is_owned = (obj & 1) || (obj == 0);
9182 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9183 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9188 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9189 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9190 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9194 LDKQueryChannelRange obj_conv;
9195 obj_conv.inner = (void*)(obj & (~1));
9196 obj_conv.is_owned = (obj & 1) || (obj == 0);
9197 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9198 *ret = QueryChannelRange_write(&obj_conv);
9202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9203 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9204 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9205 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9209 LDKReplyChannelRange obj_conv;
9210 obj_conv.inner = (void*)(obj & (~1));
9211 obj_conv.is_owned = (obj & 1) || (obj == 0);
9212 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9213 *ret = ReplyChannelRange_write(&obj_conv);
9217 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9218 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9219 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9220 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9224 LDKGossipTimestampFilter obj_conv;
9225 obj_conv.inner = (void*)(obj & (~1));
9226 obj_conv.is_owned = (obj & 1) || (obj == 0);
9227 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9228 *ret = GossipTimestampFilter_write(&obj_conv);
9232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9233 LDKMessageHandler this_ptr_conv;
9234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9236 return MessageHandler_free(this_ptr_conv);
9239 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9240 LDKMessageHandler this_ptr_conv;
9241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9243 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9248 LDKMessageHandler this_ptr_conv;
9249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9250 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9251 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9252 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9253 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9254 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9256 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9260 LDKMessageHandler this_ptr_conv;
9261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9263 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9268 LDKMessageHandler this_ptr_conv;
9269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9271 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9272 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9273 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9274 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9276 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9280 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9281 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9283 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9285 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9286 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9287 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9288 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9290 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9291 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9295 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9296 FREE((void*)this_ptr);
9297 return SocketDescriptor_free(this_ptr_conv);
9300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9301 LDKPeerHandleError this_ptr_conv;
9302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9304 return PeerHandleError_free(this_ptr_conv);
9307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9308 LDKPeerHandleError this_ptr_conv;
9309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9311 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9315 LDKPeerHandleError this_ptr_conv;
9316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9318 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9322 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9323 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9327 LDKPeerManager this_ptr_conv;
9328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9330 return PeerManager_free(this_ptr_conv);
9333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
9334 LDKMessageHandler message_handler_conv;
9335 message_handler_conv.inner = (void*)(message_handler & (~1));
9336 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9337 LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
9338 FREE((void*)our_node_secret);
9339 unsigned char ephemeral_random_data_arr[32];
9340 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9341 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9342 LDKLogger logger_conv = *(LDKLogger*)logger;
9343 if (logger_conv.free == LDKLogger_JCalls_free) {
9344 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9345 LDKLogger_JCalls_clone(logger_conv.this_arg);
9347 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
9348 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9352 LDKPeerManager this_arg_conv;
9353 this_arg_conv.inner = (void*)(this_arg & (~1));
9354 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9355 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9356 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9360 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) {
9361 LDKPeerManager this_arg_conv;
9362 this_arg_conv.inner = (void*)(this_arg & (~1));
9363 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9364 LDKPublicKey their_node_id_ref;
9365 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9366 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9367 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9368 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9369 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9371 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9372 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
9376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9377 LDKPeerManager this_arg_conv;
9378 this_arg_conv.inner = (void*)(this_arg & (~1));
9379 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9380 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9381 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9382 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9383 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9385 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9386 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9391 LDKPeerManager this_arg_conv;
9392 this_arg_conv.inner = (void*)(this_arg & (~1));
9393 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9394 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9395 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9396 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9401 LDKPeerManager this_arg_conv;
9402 this_arg_conv.inner = (void*)(this_arg & (~1));
9403 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9404 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9405 LDKu8slice data_conv = *(LDKu8slice*)data;
9406 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9407 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9412 LDKPeerManager this_arg_conv;
9413 this_arg_conv.inner = (void*)(this_arg & (~1));
9414 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9415 return PeerManager_process_events(&this_arg_conv);
9418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9419 LDKPeerManager this_arg_conv;
9420 this_arg_conv.inner = (void*)(this_arg & (~1));
9421 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9422 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9423 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9427 LDKPeerManager this_arg_conv;
9428 this_arg_conv.inner = (void*)(this_arg & (~1));
9429 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9430 return PeerManager_timer_tick_occured(&this_arg_conv);
9433 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9434 unsigned char commitment_seed_arr[32];
9435 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9436 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9437 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9438 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
9443 LDKPublicKey per_commitment_point_ref;
9444 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9445 unsigned char base_secret_arr[32];
9446 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9447 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9448 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9449 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
9453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
9454 LDKPublicKey per_commitment_point_ref;
9455 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9456 LDKPublicKey base_point_ref;
9457 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
9458 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9459 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
9463 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) {
9464 unsigned char per_commitment_secret_arr[32];
9465 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
9466 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
9467 unsigned char countersignatory_revocation_base_secret_arr[32];
9468 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
9469 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
9470 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9471 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
9475 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) {
9476 LDKPublicKey per_commitment_point_ref;
9477 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9478 LDKPublicKey countersignatory_revocation_base_point_ref;
9479 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
9480 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9481 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
9485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9486 LDKTxCreationKeys this_ptr_conv;
9487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9489 return TxCreationKeys_free(this_ptr_conv);
9492 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9493 LDKTxCreationKeys this_ptr_conv;
9494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9496 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9497 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
9501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9502 LDKTxCreationKeys this_ptr_conv;
9503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9505 LDKPublicKey val_ref;
9506 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9507 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
9510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9511 LDKTxCreationKeys this_ptr_conv;
9512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
9519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9520 LDKTxCreationKeys this_ptr_conv;
9521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9523 LDKPublicKey val_ref;
9524 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9525 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
9528 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9529 LDKTxCreationKeys this_ptr_conv;
9530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9532 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9533 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
9537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9538 LDKTxCreationKeys this_ptr_conv;
9539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9541 LDKPublicKey val_ref;
9542 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9543 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
9546 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9547 LDKTxCreationKeys this_ptr_conv;
9548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9550 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
9555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9556 LDKTxCreationKeys this_ptr_conv;
9557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9559 LDKPublicKey val_ref;
9560 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9561 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
9564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9565 LDKTxCreationKeys this_ptr_conv;
9566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9568 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9569 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
9573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9574 LDKTxCreationKeys this_ptr_conv;
9575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9577 LDKPublicKey val_ref;
9578 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9579 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
9582 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) {
9583 LDKPublicKey per_commitment_point_arg_ref;
9584 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
9585 LDKPublicKey revocation_key_arg_ref;
9586 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
9587 LDKPublicKey broadcaster_htlc_key_arg_ref;
9588 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
9589 LDKPublicKey countersignatory_htlc_key_arg_ref;
9590 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
9591 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
9592 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
9593 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);
9594 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9598 LDKTxCreationKeys obj_conv;
9599 obj_conv.inner = (void*)(obj & (~1));
9600 obj_conv.is_owned = (obj & 1) || (obj == 0);
9601 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9602 *ret = TxCreationKeys_write(&obj_conv);
9606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9607 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9608 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
9609 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9613 LDKPreCalculatedTxCreationKeys this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
9619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
9620 LDKTxCreationKeys keys_conv;
9621 keys_conv.inner = (void*)(keys & (~1));
9622 keys_conv.is_owned = (keys & 1) || (keys == 0);
9623 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
9624 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
9628 LDKPreCalculatedTxCreationKeys this_arg_conv;
9629 this_arg_conv.inner = (void*)(this_arg & (~1));
9630 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9631 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
9632 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
9636 LDKPreCalculatedTxCreationKeys this_arg_conv;
9637 this_arg_conv.inner = (void*)(this_arg & (~1));
9638 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9639 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9640 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
9644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9645 LDKChannelPublicKeys this_ptr_conv;
9646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9648 return ChannelPublicKeys_free(this_ptr_conv);
9651 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
9652 LDKChannelPublicKeys this_ptr_conv;
9653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9655 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9656 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
9660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9661 LDKChannelPublicKeys this_ptr_conv;
9662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9664 LDKPublicKey val_ref;
9665 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9666 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
9669 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9670 LDKChannelPublicKeys this_ptr_conv;
9671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9672 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9673 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9674 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
9678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9679 LDKChannelPublicKeys this_ptr_conv;
9680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9682 LDKPublicKey val_ref;
9683 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9684 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
9687 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9688 LDKChannelPublicKeys this_ptr_conv;
9689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9691 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9692 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
9696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9697 LDKChannelPublicKeys this_ptr_conv;
9698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9700 LDKPublicKey val_ref;
9701 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9702 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
9705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9706 LDKChannelPublicKeys this_ptr_conv;
9707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9709 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9710 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
9714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9715 LDKChannelPublicKeys this_ptr_conv;
9716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9718 LDKPublicKey val_ref;
9719 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9720 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
9723 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9724 LDKChannelPublicKeys this_ptr_conv;
9725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9727 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9728 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
9732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9733 LDKChannelPublicKeys this_ptr_conv;
9734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9736 LDKPublicKey val_ref;
9737 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9738 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
9741 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) {
9742 LDKPublicKey funding_pubkey_arg_ref;
9743 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
9744 LDKPublicKey revocation_basepoint_arg_ref;
9745 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
9746 LDKPublicKey payment_point_arg_ref;
9747 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
9748 LDKPublicKey delayed_payment_basepoint_arg_ref;
9749 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
9750 LDKPublicKey htlc_basepoint_arg_ref;
9751 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
9752 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);
9753 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9757 LDKChannelPublicKeys obj_conv;
9758 obj_conv.inner = (void*)(obj & (~1));
9759 obj_conv.is_owned = (obj & 1) || (obj == 0);
9760 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9761 *ret = ChannelPublicKeys_write(&obj_conv);
9765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9766 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9767 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
9768 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9771 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) {
9772 LDKPublicKey per_commitment_point_ref;
9773 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9774 LDKPublicKey broadcaster_delayed_payment_base_ref;
9775 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
9776 LDKPublicKey broadcaster_htlc_base_ref;
9777 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
9778 LDKPublicKey countersignatory_revocation_base_ref;
9779 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
9780 LDKPublicKey countersignatory_htlc_base_ref;
9781 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
9782 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
9783 *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);
9787 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) {
9788 LDKPublicKey revocation_key_ref;
9789 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
9790 LDKPublicKey broadcaster_delayed_payment_key_ref;
9791 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
9792 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9793 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
9797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9798 LDKHTLCOutputInCommitment this_ptr_conv;
9799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9801 return HTLCOutputInCommitment_free(this_ptr_conv);
9804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
9805 LDKHTLCOutputInCommitment this_ptr_conv;
9806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9808 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
9811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9812 LDKHTLCOutputInCommitment this_ptr_conv;
9813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9815 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
9818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9819 LDKHTLCOutputInCommitment this_ptr_conv;
9820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9822 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
9825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9826 LDKHTLCOutputInCommitment this_ptr_conv;
9827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9829 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
9832 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9833 LDKHTLCOutputInCommitment this_ptr_conv;
9834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9836 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
9839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9840 LDKHTLCOutputInCommitment this_ptr_conv;
9841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9843 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
9846 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9847 LDKHTLCOutputInCommitment this_ptr_conv;
9848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9850 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9851 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
9855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9856 LDKHTLCOutputInCommitment this_ptr_conv;
9857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9859 LDKThirtyTwoBytes val_ref;
9860 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9861 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
9864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
9865 LDKHTLCOutputInCommitment obj_conv;
9866 obj_conv.inner = (void*)(obj & (~1));
9867 obj_conv.is_owned = (obj & 1) || (obj == 0);
9868 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9869 *ret = HTLCOutputInCommitment_write(&obj_conv);
9873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
9874 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9875 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
9876 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
9880 LDKHTLCOutputInCommitment htlc_conv;
9881 htlc_conv.inner = (void*)(htlc & (~1));
9882 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9883 LDKTxCreationKeys keys_conv;
9884 keys_conv.inner = (void*)(keys & (~1));
9885 keys_conv.is_owned = (keys & 1) || (keys == 0);
9886 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9887 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
9891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
9892 LDKPublicKey broadcaster_ref;
9893 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
9894 LDKPublicKey countersignatory_ref;
9895 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
9896 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9897 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
9901 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) {
9902 unsigned char prev_hash_arr[32];
9903 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
9904 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
9905 LDKHTLCOutputInCommitment htlc_conv;
9906 htlc_conv.inner = (void*)(htlc & (~1));
9907 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9908 LDKPublicKey broadcaster_delayed_payment_key_ref;
9909 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
9910 LDKPublicKey revocation_key_ref;
9911 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
9912 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9913 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
9917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9918 LDKHolderCommitmentTransaction this_ptr_conv;
9919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9921 return HolderCommitmentTransaction_free(this_ptr_conv);
9924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
9925 LDKHolderCommitmentTransaction this_ptr_conv;
9926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9928 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9929 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
9933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9934 LDKHolderCommitmentTransaction this_ptr_conv;
9935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9937 LDKTransaction val_conv = *(LDKTransaction*)val;
9939 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
9942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
9943 LDKHolderCommitmentTransaction this_ptr_conv;
9944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9946 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
9947 *ret = HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv);
9951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9952 LDKHolderCommitmentTransaction this_ptr_conv;
9953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9955 LDKSignature val_conv = *(LDKSignature*)val;
9957 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_conv);
9960 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9961 LDKHolderCommitmentTransaction this_ptr_conv;
9962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9964 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
9967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9968 LDKHolderCommitmentTransaction this_ptr_conv;
9969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9971 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
9974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9975 LDKHolderCommitmentTransaction this_ptr_conv;
9976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9978 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
9980 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
9983 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) {
9984 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
9985 FREE((void*)unsigned_tx);
9986 LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
9987 FREE((void*)counterparty_sig);
9988 LDKPublicKey holder_funding_key_ref;
9989 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
9990 LDKPublicKey counterparty_funding_key_ref;
9991 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
9992 LDKTxCreationKeys keys_conv;
9993 keys_conv.inner = (void*)(keys & (~1));
9994 keys_conv.is_owned = (keys & 1) || (keys == 0);
9995 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
9996 FREE((void*)htlc_data);
9997 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);
9998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10002 LDKHolderCommitmentTransaction this_arg_conv;
10003 this_arg_conv.inner = (void*)(this_arg & (~1));
10004 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10005 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10006 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10009 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10010 LDKHolderCommitmentTransaction this_arg_conv;
10011 this_arg_conv.inner = (void*)(this_arg & (~1));
10012 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10013 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10014 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10018 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) {
10019 LDKHolderCommitmentTransaction this_arg_conv;
10020 this_arg_conv.inner = (void*)(this_arg & (~1));
10021 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10022 unsigned char funding_key_arr[32];
10023 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10024 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10025 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
10026 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
10027 *ret = HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
10031 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) {
10032 LDKHolderCommitmentTransaction this_arg_conv;
10033 this_arg_conv.inner = (void*)(this_arg & (~1));
10034 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10035 unsigned char htlc_base_key_arr[32];
10036 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10037 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10038 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10039 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10044 LDKHolderCommitmentTransaction obj_conv;
10045 obj_conv.inner = (void*)(obj & (~1));
10046 obj_conv.is_owned = (obj & 1) || (obj == 0);
10047 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10048 *ret = HolderCommitmentTransaction_write(&obj_conv);
10052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
10053 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10054 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
10055 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10059 LDKInitFeatures this_ptr_conv;
10060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10062 return InitFeatures_free(this_ptr_conv);
10065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10066 LDKNodeFeatures this_ptr_conv;
10067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10069 return NodeFeatures_free(this_ptr_conv);
10072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10073 LDKChannelFeatures 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 return ChannelFeatures_free(this_ptr_conv);
10079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10080 LDKRouteHop this_ptr_conv;
10081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10083 return RouteHop_free(this_ptr_conv);
10086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10087 LDKRouteHop this_ptr_conv;
10088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10090 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10091 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
10095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10096 LDKRouteHop this_ptr_conv;
10097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10099 LDKPublicKey val_ref;
10100 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10101 return RouteHop_set_pubkey(&this_ptr_conv, val_ref);
10104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10105 LDKRouteHop this_ptr_conv;
10106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10108 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
10109 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10113 LDKRouteHop this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10116 LDKNodeFeatures val_conv;
10117 val_conv.inner = (void*)(val & (~1));
10118 val_conv.is_owned = (val & 1) || (val == 0);
10119 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
10122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10123 LDKRouteHop this_ptr_conv;
10124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10126 return RouteHop_get_short_channel_id(&this_ptr_conv);
10129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10130 LDKRouteHop this_ptr_conv;
10131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10133 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
10136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10137 LDKRouteHop this_ptr_conv;
10138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10140 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
10141 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10145 LDKRouteHop this_ptr_conv;
10146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10148 LDKChannelFeatures val_conv;
10149 val_conv.inner = (void*)(val & (~1));
10150 val_conv.is_owned = (val & 1) || (val == 0);
10151 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10155 LDKRouteHop this_ptr_conv;
10156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10158 return RouteHop_get_fee_msat(&this_ptr_conv);
10161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10162 LDKRouteHop this_ptr_conv;
10163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10165 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10168 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10169 LDKRouteHop this_ptr_conv;
10170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10171 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10172 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10176 LDKRouteHop this_ptr_conv;
10177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10179 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10182 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) {
10183 LDKPublicKey pubkey_arg_ref;
10184 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
10185 LDKNodeFeatures node_features_arg_conv;
10186 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10187 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10188 LDKChannelFeatures channel_features_arg_conv;
10189 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10190 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10191 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);
10192 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10196 LDKRoute this_ptr_conv;
10197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10198 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10199 return Route_free(this_ptr_conv);
10202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10203 LDKRoute this_ptr_conv;
10204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10206 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10208 return Route_set_paths(&this_ptr_conv, val_conv);
10211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10212 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10213 FREE((void*)paths_arg);
10214 LDKRoute ret = Route_new(paths_arg_conv);
10215 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10220 obj_conv.inner = (void*)(obj & (~1));
10221 obj_conv.is_owned = (obj & 1) || (obj == 0);
10222 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10223 *ret = Route_write(&obj_conv);
10227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10228 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10229 LDKRoute ret = Route_read(ser_conv);
10230 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10234 LDKRouteHint this_ptr_conv;
10235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10237 return RouteHint_free(this_ptr_conv);
10240 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10241 LDKRouteHint this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10244 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10245 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10250 LDKRouteHint this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10253 LDKPublicKey val_ref;
10254 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10255 return RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
10258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10259 LDKRouteHint this_ptr_conv;
10260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10262 return RouteHint_get_short_channel_id(&this_ptr_conv);
10265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10266 LDKRouteHint this_ptr_conv;
10267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10269 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10273 LDKRouteHint this_ptr_conv;
10274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10276 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10277 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10281 LDKRouteHint this_ptr_conv;
10282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10284 LDKRoutingFees val_conv;
10285 val_conv.inner = (void*)(val & (~1));
10286 val_conv.is_owned = (val & 1) || (val == 0);
10287 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10290 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10291 LDKRouteHint this_ptr_conv;
10292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10294 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10298 LDKRouteHint this_ptr_conv;
10299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10301 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10305 LDKRouteHint this_ptr_conv;
10306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10308 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10312 LDKRouteHint this_ptr_conv;
10313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10315 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10318 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) {
10319 LDKPublicKey src_node_id_arg_ref;
10320 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
10321 LDKRoutingFees fees_arg_conv;
10322 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10323 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10324 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10325 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10328 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) {
10329 LDKPublicKey our_node_id_ref;
10330 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
10331 LDKNetworkGraph network_conv;
10332 network_conv.inner = (void*)(network & (~1));
10333 network_conv.is_owned = (network & 1) || (network == 0);
10334 LDKPublicKey target_ref;
10335 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
10336 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10337 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10338 FREE((void*)last_hops);
10339 LDKLogger logger_conv = *(LDKLogger*)logger;
10340 if (logger_conv.free == LDKLogger_JCalls_free) {
10341 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10342 LDKLogger_JCalls_clone(logger_conv.this_arg);
10344 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10345 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10350 LDKNetworkGraph this_ptr_conv;
10351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10353 return NetworkGraph_free(this_ptr_conv);
10356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10357 LDKLockedNetworkGraph this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10360 return LockedNetworkGraph_free(this_ptr_conv);
10363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10364 LDKNetGraphMsgHandler this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10367 return NetGraphMsgHandler_free(this_ptr_conv);
10370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
10371 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10372 LDKLogger logger_conv = *(LDKLogger*)logger;
10373 if (logger_conv.free == LDKLogger_JCalls_free) {
10374 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10375 LDKLogger_JCalls_clone(logger_conv.this_arg);
10377 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
10378 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
10382 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10383 LDKLogger logger_conv = *(LDKLogger*)logger;
10384 if (logger_conv.free == LDKLogger_JCalls_free) {
10385 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10386 LDKLogger_JCalls_clone(logger_conv.this_arg);
10388 LDKNetworkGraph network_graph_conv;
10389 network_graph_conv.inner = (void*)(network_graph & (~1));
10390 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
10391 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
10392 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10396 LDKNetGraphMsgHandler this_arg_conv;
10397 this_arg_conv.inner = (void*)(this_arg & (~1));
10398 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10399 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
10400 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10403 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10404 LDKLockedNetworkGraph this_arg_conv;
10405 this_arg_conv.inner = (void*)(this_arg & (~1));
10406 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10407 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
10408 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
10412 LDKNetGraphMsgHandler this_arg_conv;
10413 this_arg_conv.inner = (void*)(this_arg & (~1));
10414 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10415 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10416 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
10420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10421 LDKDirectionalChannelInfo this_ptr_conv;
10422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10424 return DirectionalChannelInfo_free(this_ptr_conv);
10427 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10428 LDKDirectionalChannelInfo this_ptr_conv;
10429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10431 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
10434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10435 LDKDirectionalChannelInfo this_ptr_conv;
10436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10438 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
10441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
10442 LDKDirectionalChannelInfo this_ptr_conv;
10443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10445 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
10448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10449 LDKDirectionalChannelInfo this_ptr_conv;
10450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10452 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
10455 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10456 LDKDirectionalChannelInfo this_ptr_conv;
10457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10459 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
10462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10463 LDKDirectionalChannelInfo this_ptr_conv;
10464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10466 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
10469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10470 LDKDirectionalChannelInfo this_ptr_conv;
10471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10473 return DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
10476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10477 LDKDirectionalChannelInfo this_ptr_conv;
10478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10480 return DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
10483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10484 LDKDirectionalChannelInfo this_ptr_conv;
10485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10487 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
10488 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10492 LDKDirectionalChannelInfo 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 LDKChannelUpdate val_conv;
10496 val_conv.inner = (void*)(val & (~1));
10497 val_conv.is_owned = (val & 1) || (val == 0);
10498 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
10501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10502 LDKDirectionalChannelInfo obj_conv;
10503 obj_conv.inner = (void*)(obj & (~1));
10504 obj_conv.is_owned = (obj & 1) || (obj == 0);
10505 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10506 *ret = DirectionalChannelInfo_write(&obj_conv);
10510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10511 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10512 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
10513 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10517 LDKChannelInfo this_ptr_conv;
10518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10520 return ChannelInfo_free(this_ptr_conv);
10523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10524 LDKChannelInfo this_ptr_conv;
10525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10527 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
10528 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10532 LDKChannelInfo this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10535 LDKChannelFeatures val_conv;
10536 val_conv.inner = (void*)(val & (~1));
10537 val_conv.is_owned = (val & 1) || (val == 0);
10538 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
10541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10542 LDKChannelInfo this_ptr_conv;
10543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10545 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10546 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
10550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10551 LDKChannelInfo this_ptr_conv;
10552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10554 LDKPublicKey val_ref;
10555 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10556 return ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
10559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10560 LDKChannelInfo this_ptr_conv;
10561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10563 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
10564 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10568 LDKChannelInfo this_ptr_conv;
10569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10571 LDKDirectionalChannelInfo val_conv;
10572 val_conv.inner = (void*)(val & (~1));
10573 val_conv.is_owned = (val & 1) || (val == 0);
10574 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
10577 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10578 LDKChannelInfo this_ptr_conv;
10579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10581 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10582 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
10586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10587 LDKChannelInfo this_ptr_conv;
10588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10590 LDKPublicKey val_ref;
10591 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10592 return ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
10595 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10596 LDKChannelInfo 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 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
10600 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10604 LDKChannelInfo this_ptr_conv;
10605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10607 LDKDirectionalChannelInfo val_conv;
10608 val_conv.inner = (void*)(val & (~1));
10609 val_conv.is_owned = (val & 1) || (val == 0);
10610 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
10613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10614 LDKChannelInfo this_ptr_conv;
10615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10617 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
10618 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10622 LDKChannelInfo this_ptr_conv;
10623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10625 LDKChannelAnnouncement val_conv;
10626 val_conv.inner = (void*)(val & (~1));
10627 val_conv.is_owned = (val & 1) || (val == 0);
10628 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
10631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10632 LDKChannelInfo obj_conv;
10633 obj_conv.inner = (void*)(obj & (~1));
10634 obj_conv.is_owned = (obj & 1) || (obj == 0);
10635 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10636 *ret = ChannelInfo_write(&obj_conv);
10640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10641 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10642 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
10643 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10647 LDKRoutingFees this_ptr_conv;
10648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10650 return RoutingFees_free(this_ptr_conv);
10653 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10654 LDKRoutingFees this_ptr_conv;
10655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10657 return RoutingFees_get_base_msat(&this_ptr_conv);
10660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10661 LDKRoutingFees this_ptr_conv;
10662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10664 return RoutingFees_set_base_msat(&this_ptr_conv, val);
10667 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10668 LDKRoutingFees this_ptr_conv;
10669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10671 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
10674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10675 LDKRoutingFees this_ptr_conv;
10676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10678 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
10681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
10682 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
10683 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
10687 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10688 LDKRoutingFees ret = RoutingFees_read(ser_conv);
10689 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
10693 LDKRoutingFees obj_conv;
10694 obj_conv.inner = (void*)(obj & (~1));
10695 obj_conv.is_owned = (obj & 1) || (obj == 0);
10696 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10697 *ret = RoutingFees_write(&obj_conv);
10701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10702 LDKNodeAnnouncementInfo this_ptr_conv;
10703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10705 return NodeAnnouncementInfo_free(this_ptr_conv);
10708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10709 LDKNodeAnnouncementInfo 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 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
10713 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10717 LDKNodeAnnouncementInfo this_ptr_conv;
10718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10720 LDKNodeFeatures val_conv;
10721 val_conv.inner = (void*)(val & (~1));
10722 val_conv.is_owned = (val & 1) || (val == 0);
10723 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
10726 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10727 LDKNodeAnnouncementInfo this_ptr_conv;
10728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10730 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
10733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10734 LDKNodeAnnouncementInfo this_ptr_conv;
10735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10737 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
10740 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
10741 LDKNodeAnnouncementInfo this_ptr_conv;
10742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10744 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
10745 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
10749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10750 LDKNodeAnnouncementInfo this_ptr_conv;
10751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10753 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
10755 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
10758 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
10759 LDKNodeAnnouncementInfo this_ptr_conv;
10760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10762 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10763 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
10767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10768 LDKNodeAnnouncementInfo this_ptr_conv;
10769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10771 LDKThirtyTwoBytes val_ref;
10772 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10773 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
10776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10777 LDKNodeAnnouncementInfo this_ptr_conv;
10778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10780 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
10782 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
10785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10786 LDKNodeAnnouncementInfo this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10789 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
10790 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10794 LDKNodeAnnouncementInfo this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10797 LDKNodeAnnouncement val_conv;
10798 val_conv.inner = (void*)(val & (~1));
10799 val_conv.is_owned = (val & 1) || (val == 0);
10800 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
10803 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) {
10804 LDKNodeFeatures features_arg_conv;
10805 features_arg_conv.inner = (void*)(features_arg & (~1));
10806 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
10807 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
10808 FREE((void*)rgb_arg);
10809 LDKThirtyTwoBytes alias_arg_ref;
10810 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
10811 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
10812 FREE((void*)addresses_arg);
10813 LDKNodeAnnouncement announcement_message_arg_conv;
10814 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
10815 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
10816 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
10817 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10820 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10821 LDKNodeAnnouncementInfo obj_conv;
10822 obj_conv.inner = (void*)(obj & (~1));
10823 obj_conv.is_owned = (obj & 1) || (obj == 0);
10824 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10825 *ret = NodeAnnouncementInfo_write(&obj_conv);
10829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10830 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10831 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
10832 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10836 LDKNodeInfo this_ptr_conv;
10837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10839 return NodeInfo_free(this_ptr_conv);
10842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10843 LDKNodeInfo this_ptr_conv;
10844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10846 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
10848 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
10851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10852 LDKNodeInfo this_ptr_conv;
10853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10855 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
10856 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10860 LDKNodeInfo 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 LDKRoutingFees val_conv;
10864 val_conv.inner = (void*)(val & (~1));
10865 val_conv.is_owned = (val & 1) || (val == 0);
10866 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
10869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
10870 LDKNodeInfo this_ptr_conv;
10871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10873 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
10874 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10878 LDKNodeInfo this_ptr_conv;
10879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10881 LDKNodeAnnouncementInfo val_conv;
10882 val_conv.inner = (void*)(val & (~1));
10883 val_conv.is_owned = (val & 1) || (val == 0);
10884 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
10887 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) {
10888 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
10889 FREE((void*)channels_arg);
10890 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
10891 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
10892 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
10893 LDKNodeAnnouncementInfo announcement_info_arg_conv;
10894 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
10895 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
10896 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
10897 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10900 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10901 LDKNodeInfo obj_conv;
10902 obj_conv.inner = (void*)(obj & (~1));
10903 obj_conv.is_owned = (obj & 1) || (obj == 0);
10904 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10905 *ret = NodeInfo_write(&obj_conv);
10909 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10910 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10911 LDKNodeInfo ret = NodeInfo_read(ser_conv);
10912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
10916 LDKNetworkGraph obj_conv;
10917 obj_conv.inner = (void*)(obj & (~1));
10918 obj_conv.is_owned = (obj & 1) || (obj == 0);
10919 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10920 *ret = NetworkGraph_write(&obj_conv);
10924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
10925 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10926 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
10927 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
10931 LDKNetworkGraph ret = NetworkGraph_new();
10932 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10935 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) {
10936 LDKNetworkGraph this_arg_conv;
10937 this_arg_conv.inner = (void*)(this_arg & (~1));
10938 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10939 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);