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 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_msg_events_meth);
1371 LDKCVec_MessageSendEventZ res = *ret;
1375 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1376 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1379 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1380 (*env)->DeleteGlobalRef(env, j_calls->o);
1384 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1385 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1386 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1387 return (void*) this_arg;
1389 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1390 jclass c = (*env)->GetObjectClass(env, o);
1391 DO_ASSERT(c != NULL);
1392 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1393 atomic_init(&calls->refcnt, 1);
1394 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1395 calls->o = (*env)->NewGlobalRef(env, o);
1396 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1397 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1399 LDKMessageSendEventsProvider ret = {
1400 .this_arg = (void*) calls,
1401 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1402 .free = LDKMessageSendEventsProvider_JCalls_free,
1406 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1407 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1408 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1409 return (long)res_ptr;
1411 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1412 return ((LDKMessageSendEventsProvider_JCalls*)val)->o;
1414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) {
1415 LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg;
1416 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1417 *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg);
1421 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1422 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1423 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1426 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1427 ret->datalen = (*env)->GetArrayLength(env, elems);
1428 if (ret->datalen == 0) {
1431 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1432 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1433 for (size_t i = 0; i < ret->datalen; i++) {
1434 jlong arr_elem = java_elems[i];
1435 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1436 FREE((void*)arr_elem);
1437 ret->data[i] = arr_elem_conv;
1439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1443 typedef struct LDKEventsProvider_JCalls {
1444 atomic_size_t refcnt;
1447 jmethodID get_and_clear_pending_events_meth;
1448 } LDKEventsProvider_JCalls;
1449 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1450 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1452 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1453 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_events_meth);
1454 LDKCVec_EventZ res = *ret;
1458 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1459 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1460 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1462 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1463 (*env)->DeleteGlobalRef(env, j_calls->o);
1467 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1468 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1469 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1470 return (void*) this_arg;
1472 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1473 jclass c = (*env)->GetObjectClass(env, o);
1474 DO_ASSERT(c != NULL);
1475 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1476 atomic_init(&calls->refcnt, 1);
1477 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1478 calls->o = (*env)->NewGlobalRef(env, o);
1479 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1480 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1482 LDKEventsProvider ret = {
1483 .this_arg = (void*) calls,
1484 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1485 .free = LDKEventsProvider_JCalls_free,
1489 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1490 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1491 *res_ptr = LDKEventsProvider_init(env, _a, o);
1492 return (long)res_ptr;
1494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1495 return ((LDKEventsProvider_JCalls*)val)->o;
1497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) {
1498 LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg;
1499 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1500 *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg);
1504 typedef struct LDKLogger_JCalls {
1505 atomic_size_t refcnt;
1510 void log_jcall(const void* this_arg, const char *record) {
1511 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1513 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1514 jstring record_conv = (*env)->NewStringUTF(env, record);
1515 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->log_meth, record_conv);
1517 static void LDKLogger_JCalls_free(void* this_arg) {
1518 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1519 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1521 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1522 (*env)->DeleteGlobalRef(env, j_calls->o);
1526 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1527 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1528 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1529 return (void*) this_arg;
1531 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1532 jclass c = (*env)->GetObjectClass(env, o);
1533 DO_ASSERT(c != NULL);
1534 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1535 atomic_init(&calls->refcnt, 1);
1536 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1537 calls->o = (*env)->NewGlobalRef(env, o);
1538 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1539 DO_ASSERT(calls->log_meth != NULL);
1542 .this_arg = (void*) calls,
1544 .free = LDKLogger_JCalls_free,
1548 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1549 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1550 *res_ptr = LDKLogger_init(env, _a, o);
1551 return (long)res_ptr;
1553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1554 return ((LDKLogger_JCalls*)val)->o;
1556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1557 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1560 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1561 if (val->result_ok) {
1562 return (long)val->contents.result;
1564 return (long)val->contents.err;
1567 typedef struct LDKAccess_JCalls {
1568 atomic_size_t refcnt;
1571 jmethodID get_utxo_meth;
1573 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1574 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1576 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1577 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1578 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1579 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1580 LDKCResult_TxOutAccessErrorZ res = *ret;
1584 static void LDKAccess_JCalls_free(void* this_arg) {
1585 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1586 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1589 (*env)->DeleteGlobalRef(env, j_calls->o);
1593 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1594 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1595 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1596 return (void*) this_arg;
1598 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1599 jclass c = (*env)->GetObjectClass(env, o);
1600 DO_ASSERT(c != NULL);
1601 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1602 atomic_init(&calls->refcnt, 1);
1603 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1604 calls->o = (*env)->NewGlobalRef(env, o);
1605 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1606 DO_ASSERT(calls->get_utxo_meth != NULL);
1609 .this_arg = (void*) calls,
1610 .get_utxo = get_utxo_jcall,
1611 .free = LDKAccess_JCalls_free,
1615 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1616 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1617 *res_ptr = LDKAccess_init(env, _a, o);
1618 return (long)res_ptr;
1620 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1621 return ((LDKAccess_JCalls*)val)->o;
1623 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) {
1624 LDKAccess* arg_conv = (LDKAccess*)arg;
1625 unsigned char genesis_hash_arr[32];
1626 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1627 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1628 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1629 *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1633 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1634 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1635 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1636 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1637 for (size_t i = 0; i < vec->datalen; i++) {
1638 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1639 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1641 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1645 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1646 ret->datalen = (*env)->GetArrayLength(env, elems);
1647 if (ret->datalen == 0) {
1650 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1651 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1652 for (size_t i = 0; i < ret->datalen; i++) {
1653 jlong arr_elem = java_elems[i];
1654 LDKHTLCOutputInCommitment arr_elem_conv;
1655 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1656 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1657 ret->data[i] = arr_elem_conv;
1659 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1663 typedef struct LDKChannelKeys_JCalls {
1664 atomic_size_t refcnt;
1667 jmethodID get_per_commitment_point_meth;
1668 jmethodID release_commitment_secret_meth;
1669 jmethodID key_derivation_params_meth;
1670 jmethodID sign_counterparty_commitment_meth;
1671 jmethodID sign_holder_commitment_meth;
1672 jmethodID sign_holder_commitment_htlc_transactions_meth;
1673 jmethodID sign_justice_transaction_meth;
1674 jmethodID sign_counterparty_htlc_transaction_meth;
1675 jmethodID sign_closing_transaction_meth;
1676 jmethodID sign_channel_announcement_meth;
1677 jmethodID on_accept_meth;
1678 } LDKChannelKeys_JCalls;
1679 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1680 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1682 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1683 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->get_per_commitment_point_meth, idx);
1685 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1688 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1689 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1691 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1692 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->release_commitment_secret_meth, idx);
1693 LDKThirtyTwoBytes ret;
1694 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1697 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1698 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1700 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1701 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->key_derivation_params_meth);
1702 LDKC2Tuple_u64u64Z res = *ret;
1706 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) {
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 long commitment_tx_ref = (long)&commitment_tx;
1711 long htlcs_ref = (long)&htlcs;
1712 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
1713 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1717 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
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 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1722 LDKCResult_SignatureNoneZ res = *ret;
1726 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1727 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1729 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1730 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1731 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1735 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) {
1736 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1738 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1739 long justice_tx_ref = (long)&justice_tx;
1740 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1741 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1742 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1743 LDKCResult_SignatureNoneZ res = *ret;
1747 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) {
1748 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1750 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1751 long htlc_tx_ref = (long)&htlc_tx;
1752 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1753 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1754 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc);
1755 LDKCResult_SignatureNoneZ res = *ret;
1759 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1760 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1762 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1763 long closing_tx_ref = (long)&closing_tx;
1764 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1765 LDKCResult_SignatureNoneZ res = *ret;
1769 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1770 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1772 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1773 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_channel_announcement_meth, msg);
1774 LDKCResult_SignatureNoneZ res = *ret;
1778 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1779 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1781 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1782 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1784 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1785 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1786 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1789 (*env)->DeleteGlobalRef(env, j_calls->o);
1793 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1794 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1795 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1796 return (void*) this_arg;
1798 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1799 jclass c = (*env)->GetObjectClass(env, o);
1800 DO_ASSERT(c != NULL);
1801 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1802 atomic_init(&calls->refcnt, 1);
1803 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1804 calls->o = (*env)->NewGlobalRef(env, o);
1805 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1806 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1807 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1808 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1809 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1810 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1811 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1812 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1813 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1814 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1815 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1816 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1817 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1818 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1819 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1820 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1821 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1822 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1823 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1824 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1825 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1826 DO_ASSERT(calls->on_accept_meth != NULL);
1828 LDKChannelKeys ret = {
1829 .this_arg = (void*) calls,
1830 .get_per_commitment_point = get_per_commitment_point_jcall,
1831 .release_commitment_secret = release_commitment_secret_jcall,
1832 .key_derivation_params = key_derivation_params_jcall,
1833 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1834 .sign_holder_commitment = sign_holder_commitment_jcall,
1835 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1836 .sign_justice_transaction = sign_justice_transaction_jcall,
1837 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1838 .sign_closing_transaction = sign_closing_transaction_jcall,
1839 .sign_channel_announcement = sign_channel_announcement_jcall,
1840 .on_accept = on_accept_jcall,
1841 .clone = LDKChannelKeys_JCalls_clone,
1842 .free = LDKChannelKeys_JCalls_free,
1846 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1847 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1848 *res_ptr = LDKChannelKeys_init(env, _a, o);
1849 return (long)res_ptr;
1851 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1852 return ((LDKChannelKeys_JCalls*)val)->o;
1854 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1855 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1856 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1857 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx).compressed_form);
1861 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1862 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1863 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1864 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data);
1868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) {
1869 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1870 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1871 *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg);
1875 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) {
1876 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1877 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1878 FREE((void*)commitment_tx);
1879 LDKPreCalculatedTxCreationKeys keys_conv;
1880 keys_conv.inner = (void*)(keys & (~1));
1881 keys_conv.is_owned = (keys & 1) || (keys == 0);
1882 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1884 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1885 *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1890 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1891 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1892 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1893 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1894 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1895 *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, &holder_commitment_tx_conv);
1899 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) {
1900 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1901 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1902 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1903 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1904 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1905 *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, &holder_commitment_tx_conv);
1909 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) {
1910 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1911 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1912 FREE((void*)justice_tx);
1913 unsigned char per_commitment_key_arr[32];
1914 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1915 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1916 LDKHTLCOutputInCommitment htlc_conv;
1917 htlc_conv.inner = (void*)(htlc & (~1));
1918 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1919 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1920 *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1924 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) {
1925 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1926 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1927 FREE((void*)htlc_tx);
1928 LDKPublicKey per_commitment_point_ref;
1929 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1930 LDKHTLCOutputInCommitment htlc_conv;
1931 htlc_conv.inner = (void*)(htlc & (~1));
1932 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1933 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1934 *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) {
1939 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1940 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1941 FREE((void*)closing_tx);
1942 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1943 *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv);
1947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
1948 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1949 LDKUnsignedChannelAnnouncement msg_conv;
1950 msg_conv.inner = (void*)(msg & (~1));
1951 msg_conv.is_owned = (msg & 1) || (msg == 0);
1952 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1953 *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, &msg_conv);
1957 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) {
1958 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1959 LDKChannelPublicKeys channel_points_conv;
1960 channel_points_conv.inner = (void*)(channel_points & (~1));
1961 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
1962 return (arg_conv->on_accept)(arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
1965 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1966 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
1967 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1968 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1969 for (size_t i = 0; i < vec->datalen; i++) {
1970 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1971 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1973 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1977 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
1978 ret->datalen = (*env)->GetArrayLength(env, elems);
1979 if (ret->datalen == 0) {
1982 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
1983 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1984 for (size_t i = 0; i < ret->datalen; i++) {
1985 jlong arr_elem = java_elems[i];
1986 LDKMonitorEvent arr_elem_conv;
1987 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1988 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1989 ret->data[i] = arr_elem_conv;
1991 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1995 typedef struct LDKWatch_JCalls {
1996 atomic_size_t refcnt;
1999 jmethodID watch_channel_meth;
2000 jmethodID update_channel_meth;
2001 jmethodID release_pending_monitor_events_meth;
2003 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2004 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2006 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2007 LDKOutPoint funding_txo_var = funding_txo;
2008 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2009 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2010 long funding_txo_ref;
2011 if (funding_txo_var.is_owned) {
2012 funding_txo_ref = (long)funding_txo_var.inner | 1;
2014 funding_txo_ref = (long)&funding_txo_var;
2016 LDKChannelMonitor monitor_var = monitor;
2017 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2018 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2020 if (monitor_var.is_owned) {
2021 monitor_ref = (long)monitor_var.inner | 1;
2023 monitor_ref = (long)&monitor_var;
2025 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2026 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2030 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2031 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2033 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2034 LDKOutPoint funding_txo_var = funding_txo;
2035 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2036 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2037 long funding_txo_ref;
2038 if (funding_txo_var.is_owned) {
2039 funding_txo_ref = (long)funding_txo_var.inner | 1;
2041 funding_txo_ref = (long)&funding_txo_var;
2043 LDKChannelMonitorUpdate update_var = update;
2044 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2045 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2047 if (update_var.is_owned) {
2048 update_ref = (long)update_var.inner | 1;
2050 update_ref = (long)&update_var;
2052 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2053 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2057 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2058 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2060 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2061 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->release_pending_monitor_events_meth);
2062 LDKCVec_MonitorEventZ res = *ret;
2066 static void LDKWatch_JCalls_free(void* this_arg) {
2067 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2068 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2070 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2071 (*env)->DeleteGlobalRef(env, j_calls->o);
2075 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2076 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2077 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2078 return (void*) this_arg;
2080 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2081 jclass c = (*env)->GetObjectClass(env, o);
2082 DO_ASSERT(c != NULL);
2083 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2084 atomic_init(&calls->refcnt, 1);
2085 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2086 calls->o = (*env)->NewGlobalRef(env, o);
2087 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2088 DO_ASSERT(calls->watch_channel_meth != NULL);
2089 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2090 DO_ASSERT(calls->update_channel_meth != NULL);
2091 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2092 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2095 .this_arg = (void*) calls,
2096 .watch_channel = watch_channel_jcall,
2097 .update_channel = update_channel_jcall,
2098 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2099 .free = LDKWatch_JCalls_free,
2103 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2104 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2105 *res_ptr = LDKWatch_init(env, _a, o);
2106 return (long)res_ptr;
2108 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2109 return ((LDKWatch_JCalls*)val)->o;
2111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) {
2112 LDKWatch* arg_conv = (LDKWatch*)arg;
2113 LDKOutPoint funding_txo_conv;
2114 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2115 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2116 LDKChannelMonitor monitor_conv;
2117 monitor_conv.inner = (void*)(monitor & (~1));
2118 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2119 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2120 *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv);
2124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) {
2125 LDKWatch* arg_conv = (LDKWatch*)arg;
2126 LDKOutPoint funding_txo_conv;
2127 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2128 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2129 LDKChannelMonitorUpdate update_conv;
2130 update_conv.inner = (void*)(update & (~1));
2131 update_conv.is_owned = (update & 1) || (update == 0);
2132 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2133 *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv);
2137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) {
2138 LDKWatch* arg_conv = (LDKWatch*)arg;
2139 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2140 *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg);
2144 typedef struct LDKFilter_JCalls {
2145 atomic_size_t refcnt;
2148 jmethodID register_tx_meth;
2149 jmethodID register_output_meth;
2151 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2152 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2154 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2155 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2156 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2157 long script_pubkey_ref = (long)&script_pubkey;
2158 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2160 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2161 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2163 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2164 long script_pubkey_ref = (long)&script_pubkey;
2165 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2167 static void LDKFilter_JCalls_free(void* this_arg) {
2168 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2169 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2171 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2172 (*env)->DeleteGlobalRef(env, j_calls->o);
2176 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2177 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2178 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2179 return (void*) this_arg;
2181 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2182 jclass c = (*env)->GetObjectClass(env, o);
2183 DO_ASSERT(c != NULL);
2184 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2185 atomic_init(&calls->refcnt, 1);
2186 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2187 calls->o = (*env)->NewGlobalRef(env, o);
2188 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2189 DO_ASSERT(calls->register_tx_meth != NULL);
2190 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2191 DO_ASSERT(calls->register_output_meth != NULL);
2194 .this_arg = (void*) calls,
2195 .register_tx = register_tx_jcall,
2196 .register_output = register_output_jcall,
2197 .free = LDKFilter_JCalls_free,
2201 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2202 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2203 *res_ptr = LDKFilter_init(env, _a, o);
2204 return (long)res_ptr;
2206 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2207 return ((LDKFilter_JCalls*)val)->o;
2209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) {
2210 LDKFilter* arg_conv = (LDKFilter*)arg;
2211 unsigned char txid_arr[32];
2212 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2213 unsigned char (*txid_ref)[32] = &txid_arr;
2214 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2215 return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv);
2218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) {
2219 LDKFilter* arg_conv = (LDKFilter*)arg;
2220 LDKOutPoint outpoint_conv;
2221 outpoint_conv.inner = (void*)(outpoint & (~1));
2222 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2223 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2224 return (arg_conv->register_output)(arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2227 typedef struct LDKBroadcasterInterface_JCalls {
2228 atomic_size_t refcnt;
2231 jmethodID broadcast_transaction_meth;
2232 } LDKBroadcasterInterface_JCalls;
2233 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2234 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2236 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2237 long tx_ref = (long)&tx;
2238 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->broadcast_transaction_meth, tx_ref);
2240 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2241 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2242 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2244 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2245 (*env)->DeleteGlobalRef(env, j_calls->o);
2249 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2250 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2251 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2252 return (void*) this_arg;
2254 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2255 jclass c = (*env)->GetObjectClass(env, o);
2256 DO_ASSERT(c != NULL);
2257 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2258 atomic_init(&calls->refcnt, 1);
2259 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2260 calls->o = (*env)->NewGlobalRef(env, o);
2261 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2262 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2264 LDKBroadcasterInterface ret = {
2265 .this_arg = (void*) calls,
2266 .broadcast_transaction = broadcast_transaction_jcall,
2267 .free = LDKBroadcasterInterface_JCalls_free,
2271 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2272 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2273 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2274 return (long)res_ptr;
2276 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2277 return ((LDKBroadcasterInterface_JCalls*)val)->o;
2279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) {
2280 LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg;
2281 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2283 return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv);
2286 typedef struct LDKFeeEstimator_JCalls {
2287 atomic_size_t refcnt;
2290 jmethodID get_est_sat_per_1000_weight_meth;
2291 } LDKFeeEstimator_JCalls;
2292 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2293 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2295 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2296 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2297 return (*env)->CallIntMethod(env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2299 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2300 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2301 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2303 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2304 (*env)->DeleteGlobalRef(env, j_calls->o);
2308 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2309 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2310 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2311 return (void*) this_arg;
2313 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2314 jclass c = (*env)->GetObjectClass(env, o);
2315 DO_ASSERT(c != NULL);
2316 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2317 atomic_init(&calls->refcnt, 1);
2318 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2319 calls->o = (*env)->NewGlobalRef(env, o);
2320 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2321 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2323 LDKFeeEstimator ret = {
2324 .this_arg = (void*) calls,
2325 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2326 .free = LDKFeeEstimator_JCalls_free,
2330 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2331 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2332 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2333 return (long)res_ptr;
2335 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2336 return ((LDKFeeEstimator_JCalls*)val)->o;
2338 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) {
2339 LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg;
2340 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2341 return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv);
2344 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2345 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2346 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2349 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2350 ret->datalen = (*env)->GetArrayLength(env, elems);
2351 if (ret->datalen == 0) {
2354 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2355 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2356 for (size_t i = 0; i < ret->datalen; i++) {
2357 jlong arr_elem = java_elems[i];
2358 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2359 FREE((void*)arr_elem);
2360 ret->data[i] = arr_elem_conv;
2362 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2366 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2367 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2368 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2371 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2372 ret->datalen = (*env)->GetArrayLength(env, elems);
2373 if (ret->datalen == 0) {
2376 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2377 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2378 for (size_t i = 0; i < ret->datalen; i++) {
2379 jlong arr_elem = java_elems[i];
2380 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2381 FREE((void*)arr_elem);
2382 ret->data[i] = arr_elem_conv;
2384 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2388 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2389 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2390 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2393 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2394 ret->datalen = (*env)->GetArrayLength(env, elems);
2395 if (ret->datalen == 0) {
2398 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2399 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2400 for (size_t i = 0; i < ret->datalen; i++) {
2401 jlong arr_elem = java_elems[i];
2402 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2403 FREE((void*)arr_elem);
2404 ret->data[i] = arr_elem_conv;
2406 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2410 typedef struct LDKKeysInterface_JCalls {
2411 atomic_size_t refcnt;
2414 jmethodID get_node_secret_meth;
2415 jmethodID get_destination_script_meth;
2416 jmethodID get_shutdown_pubkey_meth;
2417 jmethodID get_channel_keys_meth;
2418 jmethodID get_secure_random_bytes_meth;
2419 } LDKKeysInterface_JCalls;
2420 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2421 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2423 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2424 LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_node_secret_meth);
2425 LDKSecretKey res = *ret;
2429 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2430 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2432 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2433 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_destination_script_meth);
2434 LDKCVec_u8Z res = *ret;
2438 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2439 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2441 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2442 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->get_shutdown_pubkey_meth);
2444 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2447 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2448 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2450 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2451 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2452 LDKChannelKeys res = *ret;
2456 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2457 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2459 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2460 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->get_secure_random_bytes_meth);
2461 LDKThirtyTwoBytes ret;
2462 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2465 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2466 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2467 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2469 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2470 (*env)->DeleteGlobalRef(env, j_calls->o);
2474 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2475 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2476 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2477 return (void*) this_arg;
2479 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2480 jclass c = (*env)->GetObjectClass(env, o);
2481 DO_ASSERT(c != NULL);
2482 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2483 atomic_init(&calls->refcnt, 1);
2484 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2485 calls->o = (*env)->NewGlobalRef(env, o);
2486 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
2487 DO_ASSERT(calls->get_node_secret_meth != NULL);
2488 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2489 DO_ASSERT(calls->get_destination_script_meth != NULL);
2490 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2491 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2492 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2493 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2494 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2495 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2497 LDKKeysInterface ret = {
2498 .this_arg = (void*) calls,
2499 .get_node_secret = get_node_secret_jcall,
2500 .get_destination_script = get_destination_script_jcall,
2501 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2502 .get_channel_keys = get_channel_keys_jcall,
2503 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2504 .free = LDKKeysInterface_JCalls_free,
2508 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2509 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2510 *res_ptr = LDKKeysInterface_init(env, _a, o);
2511 return (long)res_ptr;
2513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2514 return ((LDKKeysInterface_JCalls*)val)->o;
2516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) {
2517 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2518 LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
2519 *ret = (arg_conv->get_node_secret)(arg_conv->this_arg);
2523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) {
2524 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2525 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2526 *ret = (arg_conv->get_destination_script)(arg_conv->this_arg);
2530 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) {
2531 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2532 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2533 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg).compressed_form);
2537 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) {
2538 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2539 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2540 *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis);
2544 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) {
2545 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2546 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2547 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data);
2551 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2552 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2553 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2554 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2555 for (size_t i = 0; i < vec->datalen; i++) {
2556 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2557 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2559 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2563 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2564 ret->datalen = (*env)->GetArrayLength(env, elems);
2565 if (ret->datalen == 0) {
2568 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2569 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2570 for (size_t i = 0; i < ret->datalen; i++) {
2571 jlong arr_elem = java_elems[i];
2572 LDKChannelDetails arr_elem_conv;
2573 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2574 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2575 ret->data[i] = arr_elem_conv;
2577 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2581 static jclass LDKNetAddress_IPv4_class = NULL;
2582 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2583 static jclass LDKNetAddress_IPv6_class = NULL;
2584 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2585 static jclass LDKNetAddress_OnionV2_class = NULL;
2586 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2587 static jclass LDKNetAddress_OnionV3_class = NULL;
2588 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2590 LDKNetAddress_IPv4_class =
2591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2592 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2593 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2594 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2595 LDKNetAddress_IPv6_class =
2596 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2597 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2598 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2599 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2600 LDKNetAddress_OnionV2_class =
2601 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2602 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2603 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2604 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2605 LDKNetAddress_OnionV3_class =
2606 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2607 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2608 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2609 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2612 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2614 case LDKNetAddress_IPv4: {
2615 long addr_ref = (long)&obj->i_pv4.addr;
2616 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2618 case LDKNetAddress_IPv6: {
2619 long addr_ref = (long)&obj->i_pv6.addr;
2620 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2622 case LDKNetAddress_OnionV2: {
2623 long addr_ref = (long)&obj->onion_v2.addr;
2624 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2626 case LDKNetAddress_OnionV3: {
2627 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2628 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2629 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);
2634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2635 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2636 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2639 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2640 ret->datalen = (*env)->GetArrayLength(env, elems);
2641 if (ret->datalen == 0) {
2644 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2645 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2646 for (size_t i = 0; i < ret->datalen; i++) {
2647 jlong arr_elem = java_elems[i];
2648 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2649 FREE((void*)arr_elem);
2650 ret->data[i] = arr_elem_conv;
2652 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2656 typedef struct LDKChannelMessageHandler_JCalls {
2657 atomic_size_t refcnt;
2660 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2661 jmethodID handle_open_channel_meth;
2662 jmethodID handle_accept_channel_meth;
2663 jmethodID handle_funding_created_meth;
2664 jmethodID handle_funding_signed_meth;
2665 jmethodID handle_funding_locked_meth;
2666 jmethodID handle_shutdown_meth;
2667 jmethodID handle_closing_signed_meth;
2668 jmethodID handle_update_add_htlc_meth;
2669 jmethodID handle_update_fulfill_htlc_meth;
2670 jmethodID handle_update_fail_htlc_meth;
2671 jmethodID handle_update_fail_malformed_htlc_meth;
2672 jmethodID handle_commitment_signed_meth;
2673 jmethodID handle_revoke_and_ack_meth;
2674 jmethodID handle_update_fee_meth;
2675 jmethodID handle_announcement_signatures_meth;
2676 jmethodID peer_disconnected_meth;
2677 jmethodID peer_connected_meth;
2678 jmethodID handle_channel_reestablish_meth;
2679 jmethodID handle_error_meth;
2680 } LDKChannelMessageHandler_JCalls;
2681 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2682 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2684 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2685 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2686 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2687 LDKInitFeatures their_features_var = their_features;
2688 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2689 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2690 long their_features_ref;
2691 if (their_features_var.is_owned) {
2692 their_features_ref = (long)their_features_var.inner | 1;
2694 their_features_ref = (long)&their_features_var;
2696 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2698 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2699 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2701 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2702 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2703 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2704 LDKInitFeatures their_features_var = their_features;
2705 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2706 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2707 long their_features_ref;
2708 if (their_features_var.is_owned) {
2709 their_features_ref = (long)their_features_var.inner | 1;
2711 their_features_ref = (long)&their_features_var;
2713 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2715 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2716 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2718 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2719 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2720 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2721 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2723 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2724 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2726 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2727 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2728 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2729 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2731 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2732 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2734 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2735 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2736 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2737 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2739 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2740 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2742 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2743 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2744 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2745 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2747 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2748 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2750 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2751 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2752 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2753 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2755 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *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 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2763 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2764 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2766 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2767 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2768 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2769 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2771 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2772 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2774 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2775 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2776 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2777 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2779 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2780 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2782 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2783 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2784 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2785 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2787 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2788 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2790 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2791 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2792 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2793 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2795 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2796 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2798 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2799 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2800 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2801 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2803 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *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 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2811 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2812 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2814 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2815 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2816 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2817 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2819 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2820 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2822 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2823 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2824 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2825 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2827 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2828 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2830 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2831 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2832 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2833 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_connected_meth, their_node_id_arr, msg);
2835 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2836 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2838 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2839 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2840 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2841 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2843 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *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 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_error_meth, their_node_id_arr, msg);
2851 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2852 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2853 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2855 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2856 (*env)->DeleteGlobalRef(env, j_calls->o);
2860 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2861 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2862 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2863 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2864 return (void*) this_arg;
2866 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2867 jclass c = (*env)->GetObjectClass(env, o);
2868 DO_ASSERT(c != NULL);
2869 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
2870 atomic_init(&calls->refcnt, 1);
2871 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2872 calls->o = (*env)->NewGlobalRef(env, o);
2873 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
2874 DO_ASSERT(calls->handle_open_channel_meth != NULL);
2875 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
2876 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
2877 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
2878 DO_ASSERT(calls->handle_funding_created_meth != NULL);
2879 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
2880 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
2881 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
2882 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
2883 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
2884 DO_ASSERT(calls->handle_shutdown_meth != NULL);
2885 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
2886 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
2887 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
2888 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
2889 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
2890 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
2891 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
2892 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
2893 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
2894 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
2895 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
2896 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
2897 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
2898 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
2899 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
2900 DO_ASSERT(calls->handle_update_fee_meth != NULL);
2901 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
2902 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
2903 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
2904 DO_ASSERT(calls->peer_disconnected_meth != NULL);
2905 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
2906 DO_ASSERT(calls->peer_connected_meth != NULL);
2907 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
2908 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
2909 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
2910 DO_ASSERT(calls->handle_error_meth != NULL);
2912 LDKChannelMessageHandler ret = {
2913 .this_arg = (void*) calls,
2914 .handle_open_channel = handle_open_channel_jcall,
2915 .handle_accept_channel = handle_accept_channel_jcall,
2916 .handle_funding_created = handle_funding_created_jcall,
2917 .handle_funding_signed = handle_funding_signed_jcall,
2918 .handle_funding_locked = handle_funding_locked_jcall,
2919 .handle_shutdown = handle_shutdown_jcall,
2920 .handle_closing_signed = handle_closing_signed_jcall,
2921 .handle_update_add_htlc = handle_update_add_htlc_jcall,
2922 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
2923 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
2924 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
2925 .handle_commitment_signed = handle_commitment_signed_jcall,
2926 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
2927 .handle_update_fee = handle_update_fee_jcall,
2928 .handle_announcement_signatures = handle_announcement_signatures_jcall,
2929 .peer_disconnected = peer_disconnected_jcall,
2930 .peer_connected = peer_connected_jcall,
2931 .handle_channel_reestablish = handle_channel_reestablish_jcall,
2932 .handle_error = handle_error_jcall,
2933 .free = LDKChannelMessageHandler_JCalls_free,
2934 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
2936 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
2939 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2940 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
2941 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
2942 return (long)res_ptr;
2944 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2945 return ((LDKChannelMessageHandler_JCalls*)val)->o;
2947 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) {
2948 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2949 LDKPublicKey their_node_id_ref;
2950 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
2951 LDKInitFeatures their_features_conv;
2952 their_features_conv.inner = (void*)(their_features & (~1));
2953 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2954 LDKOpenChannel msg_conv;
2955 msg_conv.inner = (void*)(msg & (~1));
2956 msg_conv.is_owned = (msg & 1) || (msg == 0);
2957 return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
2960 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) {
2961 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2962 LDKPublicKey their_node_id_ref;
2963 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
2964 LDKInitFeatures their_features_conv;
2965 their_features_conv.inner = (void*)(their_features & (~1));
2966 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2967 LDKAcceptChannel msg_conv;
2968 msg_conv.inner = (void*)(msg & (~1));
2969 msg_conv.is_owned = (msg & 1) || (msg == 0);
2970 return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
2973 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) {
2974 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2975 LDKPublicKey their_node_id_ref;
2976 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
2977 LDKFundingCreated msg_conv;
2978 msg_conv.inner = (void*)(msg & (~1));
2979 msg_conv.is_owned = (msg & 1) || (msg == 0);
2980 return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
2983 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) {
2984 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2985 LDKPublicKey their_node_id_ref;
2986 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
2987 LDKFundingSigned msg_conv;
2988 msg_conv.inner = (void*)(msg & (~1));
2989 msg_conv.is_owned = (msg & 1) || (msg == 0);
2990 return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
2993 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) {
2994 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2995 LDKPublicKey their_node_id_ref;
2996 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
2997 LDKFundingLocked msg_conv;
2998 msg_conv.inner = (void*)(msg & (~1));
2999 msg_conv.is_owned = (msg & 1) || (msg == 0);
3000 return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3004 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3005 LDKPublicKey their_node_id_ref;
3006 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3007 LDKShutdown msg_conv;
3008 msg_conv.inner = (void*)(msg & (~1));
3009 msg_conv.is_owned = (msg & 1) || (msg == 0);
3010 return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3013 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) {
3014 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3015 LDKPublicKey their_node_id_ref;
3016 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3017 LDKClosingSigned msg_conv;
3018 msg_conv.inner = (void*)(msg & (~1));
3019 msg_conv.is_owned = (msg & 1) || (msg == 0);
3020 return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3023 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) {
3024 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3025 LDKPublicKey their_node_id_ref;
3026 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3027 LDKUpdateAddHTLC msg_conv;
3028 msg_conv.inner = (void*)(msg & (~1));
3029 msg_conv.is_owned = (msg & 1) || (msg == 0);
3030 return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3033 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) {
3034 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3035 LDKPublicKey their_node_id_ref;
3036 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3037 LDKUpdateFulfillHTLC msg_conv;
3038 msg_conv.inner = (void*)(msg & (~1));
3039 msg_conv.is_owned = (msg & 1) || (msg == 0);
3040 return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3043 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) {
3044 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3045 LDKPublicKey their_node_id_ref;
3046 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3047 LDKUpdateFailHTLC msg_conv;
3048 msg_conv.inner = (void*)(msg & (~1));
3049 msg_conv.is_owned = (msg & 1) || (msg == 0);
3050 return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3053 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) {
3054 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3055 LDKPublicKey their_node_id_ref;
3056 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3057 LDKUpdateFailMalformedHTLC msg_conv;
3058 msg_conv.inner = (void*)(msg & (~1));
3059 msg_conv.is_owned = (msg & 1) || (msg == 0);
3060 return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3063 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) {
3064 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3065 LDKPublicKey their_node_id_ref;
3066 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3067 LDKCommitmentSigned msg_conv;
3068 msg_conv.inner = (void*)(msg & (~1));
3069 msg_conv.is_owned = (msg & 1) || (msg == 0);
3070 return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3073 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) {
3074 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3075 LDKPublicKey their_node_id_ref;
3076 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3077 LDKRevokeAndACK msg_conv;
3078 msg_conv.inner = (void*)(msg & (~1));
3079 msg_conv.is_owned = (msg & 1) || (msg == 0);
3080 return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3083 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) {
3084 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3085 LDKPublicKey their_node_id_ref;
3086 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3087 LDKUpdateFee msg_conv;
3088 msg_conv.inner = (void*)(msg & (~1));
3089 msg_conv.is_owned = (msg & 1) || (msg == 0);
3090 return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3093 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) {
3094 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3095 LDKPublicKey their_node_id_ref;
3096 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3097 LDKAnnouncementSignatures msg_conv;
3098 msg_conv.inner = (void*)(msg & (~1));
3099 msg_conv.is_owned = (msg & 1) || (msg == 0);
3100 return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3103 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) {
3104 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3105 LDKPublicKey their_node_id_ref;
3106 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3107 return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3111 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3112 LDKPublicKey their_node_id_ref;
3113 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3115 msg_conv.inner = (void*)(msg & (~1));
3116 msg_conv.is_owned = (msg & 1) || (msg == 0);
3117 return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3120 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) {
3121 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3122 LDKPublicKey their_node_id_ref;
3123 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3124 LDKChannelReestablish msg_conv;
3125 msg_conv.inner = (void*)(msg & (~1));
3126 msg_conv.is_owned = (msg & 1) || (msg == 0);
3127 return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3131 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3132 LDKPublicKey their_node_id_ref;
3133 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3134 LDKErrorMessage msg_conv;
3135 msg_conv.inner = (void*)(msg & (~1));
3136 msg_conv.is_owned = (msg & 1) || (msg == 0);
3137 return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3140 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3141 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3142 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3143 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3144 for (size_t i = 0; i < vec->datalen; i++) {
3145 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3146 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3148 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3152 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3153 ret->datalen = (*env)->GetArrayLength(env, elems);
3154 if (ret->datalen == 0) {
3157 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3158 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3159 for (size_t i = 0; i < ret->datalen; i++) {
3160 jlong arr_elem = java_elems[i];
3161 LDKChannelMonitor arr_elem_conv;
3162 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3163 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3164 ret->data[i] = arr_elem_conv;
3166 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3170 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3171 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3172 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3175 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3176 ret->datalen = (*env)->GetArrayLength(env, elems);
3177 if (ret->datalen == 0) {
3180 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3181 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3182 for (size_t i = 0; i < ret->datalen; i++) {
3183 ret->data[i] = java_elems[i];
3185 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3189 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3190 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3191 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3192 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3193 for (size_t i = 0; i < vec->datalen; i++) {
3194 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3195 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3197 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3200 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3201 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3202 ret->datalen = (*env)->GetArrayLength(env, elems);
3203 if (ret->datalen == 0) {
3206 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3207 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3208 for (size_t i = 0; i < ret->datalen; i++) {
3209 jlong arr_elem = java_elems[i];
3210 LDKUpdateAddHTLC arr_elem_conv;
3211 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3212 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3213 ret->data[i] = arr_elem_conv;
3215 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3219 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3220 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3221 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3222 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3223 for (size_t i = 0; i < vec->datalen; i++) {
3224 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3225 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3227 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3231 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3232 ret->datalen = (*env)->GetArrayLength(env, elems);
3233 if (ret->datalen == 0) {
3236 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3237 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3238 for (size_t i = 0; i < ret->datalen; i++) {
3239 jlong arr_elem = java_elems[i];
3240 LDKUpdateFulfillHTLC arr_elem_conv;
3241 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3242 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3243 ret->data[i] = arr_elem_conv;
3245 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3249 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3250 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3251 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3252 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3253 for (size_t i = 0; i < vec->datalen; i++) {
3254 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3255 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3257 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3261 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3262 ret->datalen = (*env)->GetArrayLength(env, elems);
3263 if (ret->datalen == 0) {
3266 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3267 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3268 for (size_t i = 0; i < ret->datalen; i++) {
3269 jlong arr_elem = java_elems[i];
3270 LDKUpdateFailHTLC arr_elem_conv;
3271 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3272 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3273 ret->data[i] = arr_elem_conv;
3275 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3279 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3280 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3281 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3282 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3283 for (size_t i = 0; i < vec->datalen; i++) {
3284 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3285 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3287 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3291 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3292 ret->datalen = (*env)->GetArrayLength(env, elems);
3293 if (ret->datalen == 0) {
3296 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3297 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3298 for (size_t i = 0; i < ret->datalen; i++) {
3299 jlong arr_elem = java_elems[i];
3300 LDKUpdateFailMalformedHTLC arr_elem_conv;
3301 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3302 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3303 ret->data[i] = arr_elem_conv;
3305 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3310 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3313 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3314 if (val->result_ok) {
3315 return (long)val->contents.result;
3317 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3320 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3321 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3322 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3325 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3326 ret->datalen = (*env)->GetArrayLength(env, elems);
3327 if (ret->datalen == 0) {
3330 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3331 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3332 for (size_t i = 0; i < ret->datalen; i++) {
3333 jlong arr_elem = java_elems[i];
3334 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3335 FREE((void*)arr_elem);
3336 ret->data[i] = arr_elem_conv;
3338 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3342 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3343 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3344 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3345 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3346 for (size_t i = 0; i < vec->datalen; i++) {
3347 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3348 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3350 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3353 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3354 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3355 ret->datalen = (*env)->GetArrayLength(env, elems);
3356 if (ret->datalen == 0) {
3359 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3360 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3361 for (size_t i = 0; i < ret->datalen; i++) {
3362 jlong arr_elem = java_elems[i];
3363 LDKNodeAnnouncement arr_elem_conv;
3364 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3365 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3366 ret->data[i] = arr_elem_conv;
3368 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3372 typedef struct LDKRoutingMessageHandler_JCalls {
3373 atomic_size_t refcnt;
3376 jmethodID handle_node_announcement_meth;
3377 jmethodID handle_channel_announcement_meth;
3378 jmethodID handle_channel_update_meth;
3379 jmethodID handle_htlc_fail_channel_update_meth;
3380 jmethodID get_next_channel_announcements_meth;
3381 jmethodID get_next_node_announcements_meth;
3382 jmethodID should_request_full_sync_meth;
3383 } LDKRoutingMessageHandler_JCalls;
3384 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3385 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3387 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3388 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_node_announcement_meth, msg);
3389 LDKCResult_boolLightningErrorZ res = *ret;
3393 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3394 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3396 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3397 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_announcement_meth, msg);
3398 LDKCResult_boolLightningErrorZ res = *ret;
3402 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3403 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3405 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3406 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_update_meth, msg);
3407 LDKCResult_boolLightningErrorZ res = *ret;
3411 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3412 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3414 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3415 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_htlc_fail_channel_update_meth, update);
3417 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3418 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3420 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3421 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3422 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3426 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3427 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3429 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3430 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3431 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3432 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3433 LDKCVec_NodeAnnouncementZ res = *ret;
3437 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3438 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3440 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3441 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3442 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3443 return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->should_request_full_sync_meth, node_id_arr);
3445 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3446 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3447 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3449 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3450 (*env)->DeleteGlobalRef(env, j_calls->o);
3454 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3455 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3456 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3457 return (void*) this_arg;
3459 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3460 jclass c = (*env)->GetObjectClass(env, o);
3461 DO_ASSERT(c != NULL);
3462 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3463 atomic_init(&calls->refcnt, 1);
3464 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3465 calls->o = (*env)->NewGlobalRef(env, o);
3466 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3467 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3468 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3469 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3470 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3471 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3472 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3473 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3474 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3475 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3476 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3477 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3478 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3479 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3481 LDKRoutingMessageHandler ret = {
3482 .this_arg = (void*) calls,
3483 .handle_node_announcement = handle_node_announcement_jcall,
3484 .handle_channel_announcement = handle_channel_announcement_jcall,
3485 .handle_channel_update = handle_channel_update_jcall,
3486 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3487 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3488 .get_next_node_announcements = get_next_node_announcements_jcall,
3489 .should_request_full_sync = should_request_full_sync_jcall,
3490 .free = LDKRoutingMessageHandler_JCalls_free,
3494 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3495 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3496 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3497 return (long)res_ptr;
3499 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3500 return ((LDKRoutingMessageHandler_JCalls*)val)->o;
3502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3503 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3504 LDKNodeAnnouncement msg_conv;
3505 msg_conv.inner = (void*)(msg & (~1));
3506 msg_conv.is_owned = (msg & 1) || (msg == 0);
3507 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3508 *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, &msg_conv);
3512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3513 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3514 LDKChannelAnnouncement msg_conv;
3515 msg_conv.inner = (void*)(msg & (~1));
3516 msg_conv.is_owned = (msg & 1) || (msg == 0);
3517 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3518 *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, &msg_conv);
3522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3523 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3524 LDKChannelUpdate msg_conv;
3525 msg_conv.inner = (void*)(msg & (~1));
3526 msg_conv.is_owned = (msg & 1) || (msg == 0);
3527 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3528 *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, &msg_conv);
3532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) {
3533 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3534 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3535 return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv);
3538 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) {
3539 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3540 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3541 *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount);
3545 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) {
3546 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3547 LDKPublicKey starting_point_ref;
3548 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3549 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3550 *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_ref, batch_amount);
3554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jbyteArray node_id) {
3555 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3556 LDKPublicKey node_id_ref;
3557 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3558 return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_ref);
3561 typedef struct LDKSocketDescriptor_JCalls {
3562 atomic_size_t refcnt;
3565 jmethodID send_data_meth;
3566 jmethodID disconnect_socket_meth;
3568 jmethodID hash_meth;
3569 } LDKSocketDescriptor_JCalls;
3570 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3571 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3573 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3574 long data_ref = (long)&data;
3575 return (*env)->CallLongMethod(env, j_calls->o, j_calls->send_data_meth, data_ref, resume_read);
3577 void disconnect_socket_jcall(void* this_arg) {
3578 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3580 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3581 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->disconnect_socket_meth);
3583 bool eq_jcall(const void* this_arg, const void *other_arg) {
3584 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3586 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3587 return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->eq_meth, other_arg);
3589 uint64_t hash_jcall(const void* this_arg) {
3590 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3592 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3593 return (*env)->CallLongMethod(env, j_calls->o, j_calls->hash_meth);
3595 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3596 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3597 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3599 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3600 (*env)->DeleteGlobalRef(env, j_calls->o);
3604 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3605 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3606 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3607 return (void*) this_arg;
3609 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3610 jclass c = (*env)->GetObjectClass(env, o);
3611 DO_ASSERT(c != NULL);
3612 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3613 atomic_init(&calls->refcnt, 1);
3614 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3615 calls->o = (*env)->NewGlobalRef(env, o);
3616 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3617 DO_ASSERT(calls->send_data_meth != NULL);
3618 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3619 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3620 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3621 DO_ASSERT(calls->eq_meth != NULL);
3622 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3623 DO_ASSERT(calls->hash_meth != NULL);
3625 LDKSocketDescriptor ret = {
3626 .this_arg = (void*) calls,
3627 .send_data = send_data_jcall,
3628 .disconnect_socket = disconnect_socket_jcall,
3631 .clone = LDKSocketDescriptor_JCalls_clone,
3632 .free = LDKSocketDescriptor_JCalls_free,
3636 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3637 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3638 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3639 return (long)res_ptr;
3641 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3642 return ((LDKSocketDescriptor_JCalls*)val)->o;
3644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) {
3645 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3646 LDKu8slice data_conv = *(LDKu8slice*)data;
3647 return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read);
3650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) {
3651 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3652 return (arg_conv->disconnect_socket)(arg_conv->this_arg);
3655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) {
3656 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3657 return (arg_conv->hash)(arg_conv->this_arg);
3660 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3661 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3662 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3665 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3668 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3669 if (val->result_ok) {
3670 return (long)val->contents.result;
3672 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3676 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3679 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3680 if (val->result_ok) {
3681 return (long)val->contents.result;
3683 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3687 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3690 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3691 if (val->result_ok) {
3692 return (long)val->contents.result;
3694 return (long)val->contents.err;
3697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3698 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3701 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3702 if (val->result_ok) {
3703 return (long)val->contents.result;
3705 return (long)val->contents.err;
3708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3709 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3712 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3713 if (val->result_ok) {
3714 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3716 return (long)val->contents.err;
3719 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3720 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3721 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3724 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3725 ret->datalen = (*env)->GetArrayLength(env, elems);
3726 if (ret->datalen == 0) {
3729 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3730 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3731 for (size_t i = 0; i < ret->datalen; i++) {
3732 jlong arr_elem = java_elems[i];
3733 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3734 FREE((void*)arr_elem);
3735 ret->data[i] = arr_elem_conv;
3737 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3741 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3742 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3743 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3744 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3745 for (size_t i = 0; i < vec->datalen; i++) {
3746 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3747 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3749 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3753 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3754 ret->datalen = (*env)->GetArrayLength(env, elems);
3755 if (ret->datalen == 0) {
3758 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3759 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3760 for (size_t i = 0; i < ret->datalen; i++) {
3761 jlong arr_elem = java_elems[i];
3762 LDKRouteHop arr_elem_conv;
3763 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3764 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3765 ret->data[i] = arr_elem_conv;
3767 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3771 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3772 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3773 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3776 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3777 ret->datalen = (*env)->GetArrayLength(env, elems);
3778 if (ret->datalen == 0) {
3781 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3782 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3783 for (size_t i = 0; i < ret->datalen; i++) {
3784 jlong arr_elem = java_elems[i];
3785 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3786 FREE((void*)arr_elem);
3787 ret->data[i] = arr_elem_conv;
3789 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3793 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3794 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3797 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3798 if (val->result_ok) {
3799 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3801 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3804 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3805 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3806 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3807 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3808 for (size_t i = 0; i < vec->datalen; i++) {
3809 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3810 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3812 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3816 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3817 ret->datalen = (*env)->GetArrayLength(env, elems);
3818 if (ret->datalen == 0) {
3821 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
3822 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3823 for (size_t i = 0; i < ret->datalen; i++) {
3824 jlong arr_elem = java_elems[i];
3825 LDKRouteHint arr_elem_conv;
3826 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3827 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3828 ret->data[i] = arr_elem_conv;
3830 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3835 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
3837 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
3840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3841 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
3843 return C2Tuple_OutPointScriptZ_free(arg_conv);
3846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3847 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
3849 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
3852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3853 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
3855 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
3858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
3859 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
3861 return C2Tuple_u64u64Z_free(arg_conv);
3864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3865 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
3867 return C2Tuple_usizeTransactionZ_free(arg_conv);
3870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3871 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
3873 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
3876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3877 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
3879 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
3882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3883 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
3885 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3886 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
3890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3891 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
3893 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
3896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3897 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
3899 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
3900 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
3904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3905 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
3907 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
3908 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
3912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3913 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3915 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
3918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3919 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
3921 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
3922 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
3926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3927 LDKAPIError arg_conv = *(LDKAPIError*)arg;
3929 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3930 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
3934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3935 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
3937 return CResult_NoneAPIErrorZ_free(arg_conv);
3940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
3941 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
3943 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3944 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
3948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3949 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
3951 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
3954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3955 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
3957 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3958 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
3962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3963 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
3965 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
3968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3969 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
3971 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
3972 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
3976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3977 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
3979 return CResult_NonePaymentSendFailureZ_free(arg_conv);
3982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3983 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
3985 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
3986 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
3990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3991 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
3993 return CResult_NonePeerHandleErrorZ_free(arg_conv);
3996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
3997 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
3999 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4000 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4005 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4007 return CResult_PublicKeySecpErrorZ_free(arg_conv);
4010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4011 LDKPublicKey arg_ref;
4012 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4013 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4014 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4019 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4021 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4022 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4027 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4029 return CResult_RouteLightningErrorZ_free(arg_conv);
4032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4033 LDKRoute arg_conv = *(LDKRoute*)arg;
4035 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4036 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4041 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4043 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4044 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4049 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4051 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4055 LDKSecretKey arg_conv = *(LDKSecretKey*)arg;
4057 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4058 *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv);
4062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4063 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4065 return CResult_SignatureNoneZ_free(arg_conv);
4068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4069 LDKSignature arg_conv = *(LDKSignature*)arg;
4071 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4072 *ret = CResult_SignatureNoneZ_ok(arg_conv);
4076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4077 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4079 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4080 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4085 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4087 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4091 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4093 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4094 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4099 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4101 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4102 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4107 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4109 return CResult_TxOutAccessErrorZ_free(arg_conv);
4112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4113 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4115 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4116 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4121 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4123 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4124 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4129 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4131 return CResult_boolLightningErrorZ_free(arg_conv);
4134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4135 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4136 *ret = CResult_boolLightningErrorZ_ok(arg);
4140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4141 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4143 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4144 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4149 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4151 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4155 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4156 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4161 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4163 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4167 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4169 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4173 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4175 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4179 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4181 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4185 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4187 return CVec_CVec_RouteHopZZ_free(arg_conv);
4190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4191 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4193 return CVec_ChannelDetailsZ_free(arg_conv);
4196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4197 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4199 return CVec_ChannelMonitorZ_free(arg_conv);
4202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4203 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4205 return CVec_EventZ_free(arg_conv);
4208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4209 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4211 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4215 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4217 return CVec_MessageSendEventZ_free(arg_conv);
4220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4221 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4223 return CVec_MonitorEventZ_free(arg_conv);
4226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4227 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4229 return CVec_NetAddressZ_free(arg_conv);
4232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4233 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4235 return CVec_NodeAnnouncementZ_free(arg_conv);
4238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4239 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4241 return CVec_PublicKeyZ_free(arg_conv);
4244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4245 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4247 return CVec_RouteHintZ_free(arg_conv);
4250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4251 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4253 return CVec_RouteHopZ_free(arg_conv);
4256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4257 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4259 return CVec_SignatureZ_free(arg_conv);
4262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4263 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4265 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4269 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4271 return CVec_TransactionZ_free(arg_conv);
4274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4275 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4277 return CVec_TxOutZ_free(arg_conv);
4280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4281 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4283 return CVec_UpdateAddHTLCZ_free(arg_conv);
4286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4287 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4289 return CVec_UpdateFailHTLCZ_free(arg_conv);
4292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4293 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4295 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4299 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4301 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4305 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4307 return CVec_u64Z_free(arg_conv);
4310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4311 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4313 return CVec_u8Z_free(arg_conv);
4316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4317 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4319 return Transaction_free(_res_conv);
4322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4323 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4325 return TxOut_free(_res_conv);
4328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4329 LDKTransaction b_conv = *(LDKTransaction*)b;
4331 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4332 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4337 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4338 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4343 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4344 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4350 a_conv.inner = (void*)(a & (~1));
4351 a_conv.is_owned = (a & 1) || (a == 0);
4352 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4354 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4355 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4360 LDKThirtyTwoBytes a_ref;
4361 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4362 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4364 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4365 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4370 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4371 *ret = C2Tuple_u64u64Z_new(a, b);
4375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4376 LDKSignature a_conv = *(LDKSignature*)a;
4378 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4380 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4381 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
4385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4386 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4387 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4392 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4393 *ret = CResult_SignatureNoneZ_err();
4397 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4398 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4399 *ret = CResult_CVec_SignatureZNoneZ_err();
4403 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4404 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4405 *ret = CResult_NoneAPIErrorZ_ok();
4409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4410 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4411 *ret = CResult_NonePaymentSendFailureZ_ok();
4415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4416 LDKChannelAnnouncement a_conv;
4417 a_conv.inner = (void*)(a & (~1));
4418 a_conv.is_owned = (a & 1) || (a == 0);
4419 LDKChannelUpdate b_conv;
4420 b_conv.inner = (void*)(b & (~1));
4421 b_conv.is_owned = (b & 1) || (b == 0);
4422 LDKChannelUpdate c_conv;
4423 c_conv.inner = (void*)(c & (~1));
4424 c_conv.is_owned = (c & 1) || (c == 0);
4425 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4426 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4431 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4432 *ret = CResult_NonePeerHandleErrorZ_ok();
4436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4437 LDKHTLCOutputInCommitment a_conv;
4438 a_conv.inner = (void*)(a & (~1));
4439 a_conv.is_owned = (a & 1) || (a == 0);
4440 LDKSignature b_conv = *(LDKSignature*)b;
4442 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4443 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
4447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4448 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4449 FREE((void*)this_ptr);
4450 return Event_free(this_ptr_conv);
4453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4454 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4455 FREE((void*)this_ptr);
4456 return MessageSendEvent_free(this_ptr_conv);
4459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4460 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4461 FREE((void*)this_ptr);
4462 return MessageSendEventsProvider_free(this_ptr_conv);
4465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4466 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4467 FREE((void*)this_ptr);
4468 return EventsProvider_free(this_ptr_conv);
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4472 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4473 FREE((void*)this_ptr);
4474 return APIError_free(this_ptr_conv);
4477 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4478 jclass ret = LDKLevel_to_java(_env, Level_max());
4482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4483 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4484 FREE((void*)this_ptr);
4485 return Logger_free(this_ptr_conv);
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4489 LDKChannelHandshakeConfig this_ptr_conv;
4490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4492 return ChannelHandshakeConfig_free(this_ptr_conv);
4495 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4496 LDKChannelHandshakeConfig this_ptr_conv;
4497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4499 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4503 LDKChannelHandshakeConfig this_ptr_conv;
4504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4506 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4509 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4510 LDKChannelHandshakeConfig this_ptr_conv;
4511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4513 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4517 LDKChannelHandshakeConfig this_ptr_conv;
4518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4520 return ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4524 LDKChannelHandshakeConfig this_ptr_conv;
4525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4527 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4531 LDKChannelHandshakeConfig this_ptr_conv;
4532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4534 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4537 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) {
4538 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4539 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4543 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4544 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4548 LDKChannelHandshakeLimits this_ptr_conv;
4549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4551 return ChannelHandshakeLimits_free(this_ptr_conv);
4554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4555 LDKChannelHandshakeLimits this_ptr_conv;
4556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4558 return ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4562 LDKChannelHandshakeLimits this_ptr_conv;
4563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4565 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4569 LDKChannelHandshakeLimits this_ptr_conv;
4570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4572 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4576 LDKChannelHandshakeLimits this_ptr_conv;
4577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4579 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4583 LDKChannelHandshakeLimits this_ptr_conv;
4584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4586 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4589 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) {
4590 LDKChannelHandshakeLimits this_ptr_conv;
4591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4593 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4597 LDKChannelHandshakeLimits this_ptr_conv;
4598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4600 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4604 LDKChannelHandshakeLimits this_ptr_conv;
4605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4607 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4610 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4611 LDKChannelHandshakeLimits this_ptr_conv;
4612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4614 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4618 LDKChannelHandshakeLimits this_ptr_conv;
4619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4621 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4625 LDKChannelHandshakeLimits this_ptr_conv;
4626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4628 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4632 LDKChannelHandshakeLimits this_ptr_conv;
4633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4635 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4639 LDKChannelHandshakeLimits this_ptr_conv;
4640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4642 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4646 LDKChannelHandshakeLimits this_ptr_conv;
4647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4649 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4652 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4653 LDKChannelHandshakeLimits this_ptr_conv;
4654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4656 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4660 LDKChannelHandshakeLimits this_ptr_conv;
4661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4663 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4667 LDKChannelHandshakeLimits this_ptr_conv;
4668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4670 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4674 LDKChannelHandshakeLimits this_ptr_conv;
4675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4677 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4680 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4681 LDKChannelHandshakeLimits this_ptr_conv;
4682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4684 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4688 LDKChannelHandshakeLimits this_ptr_conv;
4689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4691 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4694 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) {
4695 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);
4696 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4700 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4701 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4705 LDKChannelConfig this_ptr_conv;
4706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4708 return ChannelConfig_free(this_ptr_conv);
4711 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4712 LDKChannelConfig this_ptr_conv;
4713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4715 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4719 LDKChannelConfig this_ptr_conv;
4720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4722 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4726 LDKChannelConfig this_ptr_conv;
4727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4729 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4733 LDKChannelConfig this_ptr_conv;
4734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4736 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4740 LDKChannelConfig this_ptr_conv;
4741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4743 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4747 LDKChannelConfig this_ptr_conv;
4748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4750 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4753 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) {
4754 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4755 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4759 LDKChannelConfig ret = ChannelConfig_default();
4760 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4764 LDKChannelConfig obj_conv;
4765 obj_conv.inner = (void*)(obj & (~1));
4766 obj_conv.is_owned = (obj & 1) || (obj == 0);
4767 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4768 *ret = ChannelConfig_write(&obj_conv);
4772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4773 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4774 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4775 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4779 LDKUserConfig this_ptr_conv;
4780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4782 return UserConfig_free(this_ptr_conv);
4785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4786 LDKUserConfig this_ptr_conv;
4787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4789 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
4790 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4794 LDKUserConfig 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 LDKChannelHandshakeConfig val_conv;
4798 val_conv.inner = (void*)(val & (~1));
4799 val_conv.is_owned = (val & 1) || (val == 0);
4800 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
4803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
4804 LDKUserConfig this_ptr_conv;
4805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4807 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
4808 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4812 LDKUserConfig this_ptr_conv;
4813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4815 LDKChannelHandshakeLimits val_conv;
4816 val_conv.inner = (void*)(val & (~1));
4817 val_conv.is_owned = (val & 1) || (val == 0);
4818 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
4821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
4822 LDKUserConfig 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 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
4826 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4830 LDKUserConfig this_ptr_conv;
4831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4833 LDKChannelConfig val_conv;
4834 val_conv.inner = (void*)(val & (~1));
4835 val_conv.is_owned = (val & 1) || (val == 0);
4836 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
4839 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) {
4840 LDKChannelHandshakeConfig own_channel_config_arg_conv;
4841 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
4842 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
4843 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
4844 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
4845 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
4846 LDKChannelConfig channel_options_arg_conv;
4847 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
4848 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
4849 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
4850 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
4854 LDKUserConfig ret = UserConfig_default();
4855 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4859 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
4860 FREE((void*)this_ptr);
4861 return Access_free(this_ptr_conv);
4864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4865 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
4866 FREE((void*)this_ptr);
4867 return Watch_free(this_ptr_conv);
4870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4871 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
4872 FREE((void*)this_ptr);
4873 return Filter_free(this_ptr_conv);
4876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4877 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
4878 FREE((void*)this_ptr);
4879 return BroadcasterInterface_free(this_ptr_conv);
4882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4883 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
4884 FREE((void*)this_ptr);
4885 return FeeEstimator_free(this_ptr_conv);
4888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4889 LDKChainMonitor this_ptr_conv;
4890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4892 return ChainMonitor_free(this_ptr_conv);
4895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
4896 LDKChainMonitor this_arg_conv;
4897 this_arg_conv.inner = (void*)(this_arg & (~1));
4898 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4899 unsigned char header_arr[80];
4900 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4901 unsigned char (*header_ref)[80] = &header_arr;
4902 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
4903 FREE((void*)txdata);
4904 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
4907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
4908 LDKChainMonitor this_arg_conv;
4909 this_arg_conv.inner = (void*)(this_arg & (~1));
4910 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4911 unsigned char header_arr[80];
4912 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4913 unsigned char (*header_ref)[80] = &header_arr;
4914 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
4917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
4918 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
4919 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
4920 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
4921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4922 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
4924 LDKLogger logger_conv = *(LDKLogger*)logger;
4925 if (logger_conv.free == LDKLogger_JCalls_free) {
4926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4927 LDKLogger_JCalls_clone(logger_conv.this_arg);
4929 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
4930 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
4931 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4932 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
4934 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
4935 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
4939 LDKChainMonitor this_arg_conv;
4940 this_arg_conv.inner = (void*)(this_arg & (~1));
4941 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4942 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
4943 *ret = ChainMonitor_as_Watch(&this_arg_conv);
4947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
4948 LDKChainMonitor this_arg_conv;
4949 this_arg_conv.inner = (void*)(this_arg & (~1));
4950 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4951 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4952 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
4956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4957 LDKChannelMonitorUpdate this_ptr_conv;
4958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4960 return ChannelMonitorUpdate_free(this_ptr_conv);
4963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4964 LDKChannelMonitorUpdate this_ptr_conv;
4965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4967 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
4970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4971 LDKChannelMonitorUpdate this_ptr_conv;
4972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4974 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
4977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
4978 LDKChannelMonitorUpdate obj_conv;
4979 obj_conv.inner = (void*)(obj & (~1));
4980 obj_conv.is_owned = (obj & 1) || (obj == 0);
4981 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4982 *ret = ChannelMonitorUpdate_write(&obj_conv);
4986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
4987 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4988 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
4989 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4993 LDKMonitorUpdateError this_ptr_conv;
4994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4996 return MonitorUpdateError_free(this_ptr_conv);
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5000 LDKMonitorEvent this_ptr_conv;
5001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5003 return MonitorEvent_free(this_ptr_conv);
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5007 LDKHTLCUpdate this_ptr_conv;
5008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5010 return HTLCUpdate_free(this_ptr_conv);
5013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5014 LDKHTLCUpdate obj_conv;
5015 obj_conv.inner = (void*)(obj & (~1));
5016 obj_conv.is_owned = (obj & 1) || (obj == 0);
5017 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5018 *ret = HTLCUpdate_write(&obj_conv);
5022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5023 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5024 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5025 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5029 LDKChannelMonitor this_ptr_conv;
5030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5032 return ChannelMonitor_free(this_ptr_conv);
5035 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5036 LDKChannelMonitor this_arg_conv;
5037 this_arg_conv.inner = (void*)(this_arg & (~1));
5038 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5039 LDKChannelMonitorUpdate updates_conv;
5040 updates_conv.inner = (void*)(updates & (~1));
5041 updates_conv.is_owned = (updates & 1) || (updates == 0);
5042 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5043 LDKLogger* logger_conv = (LDKLogger*)logger;
5044 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5045 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5050 LDKChannelMonitor this_arg_conv;
5051 this_arg_conv.inner = (void*)(this_arg & (~1));
5052 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5053 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5057 LDKChannelMonitor this_arg_conv;
5058 this_arg_conv.inner = (void*)(this_arg & (~1));
5059 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5060 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5061 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5066 LDKChannelMonitor this_arg_conv;
5067 this_arg_conv.inner = (void*)(this_arg & (~1));
5068 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5069 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5070 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5075 LDKChannelMonitor this_arg_conv;
5076 this_arg_conv.inner = (void*)(this_arg & (~1));
5077 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5078 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5079 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5084 LDKChannelMonitor this_arg_conv;
5085 this_arg_conv.inner = (void*)(this_arg & (~1));
5086 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5087 LDKLogger* logger_conv = (LDKLogger*)logger;
5088 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5089 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5093 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) {
5094 LDKChannelMonitor this_arg_conv;
5095 this_arg_conv.inner = (void*)(this_arg & (~1));
5096 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5097 unsigned char header_arr[80];
5098 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5099 unsigned char (*header_ref)[80] = &header_arr;
5100 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5101 FREE((void*)txdata);
5102 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5103 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5104 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5105 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5107 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5108 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5109 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5110 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5112 LDKLogger logger_conv = *(LDKLogger*)logger;
5113 if (logger_conv.free == LDKLogger_JCalls_free) {
5114 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5115 LDKLogger_JCalls_clone(logger_conv.this_arg);
5117 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5118 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5122 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) {
5123 LDKChannelMonitor this_arg_conv;
5124 this_arg_conv.inner = (void*)(this_arg & (~1));
5125 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5126 unsigned char header_arr[80];
5127 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5128 unsigned char (*header_ref)[80] = &header_arr;
5129 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5130 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5131 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5132 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5134 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5135 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5136 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5137 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5139 LDKLogger logger_conv = *(LDKLogger*)logger;
5140 if (logger_conv.free == LDKLogger_JCalls_free) {
5141 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5142 LDKLogger_JCalls_clone(logger_conv.this_arg);
5144 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5148 LDKOutPoint 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 OutPoint_free(this_ptr_conv);
5154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5155 LDKOutPoint 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5159 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5164 LDKOutPoint this_ptr_conv;
5165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5167 LDKThirtyTwoBytes val_ref;
5168 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5169 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5172 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5173 LDKOutPoint this_ptr_conv;
5174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5176 return OutPoint_get_index(&this_ptr_conv);
5179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5180 LDKOutPoint this_ptr_conv;
5181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5183 return OutPoint_set_index(&this_ptr_conv, val);
5186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5187 LDKThirtyTwoBytes txid_arg_ref;
5188 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5189 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5190 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5194 LDKOutPoint this_arg_conv;
5195 this_arg_conv.inner = (void*)(this_arg & (~1));
5196 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5197 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5198 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5203 LDKOutPoint obj_conv;
5204 obj_conv.inner = (void*)(obj & (~1));
5205 obj_conv.is_owned = (obj & 1) || (obj == 0);
5206 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5207 *ret = OutPoint_write(&obj_conv);
5211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5212 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5213 LDKOutPoint ret = OutPoint_read(ser_conv);
5214 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5218 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5219 FREE((void*)this_ptr);
5220 return SpendableOutputDescriptor_free(this_ptr_conv);
5223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5224 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5225 FREE((void*)this_ptr);
5226 return ChannelKeys_free(this_ptr_conv);
5229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5230 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5231 FREE((void*)this_ptr);
5232 return KeysInterface_free(this_ptr_conv);
5235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5236 LDKInMemoryChannelKeys this_ptr_conv;
5237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5239 return InMemoryChannelKeys_free(this_ptr_conv);
5242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5243 LDKInMemoryChannelKeys this_ptr_conv;
5244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5246 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5247 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5252 LDKInMemoryChannelKeys this_ptr_conv;
5253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5255 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5257 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_conv);
5260 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5261 LDKInMemoryChannelKeys this_ptr_conv;
5262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5264 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5265 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5270 LDKInMemoryChannelKeys this_ptr_conv;
5271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5273 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5275 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_conv);
5278 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5279 LDKInMemoryChannelKeys this_ptr_conv;
5280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5282 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5283 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5288 LDKInMemoryChannelKeys this_ptr_conv;
5289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5291 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5293 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_conv);
5296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5297 LDKInMemoryChannelKeys this_ptr_conv;
5298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5300 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5301 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5306 LDKInMemoryChannelKeys this_ptr_conv;
5307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5309 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5311 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_conv);
5314 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5315 LDKInMemoryChannelKeys this_ptr_conv;
5316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5318 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5319 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5324 LDKInMemoryChannelKeys this_ptr_conv;
5325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5327 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5329 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_conv);
5332 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5333 LDKInMemoryChannelKeys this_ptr_conv;
5334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5336 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5337 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5342 LDKInMemoryChannelKeys this_ptr_conv;
5343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5345 LDKThirtyTwoBytes val_ref;
5346 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5347 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5350 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) {
5351 LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
5352 FREE((void*)funding_key);
5353 LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
5354 FREE((void*)revocation_base_key);
5355 LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
5356 FREE((void*)payment_key);
5357 LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
5358 FREE((void*)delayed_payment_base_key);
5359 LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
5360 FREE((void*)htlc_base_key);
5361 LDKThirtyTwoBytes commitment_seed_ref;
5362 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5363 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5364 FREE((void*)key_derivation_params);
5365 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);
5366 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5370 LDKInMemoryChannelKeys this_arg_conv;
5371 this_arg_conv.inner = (void*)(this_arg & (~1));
5372 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5373 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5374 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5377 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5378 LDKInMemoryChannelKeys this_arg_conv;
5379 this_arg_conv.inner = (void*)(this_arg & (~1));
5380 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5381 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5384 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5385 LDKInMemoryChannelKeys this_arg_conv;
5386 this_arg_conv.inner = (void*)(this_arg & (~1));
5387 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5388 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5392 LDKInMemoryChannelKeys this_arg_conv;
5393 this_arg_conv.inner = (void*)(this_arg & (~1));
5394 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5395 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5396 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5401 LDKInMemoryChannelKeys obj_conv;
5402 obj_conv.inner = (void*)(obj & (~1));
5403 obj_conv.is_owned = (obj & 1) || (obj == 0);
5404 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5405 *ret = InMemoryChannelKeys_write(&obj_conv);
5409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5410 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5411 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5412 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5416 LDKKeysManager this_ptr_conv;
5417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5419 return KeysManager_free(this_ptr_conv);
5422 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) {
5423 unsigned char seed_arr[32];
5424 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5425 unsigned char (*seed_ref)[32] = &seed_arr;
5426 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5427 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5428 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5431 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) {
5432 LDKKeysManager this_arg_conv;
5433 this_arg_conv.inner = (void*)(this_arg & (~1));
5434 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5435 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5436 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5440 LDKKeysManager this_arg_conv;
5441 this_arg_conv.inner = (void*)(this_arg & (~1));
5442 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5443 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5444 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5449 LDKChannelManager this_ptr_conv;
5450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5452 return ChannelManager_free(this_ptr_conv);
5455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5456 LDKChannelDetails this_ptr_conv;
5457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5459 return ChannelDetails_free(this_ptr_conv);
5462 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5463 LDKChannelDetails 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, *ChannelDetails_get_channel_id(&this_ptr_conv));
5471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5472 LDKChannelDetails 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 LDKThirtyTwoBytes val_ref;
5476 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5477 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5481 LDKChannelDetails 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 arg_arr = (*_env)->NewByteArray(_env, 33);
5485 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5490 LDKChannelDetails 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 LDKPublicKey val_ref;
5494 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5495 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5499 LDKChannelDetails this_ptr_conv;
5500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5502 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5503 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5507 LDKChannelDetails this_ptr_conv;
5508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5510 LDKInitFeatures val_conv;
5511 val_conv.inner = (void*)(val & (~1));
5512 val_conv.is_owned = (val & 1) || (val == 0);
5513 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5517 LDKChannelDetails this_ptr_conv;
5518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5520 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5524 LDKChannelDetails this_ptr_conv;
5525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5527 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5531 LDKChannelDetails this_ptr_conv;
5532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5534 return ChannelDetails_get_user_id(&this_ptr_conv);
5537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5538 LDKChannelDetails this_ptr_conv;
5539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5541 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5545 LDKChannelDetails this_ptr_conv;
5546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5548 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5552 LDKChannelDetails this_ptr_conv;
5553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5555 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5559 LDKChannelDetails this_ptr_conv;
5560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5562 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5566 LDKChannelDetails this_ptr_conv;
5567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5569 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5573 LDKChannelDetails this_ptr_conv;
5574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5576 return ChannelDetails_get_is_live(&this_ptr_conv);
5579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5580 LDKChannelDetails this_ptr_conv;
5581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5583 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5587 LDKPaymentSendFailure this_ptr_conv;
5588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5590 return PaymentSendFailure_free(this_ptr_conv);
5593 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) {
5594 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5595 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5596 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5598 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5600 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5601 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5602 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5603 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5605 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5606 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5608 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5610 LDKLogger logger_conv = *(LDKLogger*)logger;
5611 if (logger_conv.free == LDKLogger_JCalls_free) {
5612 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5613 LDKLogger_JCalls_clone(logger_conv.this_arg);
5615 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5616 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5617 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5618 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5620 LDKUserConfig config_conv;
5621 config_conv.inner = (void*)(config & (~1));
5622 config_conv.is_owned = (config & 1) || (config == 0);
5623 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);
5624 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5627 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) {
5628 LDKChannelManager this_arg_conv;
5629 this_arg_conv.inner = (void*)(this_arg & (~1));
5630 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5631 LDKPublicKey their_network_key_ref;
5632 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
5633 LDKUserConfig override_config_conv;
5634 override_config_conv.inner = (void*)(override_config & (~1));
5635 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5636 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5637 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
5641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5642 LDKChannelManager this_arg_conv;
5643 this_arg_conv.inner = (void*)(this_arg & (~1));
5644 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5645 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5646 *ret = ChannelManager_list_channels(&this_arg_conv);
5650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5651 LDKChannelManager this_arg_conv;
5652 this_arg_conv.inner = (void*)(this_arg & (~1));
5653 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5654 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5655 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5660 LDKChannelManager this_arg_conv;
5661 this_arg_conv.inner = (void*)(this_arg & (~1));
5662 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5663 unsigned char channel_id_arr[32];
5664 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5665 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5666 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5667 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5672 LDKChannelManager this_arg_conv;
5673 this_arg_conv.inner = (void*)(this_arg & (~1));
5674 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5675 unsigned char channel_id_arr[32];
5676 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5677 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5678 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5682 LDKChannelManager this_arg_conv;
5683 this_arg_conv.inner = (void*)(this_arg & (~1));
5684 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5685 return ChannelManager_force_close_all_channels(&this_arg_conv);
5688 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) {
5689 LDKChannelManager this_arg_conv;
5690 this_arg_conv.inner = (void*)(this_arg & (~1));
5691 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5692 LDKRoute route_conv;
5693 route_conv.inner = (void*)(route & (~1));
5694 route_conv.is_owned = (route & 1) || (route == 0);
5695 LDKThirtyTwoBytes payment_hash_ref;
5696 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
5697 LDKThirtyTwoBytes payment_secret_ref;
5698 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5699 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5700 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
5704 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) {
5705 LDKChannelManager this_arg_conv;
5706 this_arg_conv.inner = (void*)(this_arg & (~1));
5707 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5708 unsigned char temporary_channel_id_arr[32];
5709 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
5710 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
5711 LDKOutPoint funding_txo_conv;
5712 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5713 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5714 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
5717 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) {
5718 LDKChannelManager this_arg_conv;
5719 this_arg_conv.inner = (void*)(this_arg & (~1));
5720 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5721 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
5723 LDKThirtyTwoBytes alias_ref;
5724 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
5725 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
5726 FREE((void*)addresses);
5727 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
5730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
5731 LDKChannelManager this_arg_conv;
5732 this_arg_conv.inner = (void*)(this_arg & (~1));
5733 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5734 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
5737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
5738 LDKChannelManager this_arg_conv;
5739 this_arg_conv.inner = (void*)(this_arg & (~1));
5740 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5741 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
5744 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) {
5745 LDKChannelManager this_arg_conv;
5746 this_arg_conv.inner = (void*)(this_arg & (~1));
5747 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5748 unsigned char payment_hash_arr[32];
5749 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
5750 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
5751 LDKThirtyTwoBytes payment_secret_ref;
5752 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5753 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
5756 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) {
5757 LDKChannelManager this_arg_conv;
5758 this_arg_conv.inner = (void*)(this_arg & (~1));
5759 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5760 LDKThirtyTwoBytes payment_preimage_ref;
5761 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
5762 LDKThirtyTwoBytes payment_secret_ref;
5763 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5764 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
5767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5768 LDKChannelManager this_arg_conv;
5769 this_arg_conv.inner = (void*)(this_arg & (~1));
5770 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5771 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5772 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
5776 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) {
5777 LDKChannelManager this_arg_conv;
5778 this_arg_conv.inner = (void*)(this_arg & (~1));
5779 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5780 LDKOutPoint funding_txo_conv;
5781 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5782 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5783 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
5786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5787 LDKChannelManager this_arg_conv;
5788 this_arg_conv.inner = (void*)(this_arg & (~1));
5789 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5790 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5791 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
5795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5796 LDKChannelManager this_arg_conv;
5797 this_arg_conv.inner = (void*)(this_arg & (~1));
5798 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5799 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5800 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
5804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5805 LDKChannelManager this_arg_conv;
5806 this_arg_conv.inner = (void*)(this_arg & (~1));
5807 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5808 unsigned char header_arr[80];
5809 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5810 unsigned char (*header_ref)[80] = &header_arr;
5811 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5812 FREE((void*)txdata);
5813 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
5817 LDKChannelManager this_arg_conv;
5818 this_arg_conv.inner = (void*)(this_arg & (~1));
5819 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5820 unsigned char header_arr[80];
5821 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5822 unsigned char (*header_ref)[80] = &header_arr;
5823 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
5826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
5827 LDKChannelManager this_arg_conv;
5828 this_arg_conv.inner = (void*)(this_arg & (~1));
5829 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5830 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5831 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
5835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5836 LDKChannelManagerReadArgs this_ptr_conv;
5837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5839 return ChannelManagerReadArgs_free(this_ptr_conv);
5842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
5843 LDKChannelManagerReadArgs this_ptr_conv;
5844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5846 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
5850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5851 LDKChannelManagerReadArgs this_ptr_conv;
5852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5854 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
5855 if (val_conv.free == LDKKeysInterface_JCalls_free) {
5856 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5857 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
5859 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
5862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
5863 LDKChannelManagerReadArgs this_ptr_conv;
5864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5866 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
5870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5871 LDKChannelManagerReadArgs this_ptr_conv;
5872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5874 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
5875 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
5876 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5877 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
5879 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
5882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
5883 LDKChannelManagerReadArgs this_ptr_conv;
5884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5886 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
5890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5891 LDKChannelManagerReadArgs this_ptr_conv;
5892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5894 LDKWatch val_conv = *(LDKWatch*)val;
5895 if (val_conv.free == LDKWatch_JCalls_free) {
5896 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5897 LDKWatch_JCalls_clone(val_conv.this_arg);
5899 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
5902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
5903 LDKChannelManagerReadArgs this_ptr_conv;
5904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5906 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
5910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5911 LDKChannelManagerReadArgs this_ptr_conv;
5912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5914 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
5915 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
5916 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5917 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
5919 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
5922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
5923 LDKChannelManagerReadArgs this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5926 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
5930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5931 LDKChannelManagerReadArgs this_ptr_conv;
5932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5934 LDKLogger val_conv = *(LDKLogger*)val;
5935 if (val_conv.free == LDKLogger_JCalls_free) {
5936 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5937 LDKLogger_JCalls_clone(val_conv.this_arg);
5939 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
5942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5943 LDKChannelManagerReadArgs this_ptr_conv;
5944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5946 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
5947 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5951 LDKChannelManagerReadArgs this_ptr_conv;
5952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5954 LDKUserConfig val_conv;
5955 val_conv.inner = (void*)(val & (~1));
5956 val_conv.is_owned = (val & 1) || (val == 0);
5957 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
5960 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) {
5961 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5962 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5963 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5964 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5966 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5967 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5969 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5971 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5972 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5973 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5974 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5976 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5977 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5978 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5979 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5981 LDKLogger logger_conv = *(LDKLogger*)logger;
5982 if (logger_conv.free == LDKLogger_JCalls_free) {
5983 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5984 LDKLogger_JCalls_clone(logger_conv.this_arg);
5986 LDKUserConfig default_config_conv;
5987 default_config_conv.inner = (void*)(default_config & (~1));
5988 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
5989 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
5990 FREE((void*)channel_monitors);
5991 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
5992 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5996 LDKDecodeError this_ptr_conv;
5997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5999 return DecodeError_free(this_ptr_conv);
6002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6003 LDKInit this_ptr_conv;
6004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6006 return Init_free(this_ptr_conv);
6009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6010 LDKErrorMessage this_ptr_conv;
6011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6013 return ErrorMessage_free(this_ptr_conv);
6016 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6017 LDKErrorMessage this_ptr_conv;
6018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6020 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6021 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6026 LDKErrorMessage this_ptr_conv;
6027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6029 LDKThirtyTwoBytes val_ref;
6030 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6031 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6035 LDKErrorMessage this_ptr_conv;
6036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6038 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6039 *ret = ErrorMessage_get_data(&this_ptr_conv);
6043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6044 LDKErrorMessage this_ptr_conv;
6045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6047 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6049 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6053 LDKThirtyTwoBytes channel_id_arg_ref;
6054 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6055 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6056 FREE((void*)data_arg);
6057 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6058 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6062 LDKPing this_ptr_conv;
6063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6065 return Ping_free(this_ptr_conv);
6068 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6069 LDKPing this_ptr_conv;
6070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6072 return Ping_get_ponglen(&this_ptr_conv);
6075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6076 LDKPing this_ptr_conv;
6077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6079 return Ping_set_ponglen(&this_ptr_conv, val);
6082 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6083 LDKPing this_ptr_conv;
6084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6086 return Ping_get_byteslen(&this_ptr_conv);
6089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6090 LDKPing this_ptr_conv;
6091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6093 return Ping_set_byteslen(&this_ptr_conv, val);
6096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6097 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6098 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6102 LDKPong this_ptr_conv;
6103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6105 return Pong_free(this_ptr_conv);
6108 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6109 LDKPong this_ptr_conv;
6110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6112 return Pong_get_byteslen(&this_ptr_conv);
6115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6116 LDKPong this_ptr_conv;
6117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6119 return Pong_set_byteslen(&this_ptr_conv, val);
6122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6123 LDKPong ret = Pong_new(byteslen_arg);
6124 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6128 LDKOpenChannel this_ptr_conv;
6129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6131 return OpenChannel_free(this_ptr_conv);
6134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6135 LDKOpenChannel this_ptr_conv;
6136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6138 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6139 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6144 LDKOpenChannel 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 LDKThirtyTwoBytes val_ref;
6148 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6149 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6153 LDKOpenChannel this_ptr_conv;
6154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6156 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6157 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6162 LDKOpenChannel this_ptr_conv;
6163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6165 LDKThirtyTwoBytes val_ref;
6166 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6167 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6171 LDKOpenChannel this_ptr_conv;
6172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6174 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6178 LDKOpenChannel this_ptr_conv;
6179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6181 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6185 LDKOpenChannel this_ptr_conv;
6186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6188 return OpenChannel_get_push_msat(&this_ptr_conv);
6191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6192 LDKOpenChannel 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 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6199 LDKOpenChannel this_ptr_conv;
6200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6202 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6206 LDKOpenChannel this_ptr_conv;
6207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6209 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6213 LDKOpenChannel this_ptr_conv;
6214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6216 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6219 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) {
6220 LDKOpenChannel this_ptr_conv;
6221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6223 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6227 LDKOpenChannel this_ptr_conv;
6228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6230 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6234 LDKOpenChannel this_ptr_conv;
6235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6237 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6241 LDKOpenChannel this_ptr_conv;
6242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6244 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6248 LDKOpenChannel this_ptr_conv;
6249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6250 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6251 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6254 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6255 LDKOpenChannel this_ptr_conv;
6256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6257 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6258 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6262 LDKOpenChannel this_ptr_conv;
6263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6265 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6268 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6269 LDKOpenChannel this_ptr_conv;
6270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6272 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
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_set_to_self_delay(&this_ptr_conv, val);
6282 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(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 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6290 LDKOpenChannel this_ptr_conv;
6291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6293 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6297 LDKOpenChannel this_ptr_conv;
6298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6300 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6301 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6306 LDKOpenChannel this_ptr_conv;
6307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6309 LDKPublicKey val_ref;
6310 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6311 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6314 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6315 LDKOpenChannel this_ptr_conv;
6316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6318 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6319 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6324 LDKOpenChannel this_ptr_conv;
6325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6327 LDKPublicKey val_ref;
6328 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6329 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6332 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6337 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6342 LDKOpenChannel this_ptr_conv;
6343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6345 LDKPublicKey val_ref;
6346 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6347 return OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6350 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6351 LDKOpenChannel this_ptr_conv;
6352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6354 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6355 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6360 LDKOpenChannel this_ptr_conv;
6361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6363 LDKPublicKey val_ref;
6364 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6365 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6368 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6369 LDKOpenChannel this_ptr_conv;
6370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6372 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6373 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6378 LDKOpenChannel this_ptr_conv;
6379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6381 LDKPublicKey val_ref;
6382 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6383 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6386 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6387 LDKOpenChannel this_ptr_conv;
6388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6390 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6391 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
6400 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6401 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6404 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6405 LDKOpenChannel this_ptr_conv;
6406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6408 return OpenChannel_get_channel_flags(&this_ptr_conv);
6411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6412 LDKOpenChannel this_ptr_conv;
6413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6415 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6419 LDKAcceptChannel this_ptr_conv;
6420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6422 return AcceptChannel_free(this_ptr_conv);
6425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6426 LDKAcceptChannel this_ptr_conv;
6427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6429 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6430 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6435 LDKAcceptChannel this_ptr_conv;
6436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6438 LDKThirtyTwoBytes val_ref;
6439 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6440 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6444 LDKAcceptChannel this_ptr_conv;
6445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6447 return AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6451 LDKAcceptChannel this_ptr_conv;
6452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6454 return AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6458 LDKAcceptChannel this_ptr_conv;
6459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6461 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6464 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) {
6465 LDKAcceptChannel this_ptr_conv;
6466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6468 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6472 LDKAcceptChannel this_ptr_conv;
6473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6475 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6479 LDKAcceptChannel this_ptr_conv;
6480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6482 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6486 LDKAcceptChannel this_ptr_conv;
6487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6489 return AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6493 LDKAcceptChannel this_ptr_conv;
6494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6496 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6499 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6500 LDKAcceptChannel this_ptr_conv;
6501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6503 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6507 LDKAcceptChannel this_ptr_conv;
6508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6510 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6513 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6514 LDKAcceptChannel this_ptr_conv;
6515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6517 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6521 LDKAcceptChannel this_ptr_conv;
6522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6524 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6527 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6528 LDKAcceptChannel this_ptr_conv;
6529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6531 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6535 LDKAcceptChannel this_ptr_conv;
6536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6538 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6542 LDKAcceptChannel this_ptr_conv;
6543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6545 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6546 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6551 LDKAcceptChannel this_ptr_conv;
6552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6554 LDKPublicKey val_ref;
6555 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6556 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6559 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6560 LDKAcceptChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6564 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6569 LDKAcceptChannel this_ptr_conv;
6570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6572 LDKPublicKey val_ref;
6573 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6574 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6577 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6578 LDKAcceptChannel this_ptr_conv;
6579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6581 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6582 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
6586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6587 LDKAcceptChannel this_ptr_conv;
6588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6590 LDKPublicKey val_ref;
6591 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6592 return AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
6595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6596 LDKAcceptChannel this_ptr_conv;
6597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6605 LDKAcceptChannel this_ptr_conv;
6606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6608 LDKPublicKey val_ref;
6609 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6610 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6614 LDKAcceptChannel this_ptr_conv;
6615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6623 LDKAcceptChannel this_ptr_conv;
6624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6626 LDKPublicKey val_ref;
6627 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6628 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6631 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6632 LDKAcceptChannel this_ptr_conv;
6633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6635 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6636 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
6645 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6646 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6650 LDKFundingCreated this_ptr_conv;
6651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6652 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6653 return FundingCreated_free(this_ptr_conv);
6656 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6657 LDKFundingCreated this_ptr_conv;
6658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6659 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6660 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6661 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
6665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6666 LDKFundingCreated this_ptr_conv;
6667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6669 LDKThirtyTwoBytes val_ref;
6670 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6671 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
6674 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6675 LDKFundingCreated this_ptr_conv;
6676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6678 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6679 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
6683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6684 LDKFundingCreated this_ptr_conv;
6685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6687 LDKThirtyTwoBytes val_ref;
6688 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6689 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
6692 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6693 LDKFundingCreated this_ptr_conv;
6694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6696 return FundingCreated_get_funding_output_index(&this_ptr_conv);
6699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6700 LDKFundingCreated this_ptr_conv;
6701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6703 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
6706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6707 LDKFundingCreated this_ptr_conv;
6708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6710 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6711 *ret = FundingCreated_get_signature(&this_ptr_conv);
6715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6716 LDKFundingCreated this_ptr_conv;
6717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6719 LDKSignature val_conv = *(LDKSignature*)val;
6721 return FundingCreated_set_signature(&this_ptr_conv, val_conv);
6724 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) {
6725 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
6726 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
6727 LDKThirtyTwoBytes funding_txid_arg_ref;
6728 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
6729 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6730 FREE((void*)signature_arg);
6731 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv);
6732 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6736 LDKFundingSigned this_ptr_conv;
6737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6739 return FundingSigned_free(this_ptr_conv);
6742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6743 LDKFundingSigned this_ptr_conv;
6744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6746 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6747 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
6751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6752 LDKFundingSigned this_ptr_conv;
6753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6755 LDKThirtyTwoBytes val_ref;
6756 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6757 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
6760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6761 LDKFundingSigned this_ptr_conv;
6762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6764 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6765 *ret = FundingSigned_get_signature(&this_ptr_conv);
6769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6770 LDKFundingSigned this_ptr_conv;
6771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6773 LDKSignature val_conv = *(LDKSignature*)val;
6775 return FundingSigned_set_signature(&this_ptr_conv, val_conv);
6778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) {
6779 LDKThirtyTwoBytes channel_id_arg_ref;
6780 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6781 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6782 FREE((void*)signature_arg);
6783 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv);
6784 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6788 LDKFundingLocked this_ptr_conv;
6789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6791 return FundingLocked_free(this_ptr_conv);
6794 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6795 LDKFundingLocked this_ptr_conv;
6796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6798 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6799 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
6803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6804 LDKFundingLocked this_ptr_conv;
6805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6807 LDKThirtyTwoBytes val_ref;
6808 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6809 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
6812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6813 LDKFundingLocked this_ptr_conv;
6814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6816 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6817 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
6821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6822 LDKFundingLocked this_ptr_conv;
6823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6825 LDKPublicKey val_ref;
6826 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6827 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
6830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
6831 LDKThirtyTwoBytes channel_id_arg_ref;
6832 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6833 LDKPublicKey next_per_commitment_point_arg_ref;
6834 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
6835 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
6836 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6840 LDKShutdown this_ptr_conv;
6841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6843 return Shutdown_free(this_ptr_conv);
6846 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6847 LDKShutdown this_ptr_conv;
6848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6850 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6851 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
6855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6856 LDKShutdown this_ptr_conv;
6857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6859 LDKThirtyTwoBytes val_ref;
6860 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6861 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
6864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6865 LDKShutdown this_ptr_conv;
6866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6868 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
6869 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
6873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6874 LDKShutdown this_ptr_conv;
6875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6877 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6879 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
6882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
6883 LDKThirtyTwoBytes channel_id_arg_ref;
6884 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6885 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
6886 FREE((void*)scriptpubkey_arg);
6887 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
6888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6892 LDKClosingSigned this_ptr_conv;
6893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6895 return ClosingSigned_free(this_ptr_conv);
6898 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6899 LDKClosingSigned this_ptr_conv;
6900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6902 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6903 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
6907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6908 LDKClosingSigned this_ptr_conv;
6909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6911 LDKThirtyTwoBytes val_ref;
6912 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6913 return ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
6916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6917 LDKClosingSigned this_ptr_conv;
6918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6919 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6920 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
6923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6924 LDKClosingSigned this_ptr_conv;
6925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6927 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
6930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6931 LDKClosingSigned this_ptr_conv;
6932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6934 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6935 *ret = ClosingSigned_get_signature(&this_ptr_conv);
6939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6940 LDKClosingSigned this_ptr_conv;
6941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6943 LDKSignature val_conv = *(LDKSignature*)val;
6945 return ClosingSigned_set_signature(&this_ptr_conv, val_conv);
6948 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) {
6949 LDKThirtyTwoBytes channel_id_arg_ref;
6950 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6951 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6952 FREE((void*)signature_arg);
6953 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv);
6954 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6958 LDKUpdateAddHTLC this_ptr_conv;
6959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6961 return UpdateAddHTLC_free(this_ptr_conv);
6964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6965 LDKUpdateAddHTLC this_ptr_conv;
6966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6968 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6969 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
6973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6974 LDKUpdateAddHTLC this_ptr_conv;
6975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6977 LDKThirtyTwoBytes val_ref;
6978 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6979 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
6982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6983 LDKUpdateAddHTLC this_ptr_conv;
6984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6986 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
6989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6990 LDKUpdateAddHTLC this_ptr_conv;
6991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6993 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
6996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6997 LDKUpdateAddHTLC this_ptr_conv;
6998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7000 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7004 LDKUpdateAddHTLC 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 return UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7010 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7011 LDKUpdateAddHTLC this_ptr_conv;
7012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7014 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7015 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7020 LDKUpdateAddHTLC this_ptr_conv;
7021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7023 LDKThirtyTwoBytes val_ref;
7024 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7025 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7028 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7029 LDKUpdateAddHTLC this_ptr_conv;
7030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7032 return UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7036 LDKUpdateAddHTLC this_ptr_conv;
7037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7039 return UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7043 LDKUpdateFulfillHTLC this_ptr_conv;
7044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7046 return UpdateFulfillHTLC_free(this_ptr_conv);
7049 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7050 LDKUpdateFulfillHTLC this_ptr_conv;
7051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7053 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7054 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7059 LDKUpdateFulfillHTLC this_ptr_conv;
7060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7062 LDKThirtyTwoBytes val_ref;
7063 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7064 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7068 LDKUpdateFulfillHTLC this_ptr_conv;
7069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7071 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7075 LDKUpdateFulfillHTLC this_ptr_conv;
7076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7078 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7081 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7082 LDKUpdateFulfillHTLC this_ptr_conv;
7083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7085 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7086 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7091 LDKUpdateFulfillHTLC this_ptr_conv;
7092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7094 LDKThirtyTwoBytes val_ref;
7095 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7096 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7099 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) {
7100 LDKThirtyTwoBytes channel_id_arg_ref;
7101 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7102 LDKThirtyTwoBytes payment_preimage_arg_ref;
7103 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7104 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7105 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7109 LDKUpdateFailHTLC this_ptr_conv;
7110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7112 return UpdateFailHTLC_free(this_ptr_conv);
7115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7116 LDKUpdateFailHTLC this_ptr_conv;
7117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7119 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7120 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7125 LDKUpdateFailHTLC this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7128 LDKThirtyTwoBytes val_ref;
7129 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7130 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7133 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7134 LDKUpdateFailHTLC this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7141 LDKUpdateFailHTLC this_ptr_conv;
7142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7144 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7148 LDKUpdateFailMalformedHTLC this_ptr_conv;
7149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7151 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7155 LDKUpdateFailMalformedHTLC this_ptr_conv;
7156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7158 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7159 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7164 LDKUpdateFailMalformedHTLC this_ptr_conv;
7165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7167 LDKThirtyTwoBytes val_ref;
7168 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7169 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7173 LDKUpdateFailMalformedHTLC this_ptr_conv;
7174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7176 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7180 LDKUpdateFailMalformedHTLC this_ptr_conv;
7181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7183 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7186 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7187 LDKUpdateFailMalformedHTLC this_ptr_conv;
7188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7190 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7194 LDKUpdateFailMalformedHTLC this_ptr_conv;
7195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7197 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7201 LDKCommitmentSigned this_ptr_conv;
7202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7204 return CommitmentSigned_free(this_ptr_conv);
7207 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7208 LDKCommitmentSigned this_ptr_conv;
7209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7211 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7212 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7217 LDKCommitmentSigned this_ptr_conv;
7218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7220 LDKThirtyTwoBytes val_ref;
7221 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7222 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7225 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7226 LDKCommitmentSigned this_ptr_conv;
7227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7229 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7230 *ret = CommitmentSigned_get_signature(&this_ptr_conv);
7234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7235 LDKCommitmentSigned this_ptr_conv;
7236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7238 LDKSignature val_conv = *(LDKSignature*)val;
7240 return CommitmentSigned_set_signature(&this_ptr_conv, val_conv);
7243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7244 LDKCommitmentSigned this_ptr_conv;
7245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7247 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7249 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7252 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) {
7253 LDKThirtyTwoBytes channel_id_arg_ref;
7254 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7255 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7256 FREE((void*)signature_arg);
7257 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7258 FREE((void*)htlc_signatures_arg);
7259 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv);
7260 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7264 LDKRevokeAndACK 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 return RevokeAndACK_free(this_ptr_conv);
7270 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7271 LDKRevokeAndACK this_ptr_conv;
7272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7274 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7275 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7280 LDKRevokeAndACK this_ptr_conv;
7281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7283 LDKThirtyTwoBytes val_ref;
7284 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7285 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7288 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7289 LDKRevokeAndACK 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7293 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7298 LDKRevokeAndACK this_ptr_conv;
7299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7301 LDKThirtyTwoBytes val_ref;
7302 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7303 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7306 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7307 LDKRevokeAndACK this_ptr_conv;
7308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7310 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7311 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7316 LDKRevokeAndACK this_ptr_conv;
7317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7319 LDKPublicKey val_ref;
7320 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7321 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7324 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) {
7325 LDKThirtyTwoBytes channel_id_arg_ref;
7326 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7327 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7328 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7329 LDKPublicKey next_per_commitment_point_arg_ref;
7330 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7331 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7332 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7336 LDKUpdateFee this_ptr_conv;
7337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7339 return UpdateFee_free(this_ptr_conv);
7342 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7343 LDKUpdateFee this_ptr_conv;
7344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7346 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7347 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7352 LDKUpdateFee this_ptr_conv;
7353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7355 LDKThirtyTwoBytes val_ref;
7356 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7357 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7360 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7361 LDKUpdateFee this_ptr_conv;
7362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7364 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7368 LDKUpdateFee this_ptr_conv;
7369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7371 return UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7375 LDKThirtyTwoBytes channel_id_arg_ref;
7376 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7377 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7378 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7382 LDKDataLossProtect this_ptr_conv;
7383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7385 return DataLossProtect_free(this_ptr_conv);
7388 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7389 LDKDataLossProtect this_ptr_conv;
7390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7392 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7393 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7398 LDKDataLossProtect this_ptr_conv;
7399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7401 LDKThirtyTwoBytes val_ref;
7402 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7403 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7406 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7407 LDKDataLossProtect this_ptr_conv;
7408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7410 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7411 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
7415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7416 LDKDataLossProtect this_ptr_conv;
7417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7419 LDKPublicKey val_ref;
7420 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7421 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
7424 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) {
7425 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7426 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7427 LDKPublicKey my_current_per_commitment_point_arg_ref;
7428 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
7429 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
7430 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7434 LDKChannelReestablish this_ptr_conv;
7435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7437 return ChannelReestablish_free(this_ptr_conv);
7440 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7441 LDKChannelReestablish this_ptr_conv;
7442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7444 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7445 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7450 LDKChannelReestablish this_ptr_conv;
7451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7453 LDKThirtyTwoBytes val_ref;
7454 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7455 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7459 LDKChannelReestablish this_ptr_conv;
7460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7462 return ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7466 LDKChannelReestablish this_ptr_conv;
7467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7469 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7473 LDKChannelReestablish this_ptr_conv;
7474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7476 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7480 LDKChannelReestablish this_ptr_conv;
7481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7483 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
7486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7487 LDKAnnouncementSignatures this_ptr_conv;
7488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7490 return AnnouncementSignatures_free(this_ptr_conv);
7493 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7494 LDKAnnouncementSignatures this_ptr_conv;
7495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7497 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7498 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
7502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7503 LDKAnnouncementSignatures this_ptr_conv;
7504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7506 LDKThirtyTwoBytes val_ref;
7507 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7508 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
7511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7512 LDKAnnouncementSignatures this_ptr_conv;
7513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7515 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
7518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7519 LDKAnnouncementSignatures this_ptr_conv;
7520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7522 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
7525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7526 LDKAnnouncementSignatures this_ptr_conv;
7527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7529 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7530 *ret = AnnouncementSignatures_get_node_signature(&this_ptr_conv);
7534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7535 LDKAnnouncementSignatures this_ptr_conv;
7536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7538 LDKSignature val_conv = *(LDKSignature*)val;
7540 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_conv);
7543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7544 LDKAnnouncementSignatures this_ptr_conv;
7545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7547 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7548 *ret = AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv);
7552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7553 LDKAnnouncementSignatures this_ptr_conv;
7554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7556 LDKSignature val_conv = *(LDKSignature*)val;
7558 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_conv);
7561 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) {
7562 LDKThirtyTwoBytes channel_id_arg_ref;
7563 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7564 LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
7565 FREE((void*)node_signature_arg);
7566 LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
7567 FREE((void*)bitcoin_signature_arg);
7568 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
7569 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7573 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
7574 FREE((void*)this_ptr);
7575 return NetAddress_free(this_ptr_conv);
7578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7579 LDKUnsignedNodeAnnouncement this_ptr_conv;
7580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7582 return UnsignedNodeAnnouncement_free(this_ptr_conv);
7585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7586 LDKUnsignedNodeAnnouncement this_ptr_conv;
7587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7589 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
7590 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7594 LDKUnsignedNodeAnnouncement this_ptr_conv;
7595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7597 LDKNodeFeatures val_conv;
7598 val_conv.inner = (void*)(val & (~1));
7599 val_conv.is_owned = (val & 1) || (val == 0);
7600 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
7603 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
7604 LDKUnsignedNodeAnnouncement this_ptr_conv;
7605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7607 return UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
7610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7611 LDKUnsignedNodeAnnouncement this_ptr_conv;
7612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7614 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
7617 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7618 LDKUnsignedNodeAnnouncement this_ptr_conv;
7619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7621 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7622 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
7626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7627 LDKUnsignedNodeAnnouncement this_ptr_conv;
7628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7630 LDKPublicKey val_ref;
7631 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7632 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
7635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
7636 LDKUnsignedNodeAnnouncement this_ptr_conv;
7637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7639 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
7640 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
7644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7645 LDKUnsignedNodeAnnouncement this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7648 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
7650 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
7653 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
7654 LDKUnsignedNodeAnnouncement this_ptr_conv;
7655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7657 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7658 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
7662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7663 LDKUnsignedNodeAnnouncement this_ptr_conv;
7664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7666 LDKThirtyTwoBytes val_ref;
7667 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7668 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
7671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7672 LDKUnsignedNodeAnnouncement this_ptr_conv;
7673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7675 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
7677 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
7680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7681 LDKNodeAnnouncement this_ptr_conv;
7682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7684 return NodeAnnouncement_free(this_ptr_conv);
7687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7688 LDKNodeAnnouncement this_ptr_conv;
7689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7691 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7692 *ret = NodeAnnouncement_get_signature(&this_ptr_conv);
7696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7697 LDKNodeAnnouncement this_ptr_conv;
7698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7700 LDKSignature val_conv = *(LDKSignature*)val;
7702 return NodeAnnouncement_set_signature(&this_ptr_conv, val_conv);
7705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
7706 LDKNodeAnnouncement this_ptr_conv;
7707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7709 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
7710 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7714 LDKNodeAnnouncement this_ptr_conv;
7715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7717 LDKUnsignedNodeAnnouncement val_conv;
7718 val_conv.inner = (void*)(val & (~1));
7719 val_conv.is_owned = (val & 1) || (val == 0);
7720 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
7723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
7724 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7725 FREE((void*)signature_arg);
7726 LDKUnsignedNodeAnnouncement contents_arg_conv;
7727 contents_arg_conv.inner = (void*)(contents_arg & (~1));
7728 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
7729 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
7730 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7734 LDKUnsignedChannelAnnouncement 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 return UnsignedChannelAnnouncement_free(this_ptr_conv);
7740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7741 LDKUnsignedChannelAnnouncement this_ptr_conv;
7742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7744 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
7745 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7749 LDKUnsignedChannelAnnouncement this_ptr_conv;
7750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7752 LDKChannelFeatures val_conv;
7753 val_conv.inner = (void*)(val & (~1));
7754 val_conv.is_owned = (val & 1) || (val == 0);
7755 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
7758 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7759 LDKUnsignedChannelAnnouncement 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7763 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
7767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7768 LDKUnsignedChannelAnnouncement this_ptr_conv;
7769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7771 LDKThirtyTwoBytes val_ref;
7772 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7773 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
7776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7777 LDKUnsignedChannelAnnouncement this_ptr_conv;
7778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7780 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
7783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7784 LDKUnsignedChannelAnnouncement 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 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
7790 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7791 LDKUnsignedChannelAnnouncement this_ptr_conv;
7792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7794 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7795 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
7799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7800 LDKUnsignedChannelAnnouncement this_ptr_conv;
7801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7803 LDKPublicKey val_ref;
7804 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7805 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
7808 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7809 LDKUnsignedChannelAnnouncement this_ptr_conv;
7810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7812 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7813 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
7817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7818 LDKUnsignedChannelAnnouncement this_ptr_conv;
7819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7821 LDKPublicKey val_ref;
7822 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7823 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
7826 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7827 LDKUnsignedChannelAnnouncement this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7830 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7831 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
7835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7836 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
7840 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7841 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
7844 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7845 LDKUnsignedChannelAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7849 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
7853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7854 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
7858 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7859 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
7862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7863 LDKChannelAnnouncement this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7866 return ChannelAnnouncement_free(this_ptr_conv);
7869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7870 LDKChannelAnnouncement this_ptr_conv;
7871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7873 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7874 *ret = ChannelAnnouncement_get_node_signature_1(&this_ptr_conv);
7878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7879 LDKChannelAnnouncement this_ptr_conv;
7880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7882 LDKSignature val_conv = *(LDKSignature*)val;
7884 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_conv);
7887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7888 LDKChannelAnnouncement this_ptr_conv;
7889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7891 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7892 *ret = ChannelAnnouncement_get_node_signature_2(&this_ptr_conv);
7896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7897 LDKChannelAnnouncement 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 LDKSignature val_conv = *(LDKSignature*)val;
7902 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_conv);
7905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7906 LDKChannelAnnouncement this_ptr_conv;
7907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7909 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7910 *ret = ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv);
7914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7915 LDKChannelAnnouncement this_ptr_conv;
7916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7918 LDKSignature val_conv = *(LDKSignature*)val;
7920 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_conv);
7923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7924 LDKChannelAnnouncement this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7928 *ret = ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv);
7932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7933 LDKChannelAnnouncement this_ptr_conv;
7934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7936 LDKSignature val_conv = *(LDKSignature*)val;
7938 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_conv);
7941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
7942 LDKChannelAnnouncement this_ptr_conv;
7943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7945 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
7946 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7950 LDKChannelAnnouncement this_ptr_conv;
7951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7953 LDKUnsignedChannelAnnouncement val_conv;
7954 val_conv.inner = (void*)(val & (~1));
7955 val_conv.is_owned = (val & 1) || (val == 0);
7956 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
7959 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) {
7960 LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
7961 FREE((void*)node_signature_1_arg);
7962 LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
7963 FREE((void*)node_signature_2_arg);
7964 LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
7965 FREE((void*)bitcoin_signature_1_arg);
7966 LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
7967 FREE((void*)bitcoin_signature_2_arg);
7968 LDKUnsignedChannelAnnouncement contents_arg_conv;
7969 contents_arg_conv.inner = (void*)(contents_arg & (~1));
7970 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
7971 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);
7972 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7976 LDKUnsignedChannelUpdate this_ptr_conv;
7977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7979 return UnsignedChannelUpdate_free(this_ptr_conv);
7982 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7983 LDKUnsignedChannelUpdate this_ptr_conv;
7984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7986 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7987 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
7991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7992 LDKUnsignedChannelUpdate this_ptr_conv;
7993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7995 LDKThirtyTwoBytes val_ref;
7996 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7997 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8001 LDKUnsignedChannelUpdate this_ptr_conv;
8002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8004 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8008 LDKUnsignedChannelUpdate this_ptr_conv;
8009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8011 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8014 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8015 LDKUnsignedChannelUpdate this_ptr_conv;
8016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8018 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8022 LDKUnsignedChannelUpdate this_ptr_conv;
8023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8025 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8028 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8029 LDKUnsignedChannelUpdate this_ptr_conv;
8030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8032 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8036 LDKUnsignedChannelUpdate 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 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8042 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8043 LDKUnsignedChannelUpdate this_ptr_conv;
8044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8046 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8050 LDKUnsignedChannelUpdate this_ptr_conv;
8051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8053 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8057 LDKUnsignedChannelUpdate this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8060 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8064 LDKUnsignedChannelUpdate this_ptr_conv;
8065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8067 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8070 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8071 LDKUnsignedChannelUpdate this_ptr_conv;
8072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8074 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8078 LDKUnsignedChannelUpdate this_ptr_conv;
8079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8081 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8084 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8085 LDKUnsignedChannelUpdate this_ptr_conv;
8086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8088 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8092 LDKUnsignedChannelUpdate this_ptr_conv;
8093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8095 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8099 LDKChannelUpdate this_ptr_conv;
8100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8102 return ChannelUpdate_free(this_ptr_conv);
8105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8106 LDKChannelUpdate this_ptr_conv;
8107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8109 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8110 *ret = ChannelUpdate_get_signature(&this_ptr_conv);
8114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8115 LDKChannelUpdate this_ptr_conv;
8116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8118 LDKSignature val_conv = *(LDKSignature*)val;
8120 return ChannelUpdate_set_signature(&this_ptr_conv, val_conv);
8123 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8124 LDKChannelUpdate 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 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8128 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8132 LDKChannelUpdate this_ptr_conv;
8133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8135 LDKUnsignedChannelUpdate val_conv;
8136 val_conv.inner = (void*)(val & (~1));
8137 val_conv.is_owned = (val & 1) || (val == 0);
8138 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8142 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8143 FREE((void*)signature_arg);
8144 LDKUnsignedChannelUpdate contents_arg_conv;
8145 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8146 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8147 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
8148 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8152 LDKQueryChannelRange this_ptr_conv;
8153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8155 return QueryChannelRange_free(this_ptr_conv);
8158 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8159 LDKQueryChannelRange this_ptr_conv;
8160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8162 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8163 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8168 LDKQueryChannelRange this_ptr_conv;
8169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8171 LDKThirtyTwoBytes val_ref;
8172 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8173 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8176 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8177 LDKQueryChannelRange 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 QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8184 LDKQueryChannelRange 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 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8190 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8191 LDKQueryChannelRange 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 QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8198 LDKQueryChannelRange 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 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8204 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) {
8205 LDKThirtyTwoBytes chain_hash_arg_ref;
8206 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8207 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8208 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8212 LDKReplyChannelRange 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 ReplyChannelRange_free(this_ptr_conv);
8218 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8219 LDKReplyChannelRange 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8223 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8228 LDKReplyChannelRange this_ptr_conv;
8229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8231 LDKThirtyTwoBytes val_ref;
8232 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8233 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8236 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8237 LDKReplyChannelRange this_ptr_conv;
8238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8240 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8244 LDKReplyChannelRange this_ptr_conv;
8245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8247 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8250 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8251 LDKReplyChannelRange this_ptr_conv;
8252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8254 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8258 LDKReplyChannelRange this_ptr_conv;
8259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8261 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8265 LDKReplyChannelRange this_ptr_conv;
8266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8268 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8272 LDKReplyChannelRange 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 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8279 LDKReplyChannelRange this_ptr_conv;
8280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8282 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8284 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8287 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) {
8288 LDKThirtyTwoBytes chain_hash_arg_ref;
8289 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8290 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8291 FREE((void*)short_channel_ids_arg);
8292 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8293 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8297 LDKQueryShortChannelIds this_ptr_conv;
8298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8300 return QueryShortChannelIds_free(this_ptr_conv);
8303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8304 LDKQueryShortChannelIds this_ptr_conv;
8305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8307 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8308 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8313 LDKQueryShortChannelIds this_ptr_conv;
8314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8316 LDKThirtyTwoBytes val_ref;
8317 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8318 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8322 LDKQueryShortChannelIds this_ptr_conv;
8323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8325 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8327 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8331 LDKThirtyTwoBytes chain_hash_arg_ref;
8332 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8333 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8334 FREE((void*)short_channel_ids_arg);
8335 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8336 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8340 LDKReplyShortChannelIdsEnd this_ptr_conv;
8341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8343 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8346 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8347 LDKReplyShortChannelIdsEnd this_ptr_conv;
8348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8350 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8351 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
8355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8356 LDKReplyShortChannelIdsEnd this_ptr_conv;
8357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8359 LDKThirtyTwoBytes val_ref;
8360 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8361 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
8364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8365 LDKReplyShortChannelIdsEnd this_ptr_conv;
8366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8368 return ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
8371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8372 LDKReplyShortChannelIdsEnd this_ptr_conv;
8373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8375 return ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
8378 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
8379 LDKThirtyTwoBytes chain_hash_arg_ref;
8380 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8381 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
8382 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8386 LDKGossipTimestampFilter this_ptr_conv;
8387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8389 return GossipTimestampFilter_free(this_ptr_conv);
8392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8393 LDKGossipTimestampFilter this_ptr_conv;
8394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8396 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8397 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
8401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8402 LDKGossipTimestampFilter this_ptr_conv;
8403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8405 LDKThirtyTwoBytes val_ref;
8406 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8407 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
8410 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8411 LDKGossipTimestampFilter this_ptr_conv;
8412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8414 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
8417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8418 LDKGossipTimestampFilter this_ptr_conv;
8419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8421 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
8424 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
8425 LDKGossipTimestampFilter this_ptr_conv;
8426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8428 return GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
8431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8432 LDKGossipTimestampFilter this_ptr_conv;
8433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8435 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
8438 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) {
8439 LDKThirtyTwoBytes chain_hash_arg_ref;
8440 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8441 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
8442 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8446 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
8447 FREE((void*)this_ptr);
8448 return ErrorAction_free(this_ptr_conv);
8451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8452 LDKLightningError 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 return LightningError_free(this_ptr_conv);
8458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
8459 LDKLightningError this_ptr_conv;
8460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8462 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
8463 *ret = LightningError_get_err(&this_ptr_conv);
8467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8468 LDKLightningError this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8471 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
8473 return LightningError_set_err(&this_ptr_conv, val_conv);
8476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
8477 LDKLightningError this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8480 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
8481 *ret = LightningError_get_action(&this_ptr_conv);
8485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8486 LDKLightningError this_ptr_conv;
8487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8489 LDKErrorAction val_conv = *(LDKErrorAction*)val;
8491 return LightningError_set_action(&this_ptr_conv, val_conv);
8494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
8495 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
8496 FREE((void*)err_arg);
8497 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
8498 FREE((void*)action_arg);
8499 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
8500 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8504 LDKCommitmentUpdate 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 return CommitmentUpdate_free(this_ptr_conv);
8510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8511 LDKCommitmentUpdate this_ptr_conv;
8512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8514 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
8516 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8520 LDKCommitmentUpdate 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 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
8525 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
8528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8529 LDKCommitmentUpdate this_ptr_conv;
8530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8532 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
8534 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
8537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8538 LDKCommitmentUpdate this_ptr_conv;
8539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8541 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
8543 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
8546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
8547 LDKCommitmentUpdate this_ptr_conv;
8548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8550 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
8551 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8555 LDKCommitmentUpdate this_ptr_conv;
8556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8558 LDKUpdateFee val_conv;
8559 val_conv.inner = (void*)(val & (~1));
8560 val_conv.is_owned = (val & 1) || (val == 0);
8561 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
8564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
8565 LDKCommitmentUpdate this_ptr_conv;
8566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8568 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
8569 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8573 LDKCommitmentUpdate 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 LDKCommitmentSigned val_conv;
8577 val_conv.inner = (void*)(val & (~1));
8578 val_conv.is_owned = (val & 1) || (val == 0);
8579 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
8582 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) {
8583 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
8584 FREE((void*)update_add_htlcs_arg);
8585 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
8586 FREE((void*)update_fulfill_htlcs_arg);
8587 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
8588 FREE((void*)update_fail_htlcs_arg);
8589 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
8590 FREE((void*)update_fail_malformed_htlcs_arg);
8591 LDKUpdateFee update_fee_arg_conv;
8592 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
8593 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
8594 LDKCommitmentSigned commitment_signed_arg_conv;
8595 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
8596 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
8597 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);
8598 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8602 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
8603 FREE((void*)this_ptr);
8604 return HTLCFailChannelUpdate_free(this_ptr_conv);
8607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8608 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
8609 FREE((void*)this_ptr);
8610 return ChannelMessageHandler_free(this_ptr_conv);
8613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8614 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
8615 FREE((void*)this_ptr);
8616 return RoutingMessageHandler_free(this_ptr_conv);
8619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8620 LDKAcceptChannel obj_conv;
8621 obj_conv.inner = (void*)(obj & (~1));
8622 obj_conv.is_owned = (obj & 1) || (obj == 0);
8623 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8624 *ret = AcceptChannel_write(&obj_conv);
8628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8629 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8630 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
8631 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
8635 LDKAnnouncementSignatures obj_conv;
8636 obj_conv.inner = (void*)(obj & (~1));
8637 obj_conv.is_owned = (obj & 1) || (obj == 0);
8638 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8639 *ret = AnnouncementSignatures_write(&obj_conv);
8643 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
8644 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8645 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
8646 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
8650 LDKChannelReestablish obj_conv;
8651 obj_conv.inner = (void*)(obj & (~1));
8652 obj_conv.is_owned = (obj & 1) || (obj == 0);
8653 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8654 *ret = ChannelReestablish_write(&obj_conv);
8658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
8659 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8660 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
8661 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8665 LDKClosingSigned obj_conv;
8666 obj_conv.inner = (void*)(obj & (~1));
8667 obj_conv.is_owned = (obj & 1) || (obj == 0);
8668 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8669 *ret = ClosingSigned_write(&obj_conv);
8673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8674 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8675 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
8676 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8680 LDKCommitmentSigned obj_conv;
8681 obj_conv.inner = (void*)(obj & (~1));
8682 obj_conv.is_owned = (obj & 1) || (obj == 0);
8683 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8684 *ret = CommitmentSigned_write(&obj_conv);
8688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8689 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8690 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
8691 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
8695 LDKFundingCreated obj_conv;
8696 obj_conv.inner = (void*)(obj & (~1));
8697 obj_conv.is_owned = (obj & 1) || (obj == 0);
8698 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8699 *ret = FundingCreated_write(&obj_conv);
8703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
8704 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8705 LDKFundingCreated ret = FundingCreated_read(ser_conv);
8706 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8709 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8710 LDKFundingSigned obj_conv;
8711 obj_conv.inner = (void*)(obj & (~1));
8712 obj_conv.is_owned = (obj & 1) || (obj == 0);
8713 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8714 *ret = FundingSigned_write(&obj_conv);
8718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8719 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8720 LDKFundingSigned ret = FundingSigned_read(ser_conv);
8721 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
8725 LDKFundingLocked obj_conv;
8726 obj_conv.inner = (void*)(obj & (~1));
8727 obj_conv.is_owned = (obj & 1) || (obj == 0);
8728 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8729 *ret = FundingLocked_write(&obj_conv);
8733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
8734 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8735 LDKFundingLocked ret = FundingLocked_read(ser_conv);
8736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
8741 obj_conv.inner = (void*)(obj & (~1));
8742 obj_conv.is_owned = (obj & 1) || (obj == 0);
8743 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8744 *ret = Init_write(&obj_conv);
8748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
8749 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8750 LDKInit ret = Init_read(ser_conv);
8751 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8755 LDKOpenChannel obj_conv;
8756 obj_conv.inner = (void*)(obj & (~1));
8757 obj_conv.is_owned = (obj & 1) || (obj == 0);
8758 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8759 *ret = OpenChannel_write(&obj_conv);
8763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8764 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8765 LDKOpenChannel ret = OpenChannel_read(ser_conv);
8766 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
8770 LDKRevokeAndACK obj_conv;
8771 obj_conv.inner = (void*)(obj & (~1));
8772 obj_conv.is_owned = (obj & 1) || (obj == 0);
8773 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8774 *ret = RevokeAndACK_write(&obj_conv);
8778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
8779 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8780 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
8781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
8785 LDKShutdown obj_conv;
8786 obj_conv.inner = (void*)(obj & (~1));
8787 obj_conv.is_owned = (obj & 1) || (obj == 0);
8788 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8789 *ret = Shutdown_write(&obj_conv);
8793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
8794 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8795 LDKShutdown ret = Shutdown_read(ser_conv);
8796 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8800 LDKUpdateFailHTLC obj_conv;
8801 obj_conv.inner = (void*)(obj & (~1));
8802 obj_conv.is_owned = (obj & 1) || (obj == 0);
8803 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8804 *ret = UpdateFailHTLC_write(&obj_conv);
8808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8809 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8810 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
8811 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8815 LDKUpdateFailMalformedHTLC obj_conv;
8816 obj_conv.inner = (void*)(obj & (~1));
8817 obj_conv.is_owned = (obj & 1) || (obj == 0);
8818 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8819 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
8823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8824 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8825 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
8826 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
8830 LDKUpdateFee obj_conv;
8831 obj_conv.inner = (void*)(obj & (~1));
8832 obj_conv.is_owned = (obj & 1) || (obj == 0);
8833 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8834 *ret = UpdateFee_write(&obj_conv);
8838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
8839 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8840 LDKUpdateFee ret = UpdateFee_read(ser_conv);
8841 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8845 LDKUpdateFulfillHTLC obj_conv;
8846 obj_conv.inner = (void*)(obj & (~1));
8847 obj_conv.is_owned = (obj & 1) || (obj == 0);
8848 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8849 *ret = UpdateFulfillHTLC_write(&obj_conv);
8853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8854 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8855 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
8856 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8860 LDKUpdateAddHTLC obj_conv;
8861 obj_conv.inner = (void*)(obj & (~1));
8862 obj_conv.is_owned = (obj & 1) || (obj == 0);
8863 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8864 *ret = UpdateAddHTLC_write(&obj_conv);
8868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8869 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8870 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
8871 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
8876 obj_conv.inner = (void*)(obj & (~1));
8877 obj_conv.is_owned = (obj & 1) || (obj == 0);
8878 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8879 *ret = Ping_write(&obj_conv);
8883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
8884 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8885 LDKPing ret = Ping_read(ser_conv);
8886 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
8891 obj_conv.inner = (void*)(obj & (~1));
8892 obj_conv.is_owned = (obj & 1) || (obj == 0);
8893 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8894 *ret = Pong_write(&obj_conv);
8898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
8899 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8900 LDKPong ret = Pong_read(ser_conv);
8901 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8905 LDKUnsignedChannelAnnouncement obj_conv;
8906 obj_conv.inner = (void*)(obj & (~1));
8907 obj_conv.is_owned = (obj & 1) || (obj == 0);
8908 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8909 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
8913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
8914 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8915 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
8916 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8920 LDKChannelAnnouncement obj_conv;
8921 obj_conv.inner = (void*)(obj & (~1));
8922 obj_conv.is_owned = (obj & 1) || (obj == 0);
8923 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8924 *ret = ChannelAnnouncement_write(&obj_conv);
8928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
8929 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8930 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
8931 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8935 LDKUnsignedChannelUpdate obj_conv;
8936 obj_conv.inner = (void*)(obj & (~1));
8937 obj_conv.is_owned = (obj & 1) || (obj == 0);
8938 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8939 *ret = UnsignedChannelUpdate_write(&obj_conv);
8943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
8944 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8945 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
8946 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8950 LDKChannelUpdate obj_conv;
8951 obj_conv.inner = (void*)(obj & (~1));
8952 obj_conv.is_owned = (obj & 1) || (obj == 0);
8953 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8954 *ret = ChannelUpdate_write(&obj_conv);
8958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
8959 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8960 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
8961 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
8965 LDKErrorMessage obj_conv;
8966 obj_conv.inner = (void*)(obj & (~1));
8967 obj_conv.is_owned = (obj & 1) || (obj == 0);
8968 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8969 *ret = ErrorMessage_write(&obj_conv);
8973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
8974 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8975 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
8976 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8980 LDKUnsignedNodeAnnouncement obj_conv;
8981 obj_conv.inner = (void*)(obj & (~1));
8982 obj_conv.is_owned = (obj & 1) || (obj == 0);
8983 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8984 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
8988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
8989 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8990 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
8991 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8995 LDKNodeAnnouncement obj_conv;
8996 obj_conv.inner = (void*)(obj & (~1));
8997 obj_conv.is_owned = (obj & 1) || (obj == 0);
8998 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8999 *ret = NodeAnnouncement_write(&obj_conv);
9003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9004 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9005 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9006 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9010 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9011 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9012 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9016 LDKQueryShortChannelIds obj_conv;
9017 obj_conv.inner = (void*)(obj & (~1));
9018 obj_conv.is_owned = (obj & 1) || (obj == 0);
9019 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9020 *ret = QueryShortChannelIds_write(&obj_conv);
9024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9025 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9026 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9027 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9031 LDKReplyShortChannelIdsEnd obj_conv;
9032 obj_conv.inner = (void*)(obj & (~1));
9033 obj_conv.is_owned = (obj & 1) || (obj == 0);
9034 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9035 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9040 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9041 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9042 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9046 LDKQueryChannelRange obj_conv;
9047 obj_conv.inner = (void*)(obj & (~1));
9048 obj_conv.is_owned = (obj & 1) || (obj == 0);
9049 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9050 *ret = QueryChannelRange_write(&obj_conv);
9054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9055 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9056 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9057 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9061 LDKReplyChannelRange obj_conv;
9062 obj_conv.inner = (void*)(obj & (~1));
9063 obj_conv.is_owned = (obj & 1) || (obj == 0);
9064 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9065 *ret = ReplyChannelRange_write(&obj_conv);
9069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9070 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9071 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9072 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9076 LDKGossipTimestampFilter obj_conv;
9077 obj_conv.inner = (void*)(obj & (~1));
9078 obj_conv.is_owned = (obj & 1) || (obj == 0);
9079 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9080 *ret = GossipTimestampFilter_write(&obj_conv);
9084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9085 LDKMessageHandler this_ptr_conv;
9086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9088 return MessageHandler_free(this_ptr_conv);
9091 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9092 LDKMessageHandler this_ptr_conv;
9093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9095 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9100 LDKMessageHandler this_ptr_conv;
9101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9103 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9104 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9106 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9108 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9112 LDKMessageHandler this_ptr_conv;
9113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9115 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9120 LDKMessageHandler this_ptr_conv;
9121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9123 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9124 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9125 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9126 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9128 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9132 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9133 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9134 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9135 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9137 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9138 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9139 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9140 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9142 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9143 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9147 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9148 FREE((void*)this_ptr);
9149 return SocketDescriptor_free(this_ptr_conv);
9152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9153 LDKPeerHandleError this_ptr_conv;
9154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9156 return PeerHandleError_free(this_ptr_conv);
9159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9160 LDKPeerHandleError this_ptr_conv;
9161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9163 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9167 LDKPeerHandleError this_ptr_conv;
9168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9170 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9174 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9175 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9179 LDKPeerManager this_ptr_conv;
9180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9182 return PeerManager_free(this_ptr_conv);
9185 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) {
9186 LDKMessageHandler message_handler_conv;
9187 message_handler_conv.inner = (void*)(message_handler & (~1));
9188 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9189 LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
9190 FREE((void*)our_node_secret);
9191 unsigned char ephemeral_random_data_arr[32];
9192 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9193 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9194 LDKLogger logger_conv = *(LDKLogger*)logger;
9195 if (logger_conv.free == LDKLogger_JCalls_free) {
9196 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9197 LDKLogger_JCalls_clone(logger_conv.this_arg);
9199 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
9200 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9204 LDKPeerManager this_arg_conv;
9205 this_arg_conv.inner = (void*)(this_arg & (~1));
9206 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9207 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9208 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9212 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) {
9213 LDKPeerManager this_arg_conv;
9214 this_arg_conv.inner = (void*)(this_arg & (~1));
9215 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9216 LDKPublicKey their_node_id_ref;
9217 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9218 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9219 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9220 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9221 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9223 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9224 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
9228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9229 LDKPeerManager this_arg_conv;
9230 this_arg_conv.inner = (void*)(this_arg & (~1));
9231 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9232 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9233 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9234 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9235 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9237 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9238 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9243 LDKPeerManager this_arg_conv;
9244 this_arg_conv.inner = (void*)(this_arg & (~1));
9245 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9246 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9247 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9248 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9253 LDKPeerManager this_arg_conv;
9254 this_arg_conv.inner = (void*)(this_arg & (~1));
9255 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9256 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9257 LDKu8slice data_conv = *(LDKu8slice*)data;
9258 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9259 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9264 LDKPeerManager this_arg_conv;
9265 this_arg_conv.inner = (void*)(this_arg & (~1));
9266 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9267 return PeerManager_process_events(&this_arg_conv);
9270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9271 LDKPeerManager this_arg_conv;
9272 this_arg_conv.inner = (void*)(this_arg & (~1));
9273 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9274 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9275 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9279 LDKPeerManager this_arg_conv;
9280 this_arg_conv.inner = (void*)(this_arg & (~1));
9281 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9282 return PeerManager_timer_tick_occured(&this_arg_conv);
9285 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9286 unsigned char commitment_seed_arr[32];
9287 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9288 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9289 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9290 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
9295 LDKPublicKey per_commitment_point_ref;
9296 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9297 unsigned char base_secret_arr[32];
9298 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9299 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9300 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9301 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
9305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
9306 LDKPublicKey per_commitment_point_ref;
9307 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9308 LDKPublicKey base_point_ref;
9309 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
9310 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9311 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
9315 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) {
9316 unsigned char per_commitment_secret_arr[32];
9317 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
9318 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
9319 unsigned char countersignatory_revocation_base_secret_arr[32];
9320 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
9321 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
9322 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9323 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
9327 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) {
9328 LDKPublicKey per_commitment_point_ref;
9329 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9330 LDKPublicKey countersignatory_revocation_base_point_ref;
9331 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
9332 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9333 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
9337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9338 LDKTxCreationKeys this_ptr_conv;
9339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9341 return TxCreationKeys_free(this_ptr_conv);
9344 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9345 LDKTxCreationKeys this_ptr_conv;
9346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9348 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9349 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
9353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9354 LDKTxCreationKeys this_ptr_conv;
9355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9357 LDKPublicKey val_ref;
9358 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9359 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
9362 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9363 LDKTxCreationKeys this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9366 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9367 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
9371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9372 LDKTxCreationKeys this_ptr_conv;
9373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9375 LDKPublicKey val_ref;
9376 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9377 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
9380 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9381 LDKTxCreationKeys this_ptr_conv;
9382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9384 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9385 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
9389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9390 LDKTxCreationKeys this_ptr_conv;
9391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9393 LDKPublicKey val_ref;
9394 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9395 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
9398 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9399 LDKTxCreationKeys this_ptr_conv;
9400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9402 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9403 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
9407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9408 LDKTxCreationKeys this_ptr_conv;
9409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9411 LDKPublicKey val_ref;
9412 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9413 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
9416 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9417 LDKTxCreationKeys this_ptr_conv;
9418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9420 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9421 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
9425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9426 LDKTxCreationKeys this_ptr_conv;
9427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9429 LDKPublicKey val_ref;
9430 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9431 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
9434 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) {
9435 LDKPublicKey per_commitment_point_arg_ref;
9436 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
9437 LDKPublicKey revocation_key_arg_ref;
9438 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
9439 LDKPublicKey broadcaster_htlc_key_arg_ref;
9440 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
9441 LDKPublicKey countersignatory_htlc_key_arg_ref;
9442 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
9443 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
9444 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
9445 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);
9446 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9450 LDKTxCreationKeys obj_conv;
9451 obj_conv.inner = (void*)(obj & (~1));
9452 obj_conv.is_owned = (obj & 1) || (obj == 0);
9453 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9454 *ret = TxCreationKeys_write(&obj_conv);
9458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9459 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9460 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
9461 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9465 LDKPreCalculatedTxCreationKeys this_ptr_conv;
9466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9468 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
9471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
9472 LDKTxCreationKeys keys_conv;
9473 keys_conv.inner = (void*)(keys & (~1));
9474 keys_conv.is_owned = (keys & 1) || (keys == 0);
9475 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
9476 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
9480 LDKPreCalculatedTxCreationKeys this_arg_conv;
9481 this_arg_conv.inner = (void*)(this_arg & (~1));
9482 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9483 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
9484 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
9488 LDKPreCalculatedTxCreationKeys this_arg_conv;
9489 this_arg_conv.inner = (void*)(this_arg & (~1));
9490 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9491 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9492 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
9496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9497 LDKChannelPublicKeys this_ptr_conv;
9498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9500 return ChannelPublicKeys_free(this_ptr_conv);
9503 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
9504 LDKChannelPublicKeys this_ptr_conv;
9505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9507 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9508 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
9512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9513 LDKChannelPublicKeys this_ptr_conv;
9514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9516 LDKPublicKey val_ref;
9517 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9518 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
9521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9522 LDKChannelPublicKeys this_ptr_conv;
9523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9525 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9526 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
9530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9531 LDKChannelPublicKeys this_ptr_conv;
9532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9534 LDKPublicKey val_ref;
9535 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9536 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
9539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9540 LDKChannelPublicKeys this_ptr_conv;
9541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9543 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9544 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
9548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9549 LDKChannelPublicKeys this_ptr_conv;
9550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9552 LDKPublicKey val_ref;
9553 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9554 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
9557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9558 LDKChannelPublicKeys this_ptr_conv;
9559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
9566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9567 LDKChannelPublicKeys this_ptr_conv;
9568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9570 LDKPublicKey val_ref;
9571 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9572 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
9575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9576 LDKChannelPublicKeys this_ptr_conv;
9577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9579 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9580 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
9584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9585 LDKChannelPublicKeys this_ptr_conv;
9586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9588 LDKPublicKey val_ref;
9589 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9590 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
9593 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) {
9594 LDKPublicKey funding_pubkey_arg_ref;
9595 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
9596 LDKPublicKey revocation_basepoint_arg_ref;
9597 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
9598 LDKPublicKey payment_point_arg_ref;
9599 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
9600 LDKPublicKey delayed_payment_basepoint_arg_ref;
9601 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
9602 LDKPublicKey htlc_basepoint_arg_ref;
9603 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
9604 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);
9605 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9609 LDKChannelPublicKeys obj_conv;
9610 obj_conv.inner = (void*)(obj & (~1));
9611 obj_conv.is_owned = (obj & 1) || (obj == 0);
9612 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9613 *ret = ChannelPublicKeys_write(&obj_conv);
9617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9618 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9619 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
9620 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9623 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) {
9624 LDKPublicKey per_commitment_point_ref;
9625 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9626 LDKPublicKey broadcaster_delayed_payment_base_ref;
9627 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
9628 LDKPublicKey broadcaster_htlc_base_ref;
9629 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
9630 LDKPublicKey countersignatory_revocation_base_ref;
9631 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
9632 LDKPublicKey countersignatory_htlc_base_ref;
9633 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
9634 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
9635 *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);
9639 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) {
9640 LDKPublicKey revocation_key_ref;
9641 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
9642 LDKPublicKey broadcaster_delayed_payment_key_ref;
9643 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
9644 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9645 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
9649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9650 LDKHTLCOutputInCommitment this_ptr_conv;
9651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9652 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9653 return HTLCOutputInCommitment_free(this_ptr_conv);
9656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
9657 LDKHTLCOutputInCommitment this_ptr_conv;
9658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9659 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9660 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
9663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9664 LDKHTLCOutputInCommitment this_ptr_conv;
9665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9667 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
9670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9671 LDKHTLCOutputInCommitment this_ptr_conv;
9672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9674 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
9677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9678 LDKHTLCOutputInCommitment this_ptr_conv;
9679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9681 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
9684 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9685 LDKHTLCOutputInCommitment this_ptr_conv;
9686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9688 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
9691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9692 LDKHTLCOutputInCommitment this_ptr_conv;
9693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9695 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
9698 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9699 LDKHTLCOutputInCommitment this_ptr_conv;
9700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9702 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9703 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
9707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9708 LDKHTLCOutputInCommitment this_ptr_conv;
9709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9711 LDKThirtyTwoBytes val_ref;
9712 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9713 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
9716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
9717 LDKHTLCOutputInCommitment obj_conv;
9718 obj_conv.inner = (void*)(obj & (~1));
9719 obj_conv.is_owned = (obj & 1) || (obj == 0);
9720 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9721 *ret = HTLCOutputInCommitment_write(&obj_conv);
9725 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
9726 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9727 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
9728 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
9732 LDKHTLCOutputInCommitment htlc_conv;
9733 htlc_conv.inner = (void*)(htlc & (~1));
9734 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9735 LDKTxCreationKeys keys_conv;
9736 keys_conv.inner = (void*)(keys & (~1));
9737 keys_conv.is_owned = (keys & 1) || (keys == 0);
9738 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9739 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
9743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
9744 LDKPublicKey broadcaster_ref;
9745 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
9746 LDKPublicKey countersignatory_ref;
9747 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
9748 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9749 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
9753 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) {
9754 unsigned char prev_hash_arr[32];
9755 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
9756 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
9757 LDKHTLCOutputInCommitment htlc_conv;
9758 htlc_conv.inner = (void*)(htlc & (~1));
9759 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9760 LDKPublicKey broadcaster_delayed_payment_key_ref;
9761 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
9762 LDKPublicKey revocation_key_ref;
9763 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
9764 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9765 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
9769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9770 LDKHolderCommitmentTransaction this_ptr_conv;
9771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9773 return HolderCommitmentTransaction_free(this_ptr_conv);
9776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
9777 LDKHolderCommitmentTransaction this_ptr_conv;
9778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9780 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9781 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
9785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9786 LDKHolderCommitmentTransaction this_ptr_conv;
9787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9789 LDKTransaction val_conv = *(LDKTransaction*)val;
9791 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
9794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
9795 LDKHolderCommitmentTransaction this_ptr_conv;
9796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9798 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
9799 *ret = HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv);
9803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9804 LDKHolderCommitmentTransaction this_ptr_conv;
9805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9807 LDKSignature val_conv = *(LDKSignature*)val;
9809 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_conv);
9812 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9813 LDKHolderCommitmentTransaction this_ptr_conv;
9814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9816 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
9819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9820 LDKHolderCommitmentTransaction this_ptr_conv;
9821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9823 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
9826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9827 LDKHolderCommitmentTransaction this_ptr_conv;
9828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9830 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
9832 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
9835 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) {
9836 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
9837 FREE((void*)unsigned_tx);
9838 LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
9839 FREE((void*)counterparty_sig);
9840 LDKPublicKey holder_funding_key_ref;
9841 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
9842 LDKPublicKey counterparty_funding_key_ref;
9843 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
9844 LDKTxCreationKeys keys_conv;
9845 keys_conv.inner = (void*)(keys & (~1));
9846 keys_conv.is_owned = (keys & 1) || (keys == 0);
9847 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
9848 FREE((void*)htlc_data);
9849 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);
9850 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
9854 LDKHolderCommitmentTransaction this_arg_conv;
9855 this_arg_conv.inner = (void*)(this_arg & (~1));
9856 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9857 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
9858 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9861 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
9862 LDKHolderCommitmentTransaction this_arg_conv;
9863 this_arg_conv.inner = (void*)(this_arg & (~1));
9864 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9865 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9866 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
9870 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) {
9871 LDKHolderCommitmentTransaction this_arg_conv;
9872 this_arg_conv.inner = (void*)(this_arg & (~1));
9873 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9874 unsigned char funding_key_arr[32];
9875 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
9876 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
9877 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
9878 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
9879 *ret = HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
9883 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) {
9884 LDKHolderCommitmentTransaction this_arg_conv;
9885 this_arg_conv.inner = (void*)(this_arg & (~1));
9886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9887 unsigned char htlc_base_key_arr[32];
9888 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
9889 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
9890 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9891 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
9895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
9896 LDKHolderCommitmentTransaction obj_conv;
9897 obj_conv.inner = (void*)(obj & (~1));
9898 obj_conv.is_owned = (obj & 1) || (obj == 0);
9899 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9900 *ret = HolderCommitmentTransaction_write(&obj_conv);
9904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
9905 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9906 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
9907 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9911 LDKInitFeatures this_ptr_conv;
9912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9914 return InitFeatures_free(this_ptr_conv);
9917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9918 LDKNodeFeatures 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 NodeFeatures_free(this_ptr_conv);
9924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9925 LDKChannelFeatures 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 return ChannelFeatures_free(this_ptr_conv);
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9932 LDKRouteHop this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9935 return RouteHop_free(this_ptr_conv);
9938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
9939 LDKRouteHop this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9942 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9943 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
9947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9948 LDKRouteHop this_ptr_conv;
9949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9951 LDKPublicKey val_ref;
9952 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9953 return RouteHop_set_pubkey(&this_ptr_conv, val_ref);
9956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9957 LDKRouteHop this_ptr_conv;
9958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9960 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
9961 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9965 LDKRouteHop this_ptr_conv;
9966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9968 LDKNodeFeatures val_conv;
9969 val_conv.inner = (void*)(val & (~1));
9970 val_conv.is_owned = (val & 1) || (val == 0);
9971 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
9974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9975 LDKRouteHop 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 return RouteHop_get_short_channel_id(&this_ptr_conv);
9981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9982 LDKRouteHop this_ptr_conv;
9983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9985 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
9988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9989 LDKRouteHop this_ptr_conv;
9990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9992 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
9993 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9997 LDKRouteHop this_ptr_conv;
9998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10000 LDKChannelFeatures val_conv;
10001 val_conv.inner = (void*)(val & (~1));
10002 val_conv.is_owned = (val & 1) || (val == 0);
10003 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10007 LDKRouteHop this_ptr_conv;
10008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10010 return RouteHop_get_fee_msat(&this_ptr_conv);
10013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10014 LDKRouteHop this_ptr_conv;
10015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10017 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10020 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10021 LDKRouteHop this_ptr_conv;
10022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10024 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10028 LDKRouteHop this_ptr_conv;
10029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10031 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10034 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) {
10035 LDKPublicKey pubkey_arg_ref;
10036 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
10037 LDKNodeFeatures node_features_arg_conv;
10038 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10039 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10040 LDKChannelFeatures channel_features_arg_conv;
10041 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10042 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10043 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);
10044 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10048 LDKRoute this_ptr_conv;
10049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10051 return Route_free(this_ptr_conv);
10054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10055 LDKRoute this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10058 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10060 return Route_set_paths(&this_ptr_conv, val_conv);
10063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10064 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10065 FREE((void*)paths_arg);
10066 LDKRoute ret = Route_new(paths_arg_conv);
10067 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10072 obj_conv.inner = (void*)(obj & (~1));
10073 obj_conv.is_owned = (obj & 1) || (obj == 0);
10074 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10075 *ret = Route_write(&obj_conv);
10079 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10080 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10081 LDKRoute ret = Route_read(ser_conv);
10082 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10086 LDKRouteHint this_ptr_conv;
10087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10089 return RouteHint_free(this_ptr_conv);
10092 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10093 LDKRouteHint this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10096 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10097 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
10101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10102 LDKRouteHint this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10105 LDKPublicKey val_ref;
10106 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10107 return RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
10110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10111 LDKRouteHint this_ptr_conv;
10112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10114 return RouteHint_get_short_channel_id(&this_ptr_conv);
10117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10118 LDKRouteHint this_ptr_conv;
10119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10121 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10125 LDKRouteHint this_ptr_conv;
10126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10128 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10129 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10133 LDKRouteHint this_ptr_conv;
10134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10136 LDKRoutingFees val_conv;
10137 val_conv.inner = (void*)(val & (~1));
10138 val_conv.is_owned = (val & 1) || (val == 0);
10139 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10142 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10143 LDKRouteHint this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10146 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10150 LDKRouteHint this_ptr_conv;
10151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10153 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10157 LDKRouteHint this_ptr_conv;
10158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10160 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10164 LDKRouteHint this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10167 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10170 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) {
10171 LDKPublicKey src_node_id_arg_ref;
10172 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
10173 LDKRoutingFees fees_arg_conv;
10174 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10175 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10176 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10177 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10180 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) {
10181 LDKPublicKey our_node_id_ref;
10182 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
10183 LDKNetworkGraph network_conv;
10184 network_conv.inner = (void*)(network & (~1));
10185 network_conv.is_owned = (network & 1) || (network == 0);
10186 LDKPublicKey target_ref;
10187 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
10188 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10189 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10190 FREE((void*)last_hops);
10191 LDKLogger logger_conv = *(LDKLogger*)logger;
10192 if (logger_conv.free == LDKLogger_JCalls_free) {
10193 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10194 LDKLogger_JCalls_clone(logger_conv.this_arg);
10196 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10197 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10202 LDKNetworkGraph this_ptr_conv;
10203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10205 return NetworkGraph_free(this_ptr_conv);
10208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10209 LDKLockedNetworkGraph this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10212 return LockedNetworkGraph_free(this_ptr_conv);
10215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10216 LDKNetGraphMsgHandler this_ptr_conv;
10217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10219 return NetGraphMsgHandler_free(this_ptr_conv);
10222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
10223 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10224 LDKLogger logger_conv = *(LDKLogger*)logger;
10225 if (logger_conv.free == LDKLogger_JCalls_free) {
10226 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10227 LDKLogger_JCalls_clone(logger_conv.this_arg);
10229 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
10230 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
10234 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10235 LDKLogger logger_conv = *(LDKLogger*)logger;
10236 if (logger_conv.free == LDKLogger_JCalls_free) {
10237 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10238 LDKLogger_JCalls_clone(logger_conv.this_arg);
10240 LDKNetworkGraph network_graph_conv;
10241 network_graph_conv.inner = (void*)(network_graph & (~1));
10242 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
10243 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
10244 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10248 LDKNetGraphMsgHandler this_arg_conv;
10249 this_arg_conv.inner = (void*)(this_arg & (~1));
10250 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10251 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
10252 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10256 LDKLockedNetworkGraph this_arg_conv;
10257 this_arg_conv.inner = (void*)(this_arg & (~1));
10258 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10259 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
10260 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
10264 LDKNetGraphMsgHandler this_arg_conv;
10265 this_arg_conv.inner = (void*)(this_arg & (~1));
10266 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10267 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10268 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
10272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10273 LDKDirectionalChannelInfo 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 return DirectionalChannelInfo_free(this_ptr_conv);
10279 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10280 LDKDirectionalChannelInfo this_ptr_conv;
10281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10283 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
10286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10287 LDKDirectionalChannelInfo this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10290 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
10293 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
10294 LDKDirectionalChannelInfo this_ptr_conv;
10295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10297 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
10300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10301 LDKDirectionalChannelInfo this_ptr_conv;
10302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10304 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
10307 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10308 LDKDirectionalChannelInfo this_ptr_conv;
10309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10311 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
10314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10315 LDKDirectionalChannelInfo this_ptr_conv;
10316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10318 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
10321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10322 LDKDirectionalChannelInfo this_ptr_conv;
10323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10325 return DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
10328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10329 LDKDirectionalChannelInfo this_ptr_conv;
10330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10332 return DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
10335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10336 LDKDirectionalChannelInfo this_ptr_conv;
10337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10339 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
10340 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10344 LDKDirectionalChannelInfo this_ptr_conv;
10345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10347 LDKChannelUpdate val_conv;
10348 val_conv.inner = (void*)(val & (~1));
10349 val_conv.is_owned = (val & 1) || (val == 0);
10350 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
10353 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10354 LDKDirectionalChannelInfo obj_conv;
10355 obj_conv.inner = (void*)(obj & (~1));
10356 obj_conv.is_owned = (obj & 1) || (obj == 0);
10357 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10358 *ret = DirectionalChannelInfo_write(&obj_conv);
10362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10363 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10364 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
10365 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10369 LDKChannelInfo this_ptr_conv;
10370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10372 return ChannelInfo_free(this_ptr_conv);
10375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10376 LDKChannelInfo this_ptr_conv;
10377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10379 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
10380 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10384 LDKChannelInfo this_ptr_conv;
10385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10387 LDKChannelFeatures val_conv;
10388 val_conv.inner = (void*)(val & (~1));
10389 val_conv.is_owned = (val & 1) || (val == 0);
10390 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
10393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10394 LDKChannelInfo this_ptr_conv;
10395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10397 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10398 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
10402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10403 LDKChannelInfo this_ptr_conv;
10404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10406 LDKPublicKey val_ref;
10407 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10408 return ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
10411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10412 LDKChannelInfo this_ptr_conv;
10413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10415 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
10416 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10420 LDKChannelInfo this_ptr_conv;
10421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10423 LDKDirectionalChannelInfo val_conv;
10424 val_conv.inner = (void*)(val & (~1));
10425 val_conv.is_owned = (val & 1) || (val == 0);
10426 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
10429 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10430 LDKChannelInfo this_ptr_conv;
10431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10433 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10434 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
10438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10439 LDKChannelInfo this_ptr_conv;
10440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10442 LDKPublicKey val_ref;
10443 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10444 return ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
10447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10448 LDKChannelInfo this_ptr_conv;
10449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10451 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
10452 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10456 LDKChannelInfo 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 LDKDirectionalChannelInfo val_conv;
10460 val_conv.inner = (void*)(val & (~1));
10461 val_conv.is_owned = (val & 1) || (val == 0);
10462 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
10465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10466 LDKChannelInfo this_ptr_conv;
10467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10469 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
10470 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10474 LDKChannelInfo this_ptr_conv;
10475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10477 LDKChannelAnnouncement val_conv;
10478 val_conv.inner = (void*)(val & (~1));
10479 val_conv.is_owned = (val & 1) || (val == 0);
10480 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
10483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10484 LDKChannelInfo obj_conv;
10485 obj_conv.inner = (void*)(obj & (~1));
10486 obj_conv.is_owned = (obj & 1) || (obj == 0);
10487 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10488 *ret = ChannelInfo_write(&obj_conv);
10492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10493 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10494 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
10495 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10499 LDKRoutingFees this_ptr_conv;
10500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10502 return RoutingFees_free(this_ptr_conv);
10505 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10506 LDKRoutingFees this_ptr_conv;
10507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10509 return RoutingFees_get_base_msat(&this_ptr_conv);
10512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10513 LDKRoutingFees this_ptr_conv;
10514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10516 return RoutingFees_set_base_msat(&this_ptr_conv, val);
10519 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10520 LDKRoutingFees this_ptr_conv;
10521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10523 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
10526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10527 LDKRoutingFees this_ptr_conv;
10528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10530 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
10533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
10534 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
10535 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
10539 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10540 LDKRoutingFees ret = RoutingFees_read(ser_conv);
10541 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
10545 LDKRoutingFees obj_conv;
10546 obj_conv.inner = (void*)(obj & (~1));
10547 obj_conv.is_owned = (obj & 1) || (obj == 0);
10548 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10549 *ret = RoutingFees_write(&obj_conv);
10553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10554 LDKNodeAnnouncementInfo this_ptr_conv;
10555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10557 return NodeAnnouncementInfo_free(this_ptr_conv);
10560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10561 LDKNodeAnnouncementInfo this_ptr_conv;
10562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10564 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
10565 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10569 LDKNodeAnnouncementInfo this_ptr_conv;
10570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10572 LDKNodeFeatures val_conv;
10573 val_conv.inner = (void*)(val & (~1));
10574 val_conv.is_owned = (val & 1) || (val == 0);
10575 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
10578 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10579 LDKNodeAnnouncementInfo this_ptr_conv;
10580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10582 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
10585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10586 LDKNodeAnnouncementInfo this_ptr_conv;
10587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10589 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
10592 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
10593 LDKNodeAnnouncementInfo this_ptr_conv;
10594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10596 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
10597 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
10601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10602 LDKNodeAnnouncementInfo this_ptr_conv;
10603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10605 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
10607 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
10610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
10611 LDKNodeAnnouncementInfo this_ptr_conv;
10612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10614 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10615 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
10619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10620 LDKNodeAnnouncementInfo this_ptr_conv;
10621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10623 LDKThirtyTwoBytes val_ref;
10624 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10625 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
10628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10629 LDKNodeAnnouncementInfo this_ptr_conv;
10630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10632 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
10634 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
10637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10638 LDKNodeAnnouncementInfo this_ptr_conv;
10639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10641 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
10642 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10646 LDKNodeAnnouncementInfo this_ptr_conv;
10647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10649 LDKNodeAnnouncement val_conv;
10650 val_conv.inner = (void*)(val & (~1));
10651 val_conv.is_owned = (val & 1) || (val == 0);
10652 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
10655 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) {
10656 LDKNodeFeatures features_arg_conv;
10657 features_arg_conv.inner = (void*)(features_arg & (~1));
10658 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
10659 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
10660 FREE((void*)rgb_arg);
10661 LDKThirtyTwoBytes alias_arg_ref;
10662 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
10663 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
10664 FREE((void*)addresses_arg);
10665 LDKNodeAnnouncement announcement_message_arg_conv;
10666 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
10667 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
10668 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
10669 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10673 LDKNodeAnnouncementInfo obj_conv;
10674 obj_conv.inner = (void*)(obj & (~1));
10675 obj_conv.is_owned = (obj & 1) || (obj == 0);
10676 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10677 *ret = NodeAnnouncementInfo_write(&obj_conv);
10681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10682 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10683 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
10684 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10688 LDKNodeInfo this_ptr_conv;
10689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10691 return NodeInfo_free(this_ptr_conv);
10694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10695 LDKNodeInfo this_ptr_conv;
10696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10698 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
10700 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
10703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10704 LDKNodeInfo this_ptr_conv;
10705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10707 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
10708 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10712 LDKNodeInfo this_ptr_conv;
10713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10715 LDKRoutingFees val_conv;
10716 val_conv.inner = (void*)(val & (~1));
10717 val_conv.is_owned = (val & 1) || (val == 0);
10718 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
10721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
10722 LDKNodeInfo this_ptr_conv;
10723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10725 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
10726 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10730 LDKNodeInfo this_ptr_conv;
10731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10733 LDKNodeAnnouncementInfo val_conv;
10734 val_conv.inner = (void*)(val & (~1));
10735 val_conv.is_owned = (val & 1) || (val == 0);
10736 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
10739 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) {
10740 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
10741 FREE((void*)channels_arg);
10742 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
10743 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
10744 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
10745 LDKNodeAnnouncementInfo announcement_info_arg_conv;
10746 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
10747 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
10748 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
10749 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10753 LDKNodeInfo obj_conv;
10754 obj_conv.inner = (void*)(obj & (~1));
10755 obj_conv.is_owned = (obj & 1) || (obj == 0);
10756 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10757 *ret = NodeInfo_write(&obj_conv);
10761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10762 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10763 LDKNodeInfo ret = NodeInfo_read(ser_conv);
10764 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10767 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
10768 LDKNetworkGraph obj_conv;
10769 obj_conv.inner = (void*)(obj & (~1));
10770 obj_conv.is_owned = (obj & 1) || (obj == 0);
10771 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10772 *ret = NetworkGraph_write(&obj_conv);
10776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
10777 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10778 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
10779 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
10783 LDKNetworkGraph ret = NetworkGraph_new();
10784 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10787 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) {
10788 LDKNetworkGraph this_arg_conv;
10789 this_arg_conv.inner = (void*)(this_arg & (~1));
10790 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10791 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);