1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Running a leak check across all the allocations and frees of the JDK is a mess,
10 // so instead we implement our own naive leak checker here, relying on the -wrap
11 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
12 // and free'd in Rust or C across the generated bindings shared library.
16 static mtx_t allocation_mtx;
18 void __attribute__((constructor)) init_mtx() {
19 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
23 typedef struct allocation {
24 struct allocation* next;
26 const char* struct_name;
30 static allocation* allocation_ll = NULL;
32 void* __real_malloc(size_t len);
33 void* __real_calloc(size_t nmemb, size_t len);
34 static void new_allocation(void* res, const char* struct_name) {
35 allocation* new_alloc = __real_malloc(sizeof(allocation));
37 new_alloc->struct_name = struct_name;
38 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
39 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
40 new_alloc->next = allocation_ll;
41 allocation_ll = new_alloc;
42 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
44 static void* MALLOC(size_t len, const char* struct_name) {
45 void* res = __real_malloc(len);
46 new_allocation(res, struct_name);
49 void __real_free(void* ptr);
50 static void alloc_freed(void* ptr) {
52 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
53 allocation* it = allocation_ll;
54 while (it->ptr != ptr) { p = it; it = it->next; }
55 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
56 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
57 DO_ASSERT(it->ptr == ptr);
60 static void FREE(void* ptr) {
65 void* __wrap_malloc(size_t len) {
66 void* res = __real_malloc(len);
67 new_allocation(res, "malloc call");
70 void* __wrap_calloc(size_t nmemb, size_t len) {
71 void* res = __real_calloc(nmemb, len);
72 new_allocation(res, "calloc call");
75 void __wrap_free(void* ptr) {
80 void* __real_realloc(void* ptr, size_t newlen);
81 void* __wrap_realloc(void* ptr, size_t len) {
83 void* res = __real_realloc(ptr, len);
84 new_allocation(res, "realloc call");
87 void __wrap_reallocarray(void* ptr, size_t new_sz) {
88 // Rust doesn't seem to use reallocarray currently
92 void __attribute__((destructor)) check_leaks() {
93 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
94 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
95 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
96 fprintf(stderr, "\n\n");
98 DO_ASSERT(allocation_ll == NULL);
101 static jmethodID ordinal_meth = NULL;
102 static jmethodID slicedef_meth = NULL;
103 static jclass slicedef_cls = NULL;
104 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
105 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
106 DO_ASSERT(ordinal_meth != NULL);
107 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
108 DO_ASSERT(slicedef_meth != NULL);
109 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
110 DO_ASSERT(slicedef_cls != NULL);
113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
114 return *((bool*)ptr);
116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
117 return *((long*)ptr);
119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
122 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
123 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
124 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
127 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
128 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
129 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
130 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
133 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
134 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
135 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
136 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
137 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
140 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
141 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
142 txdata->datalen = (*env)->GetArrayLength(env, bytes);
143 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
144 txdata->data_is_owned = true;
145 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
149 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
150 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
151 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
152 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
153 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
154 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
155 return (long)vec->datalen;
157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
158 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
159 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
160 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
161 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
162 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
163 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
169 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
170 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
171 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
172 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
174 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
175 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
176 case 0: return LDKAccessError_UnknownChain;
177 case 1: return LDKAccessError_UnknownTx;
181 static jclass LDKAccessError_class = NULL;
182 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
183 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
184 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
185 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
186 DO_ASSERT(LDKAccessError_class != NULL);
187 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
188 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownChain != NULL);
189 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
190 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownTx != NULL);
192 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
194 case LDKAccessError_UnknownChain:
195 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
196 case LDKAccessError_UnknownTx:
197 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
202 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
203 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
204 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
205 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
209 static jclass LDKChannelMonitorUpdateErr_class = NULL;
210 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
211 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
212 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
213 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
214 DO_ASSERT(LDKChannelMonitorUpdateErr_class != NULL);
215 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
216 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
217 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
218 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
220 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
222 case LDKChannelMonitorUpdateErr_TemporaryFailure:
223 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
224 case LDKChannelMonitorUpdateErr_PermanentFailure:
225 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
230 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
231 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
232 case 0: return LDKConfirmationTarget_Background;
233 case 1: return LDKConfirmationTarget_Normal;
234 case 2: return LDKConfirmationTarget_HighPriority;
238 static jclass LDKConfirmationTarget_class = NULL;
239 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
240 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
241 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
242 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
243 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
244 DO_ASSERT(LDKConfirmationTarget_class != NULL);
245 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
246 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
247 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
248 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
252 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
254 case LDKConfirmationTarget_Background:
255 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
256 case LDKConfirmationTarget_Normal:
257 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
258 case LDKConfirmationTarget_HighPriority:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
264 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
265 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
266 case 0: return LDKLevel_Off;
267 case 1: return LDKLevel_Error;
268 case 2: return LDKLevel_Warn;
269 case 3: return LDKLevel_Info;
270 case 4: return LDKLevel_Debug;
271 case 5: return LDKLevel_Trace;
275 static jclass LDKLevel_class = NULL;
276 static jfieldID LDKLevel_LDKLevel_Off = NULL;
277 static jfieldID LDKLevel_LDKLevel_Error = NULL;
278 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
279 static jfieldID LDKLevel_LDKLevel_Info = NULL;
280 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
281 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
282 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
283 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
284 DO_ASSERT(LDKLevel_class != NULL);
285 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
286 DO_ASSERT(LDKLevel_LDKLevel_Off != NULL);
287 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
288 DO_ASSERT(LDKLevel_LDKLevel_Error != NULL);
289 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
290 DO_ASSERT(LDKLevel_LDKLevel_Warn != NULL);
291 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
292 DO_ASSERT(LDKLevel_LDKLevel_Info != NULL);
293 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
294 DO_ASSERT(LDKLevel_LDKLevel_Debug != NULL);
295 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
296 DO_ASSERT(LDKLevel_LDKLevel_Trace != NULL);
298 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
301 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
303 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
316 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
317 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
318 case 0: return LDKNetwork_Bitcoin;
319 case 1: return LDKNetwork_Testnet;
320 case 2: return LDKNetwork_Regtest;
324 static jclass LDKNetwork_class = NULL;
325 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
326 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
327 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
328 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
329 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
330 DO_ASSERT(LDKNetwork_class != NULL);
331 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
332 DO_ASSERT(LDKNetwork_LDKNetwork_Bitcoin != NULL);
333 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
334 DO_ASSERT(LDKNetwork_LDKNetwork_Testnet != NULL);
335 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
336 DO_ASSERT(LDKNetwork_LDKNetwork_Regtest != NULL);
338 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
340 case LDKNetwork_Bitcoin:
341 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
342 case LDKNetwork_Testnet:
343 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
344 case LDKNetwork_Regtest:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
350 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
351 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
352 case 0: return LDKSecp256k1Error_IncorrectSignature;
353 case 1: return LDKSecp256k1Error_InvalidMessage;
354 case 2: return LDKSecp256k1Error_InvalidPublicKey;
355 case 3: return LDKSecp256k1Error_InvalidSignature;
356 case 4: return LDKSecp256k1Error_InvalidSecretKey;
357 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
358 case 6: return LDKSecp256k1Error_InvalidTweak;
359 case 7: return LDKSecp256k1Error_NotEnoughMemory;
360 case 8: return LDKSecp256k1Error_CallbackPanicked;
364 static jclass LDKSecp256k1Error_class = NULL;
365 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
366 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
367 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
368 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
374 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
375 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
376 DO_ASSERT(LDKSecp256k1Error_class != NULL);
377 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
378 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
379 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
380 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
396 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
398 case LDKSecp256k1Error_IncorrectSignature:
399 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
400 case LDKSecp256k1Error_InvalidMessage:
401 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
402 case LDKSecp256k1Error_InvalidPublicKey:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
404 case LDKSecp256k1Error_InvalidSignature:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
406 case LDKSecp256k1Error_InvalidSecretKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
408 case LDKSecp256k1Error_InvalidRecoveryId:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
410 case LDKSecp256k1Error_InvalidTweak:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
412 case LDKSecp256k1Error_NotEnoughMemory:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
414 case LDKSecp256k1Error_CallbackPanicked:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
421 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
422 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
425 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
426 ret->datalen = (*env)->GetArrayLength(env, elems);
427 if (ret->datalen == 0) {
430 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
431 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
432 for (size_t i = 0; i < ret->datalen; i++) {
433 ret->data[i] = java_elems[i];
435 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
440 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
442 LDKTransaction b_conv = *(LDKTransaction*)b;
447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
448 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
451 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
452 if (val->result_ok) {
453 return (long)val->contents.result;
455 return (long)val->contents.err;
458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
459 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
462 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
463 if (val->result_ok) {
464 return (long)val->contents.result;
466 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
470 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
472 a_conv.inner = (void*)(a & (~1));
473 a_conv.is_owned = (a & 1) || (a == 0);
474 if (a_conv.inner != NULL)
475 a_conv = OutPoint_clone(&a_conv);
477 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
482 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
483 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
484 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
487 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
488 ret->datalen = (*env)->GetArrayLength(env, elems);
489 if (ret->datalen == 0) {
492 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
493 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
494 for (size_t i = 0; i < ret->datalen; i++) {
495 jlong arr_elem = java_elems[i];
496 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
497 FREE((void*)arr_elem);
498 ret->data[i] = arr_elem_conv;
500 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
505 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
506 LDKThirtyTwoBytes a_ref;
507 DO_ASSERT((*_env)->GetArrayLength (_env, a) == 32);
508 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
510 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
516 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
521 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
522 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
523 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
526 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
528 DO_ASSERT((*_env)->GetArrayLength (_env, a) == 64);
529 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
531 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
537 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
540 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
541 if (val->result_ok) {
542 return (long)val->contents.result;
544 return (long)val->contents.err;
547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
548 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
551 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
552 if (val->result_ok) {
553 return (long)val->contents.result;
555 return (long)val->contents.err;
558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
559 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
562 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
563 if (val->result_ok) {
564 return (long)val->contents.result;
566 return (long)val->contents.err;
569 static jclass LDKAPIError_APIMisuseError_class = NULL;
570 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
571 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
572 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
573 static jclass LDKAPIError_RouteError_class = NULL;
574 static jmethodID LDKAPIError_RouteError_meth = NULL;
575 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
576 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
577 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
578 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
580 LDKAPIError_APIMisuseError_class =
581 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
582 DO_ASSERT(LDKAPIError_APIMisuseError_class != NULL);
583 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
584 DO_ASSERT(LDKAPIError_APIMisuseError_meth != NULL);
585 LDKAPIError_FeeRateTooHigh_class =
586 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
587 DO_ASSERT(LDKAPIError_FeeRateTooHigh_class != NULL);
588 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
589 DO_ASSERT(LDKAPIError_FeeRateTooHigh_meth != NULL);
590 LDKAPIError_RouteError_class =
591 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
592 DO_ASSERT(LDKAPIError_RouteError_class != NULL);
593 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
594 DO_ASSERT(LDKAPIError_RouteError_meth != NULL);
595 LDKAPIError_ChannelUnavailable_class =
596 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
597 DO_ASSERT(LDKAPIError_ChannelUnavailable_class != NULL);
598 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
599 DO_ASSERT(LDKAPIError_ChannelUnavailable_meth != NULL);
600 LDKAPIError_MonitorUpdateFailed_class =
601 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
602 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_class != NULL);
603 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
604 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_meth != NULL);
606 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
607 LDKAPIError *obj = (LDKAPIError*)ptr;
609 case LDKAPIError_APIMisuseError: {
610 long err_ref = (long)&obj->api_misuse_error.err;
611 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
613 case LDKAPIError_FeeRateTooHigh: {
614 long err_ref = (long)&obj->fee_rate_too_high.err;
615 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
617 case LDKAPIError_RouteError: {
618 long err_ref = (long)&obj->route_error.err;
619 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
621 case LDKAPIError_ChannelUnavailable: {
622 long err_ref = (long)&obj->channel_unavailable.err;
623 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
625 case LDKAPIError_MonitorUpdateFailed: {
626 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
631 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
632 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
635 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
636 if (val->result_ok) {
637 return (long)val->contents.result;
639 return (long)val->contents.err;
642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
643 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
646 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
647 if (val->result_ok) {
648 return (long)val->contents.result;
650 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
653 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) {
654 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
655 LDKChannelAnnouncement a_conv;
656 a_conv.inner = (void*)(a & (~1));
657 a_conv.is_owned = (a & 1) || (a == 0);
658 if (a_conv.inner != NULL)
659 a_conv = ChannelAnnouncement_clone(&a_conv);
661 LDKChannelUpdate b_conv;
662 b_conv.inner = (void*)(b & (~1));
663 b_conv.is_owned = (b & 1) || (b == 0);
664 if (b_conv.inner != NULL)
665 b_conv = ChannelUpdate_clone(&b_conv);
667 LDKChannelUpdate c_conv;
668 c_conv.inner = (void*)(c & (~1));
669 c_conv.is_owned = (c & 1) || (c == 0);
670 if (c_conv.inner != NULL)
671 c_conv = ChannelUpdate_clone(&c_conv);
675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
676 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
679 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
680 if (val->result_ok) {
681 return (long)val->contents.result;
683 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
687 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
688 LDKHTLCOutputInCommitment a_conv;
689 a_conv.inner = (void*)(a & (~1));
690 a_conv.is_owned = (a & 1) || (a == 0);
691 if (a_conv.inner != NULL)
692 a_conv = HTLCOutputInCommitment_clone(&a_conv);
695 DO_ASSERT((*_env)->GetArrayLength (_env, b) == 64);
696 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
700 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
701 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
702 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
703 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
704 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
705 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
707 LDKSpendableOutputDescriptor_StaticOutput_class =
708 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
709 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
710 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
711 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
712 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
713 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
714 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
715 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
716 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
717 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
718 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
719 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
720 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
721 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
723 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
724 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
726 case LDKSpendableOutputDescriptor_StaticOutput: {
727 LDKOutPoint outpoint_var = obj->static_output.outpoint;
728 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
729 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
731 if (outpoint_var.is_owned) {
732 outpoint_ref = (long)outpoint_var.inner | 1;
734 outpoint_ref = (long)&outpoint_var;
736 long output_ref = (long)&obj->static_output.output;
737 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
739 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
740 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
741 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
742 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
744 if (outpoint_var.is_owned) {
745 outpoint_ref = (long)outpoint_var.inner | 1;
747 outpoint_ref = (long)&outpoint_var;
749 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
750 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
751 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
752 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
753 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
754 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
755 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);
757 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
758 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
759 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
760 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 if (outpoint_var.is_owned) {
763 outpoint_ref = (long)outpoint_var.inner | 1;
765 outpoint_ref = (long)&outpoint_var;
767 long output_ref = (long)&obj->static_output_counterparty_payment.output;
768 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
769 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
774 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
775 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
776 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
779 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
780 ret->datalen = (*env)->GetArrayLength(env, elems);
781 if (ret->datalen == 0) {
784 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
785 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
786 for (size_t i = 0; i < ret->datalen; i++) {
787 jlong arr_elem = java_elems[i];
788 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
789 FREE((void*)arr_elem);
790 ret->data[i] = arr_elem_conv;
792 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
796 static jclass LDKEvent_FundingGenerationReady_class = NULL;
797 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
798 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
799 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
800 static jclass LDKEvent_PaymentReceived_class = NULL;
801 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
802 static jclass LDKEvent_PaymentSent_class = NULL;
803 static jmethodID LDKEvent_PaymentSent_meth = NULL;
804 static jclass LDKEvent_PaymentFailed_class = NULL;
805 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
806 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
807 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
808 static jclass LDKEvent_SpendableOutputs_class = NULL;
809 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
811 LDKEvent_FundingGenerationReady_class =
812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
813 DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL);
814 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
815 DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL);
816 LDKEvent_FundingBroadcastSafe_class =
817 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
818 DO_ASSERT(LDKEvent_FundingBroadcastSafe_class != NULL);
819 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
820 DO_ASSERT(LDKEvent_FundingBroadcastSafe_meth != NULL);
821 LDKEvent_PaymentReceived_class =
822 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
823 DO_ASSERT(LDKEvent_PaymentReceived_class != NULL);
824 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
825 DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL);
826 LDKEvent_PaymentSent_class =
827 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
828 DO_ASSERT(LDKEvent_PaymentSent_class != NULL);
829 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
830 DO_ASSERT(LDKEvent_PaymentSent_meth != NULL);
831 LDKEvent_PaymentFailed_class =
832 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
833 DO_ASSERT(LDKEvent_PaymentFailed_class != NULL);
834 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
835 DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL);
836 LDKEvent_PendingHTLCsForwardable_class =
837 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
838 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_class != NULL);
839 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
840 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_meth != NULL);
841 LDKEvent_SpendableOutputs_class =
842 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
843 DO_ASSERT(LDKEvent_SpendableOutputs_class != NULL);
844 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
845 DO_ASSERT(LDKEvent_SpendableOutputs_meth != NULL);
847 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
848 LDKEvent *obj = (LDKEvent*)ptr;
850 case LDKEvent_FundingGenerationReady: {
851 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
852 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
853 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
854 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);
856 case LDKEvent_FundingBroadcastSafe: {
857 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
858 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 long funding_txo_ref;
861 if (funding_txo_var.is_owned) {
862 funding_txo_ref = (long)funding_txo_var.inner | 1;
864 funding_txo_ref = (long)&funding_txo_var;
866 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
868 case LDKEvent_PaymentReceived: {
869 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
870 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
871 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
872 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
873 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
875 case LDKEvent_PaymentSent: {
876 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
877 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
878 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
880 case LDKEvent_PaymentFailed: {
881 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
882 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
883 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
885 case LDKEvent_PendingHTLCsForwardable: {
886 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
888 case LDKEvent_SpendableOutputs: {
889 long outputs_ref = (long)&obj->spendable_outputs.outputs;
890 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
895 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
896 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
897 static jclass LDKErrorAction_IgnoreError_class = NULL;
898 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
899 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
900 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
902 LDKErrorAction_DisconnectPeer_class =
903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
904 DO_ASSERT(LDKErrorAction_DisconnectPeer_class != NULL);
905 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
906 DO_ASSERT(LDKErrorAction_DisconnectPeer_meth != NULL);
907 LDKErrorAction_IgnoreError_class =
908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
909 DO_ASSERT(LDKErrorAction_IgnoreError_class != NULL);
910 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
911 DO_ASSERT(LDKErrorAction_IgnoreError_meth != NULL);
912 LDKErrorAction_SendErrorMessage_class =
913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
914 DO_ASSERT(LDKErrorAction_SendErrorMessage_class != NULL);
915 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
916 DO_ASSERT(LDKErrorAction_SendErrorMessage_meth != NULL);
918 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
919 LDKErrorAction *obj = (LDKErrorAction*)ptr;
921 case LDKErrorAction_DisconnectPeer: {
922 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
923 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
924 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
926 if (msg_var.is_owned) {
927 msg_ref = (long)msg_var.inner | 1;
929 msg_ref = (long)&msg_var;
931 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
933 case LDKErrorAction_IgnoreError: {
934 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
936 case LDKErrorAction_SendErrorMessage: {
937 LDKErrorMessage msg_var = obj->send_error_message.msg;
938 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
941 if (msg_var.is_owned) {
942 msg_ref = (long)msg_var.inner | 1;
944 msg_ref = (long)&msg_var;
946 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
951 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
952 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
953 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
954 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
955 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
956 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
958 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
959 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
960 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
961 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
962 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
963 LDKHTLCFailChannelUpdate_ChannelClosed_class =
964 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
965 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
966 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
967 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
968 LDKHTLCFailChannelUpdate_NodeFailure_class =
969 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
970 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
971 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
972 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
974 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
975 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
977 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
978 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
979 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
980 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 if (msg_var.is_owned) {
983 msg_ref = (long)msg_var.inner | 1;
985 msg_ref = (long)&msg_var;
987 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
989 case LDKHTLCFailChannelUpdate_ChannelClosed: {
990 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
992 case LDKHTLCFailChannelUpdate_NodeFailure: {
993 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
994 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
995 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1000 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1001 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1002 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1003 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1004 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1005 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1006 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1007 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1008 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1009 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1010 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1011 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1012 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1013 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1014 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1015 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1016 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1017 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1018 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1019 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1020 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1021 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1022 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1023 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1024 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1025 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1026 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1027 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1028 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1029 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1030 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1031 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1033 LDKMessageSendEvent_SendAcceptChannel_class =
1034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1035 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1036 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1037 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1038 LDKMessageSendEvent_SendOpenChannel_class =
1039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1040 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1041 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1042 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1043 LDKMessageSendEvent_SendFundingCreated_class =
1044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1045 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1046 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1047 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1048 LDKMessageSendEvent_SendFundingSigned_class =
1049 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1050 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1051 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1052 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1053 LDKMessageSendEvent_SendFundingLocked_class =
1054 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1055 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1056 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1057 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1058 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1059 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1060 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1061 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1062 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1063 LDKMessageSendEvent_UpdateHTLCs_class =
1064 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1065 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1066 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1067 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1068 LDKMessageSendEvent_SendRevokeAndACK_class =
1069 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1070 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1071 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1072 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1073 LDKMessageSendEvent_SendClosingSigned_class =
1074 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1075 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1076 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1077 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1078 LDKMessageSendEvent_SendShutdown_class =
1079 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1080 DO_ASSERT(LDKMessageSendEvent_SendShutdown_class != NULL);
1081 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1082 DO_ASSERT(LDKMessageSendEvent_SendShutdown_meth != NULL);
1083 LDKMessageSendEvent_SendChannelReestablish_class =
1084 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1085 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1086 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1087 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1088 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1089 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1090 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1091 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1092 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1093 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1094 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1095 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1096 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1097 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1098 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1100 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1101 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1102 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1103 LDKMessageSendEvent_HandleError_class =
1104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1105 DO_ASSERT(LDKMessageSendEvent_HandleError_class != NULL);
1106 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1107 DO_ASSERT(LDKMessageSendEvent_HandleError_meth != NULL);
1108 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1110 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1111 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1112 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1114 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1115 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1117 case LDKMessageSendEvent_SendAcceptChannel: {
1118 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1119 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1120 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1121 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1122 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1124 if (msg_var.is_owned) {
1125 msg_ref = (long)msg_var.inner | 1;
1127 msg_ref = (long)&msg_var;
1129 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1131 case LDKMessageSendEvent_SendOpenChannel: {
1132 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1133 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1134 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1135 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1136 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1138 if (msg_var.is_owned) {
1139 msg_ref = (long)msg_var.inner | 1;
1141 msg_ref = (long)&msg_var;
1143 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1145 case LDKMessageSendEvent_SendFundingCreated: {
1146 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1147 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1148 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1149 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1150 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1152 if (msg_var.is_owned) {
1153 msg_ref = (long)msg_var.inner | 1;
1155 msg_ref = (long)&msg_var;
1157 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1159 case LDKMessageSendEvent_SendFundingSigned: {
1160 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1161 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1162 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1163 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1164 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1166 if (msg_var.is_owned) {
1167 msg_ref = (long)msg_var.inner | 1;
1169 msg_ref = (long)&msg_var;
1171 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1173 case LDKMessageSendEvent_SendFundingLocked: {
1174 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1175 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1176 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1177 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1178 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1180 if (msg_var.is_owned) {
1181 msg_ref = (long)msg_var.inner | 1;
1183 msg_ref = (long)&msg_var;
1185 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1187 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1188 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1189 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1190 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1191 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1192 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1194 if (msg_var.is_owned) {
1195 msg_ref = (long)msg_var.inner | 1;
1197 msg_ref = (long)&msg_var;
1199 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1201 case LDKMessageSendEvent_UpdateHTLCs: {
1202 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1203 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1204 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1205 DO_ASSERT((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1206 DO_ASSERT((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1208 if (updates_var.is_owned) {
1209 updates_ref = (long)updates_var.inner | 1;
1211 updates_ref = (long)&updates_var;
1213 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1215 case LDKMessageSendEvent_SendRevokeAndACK: {
1216 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1217 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1218 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1219 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1220 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1222 if (msg_var.is_owned) {
1223 msg_ref = (long)msg_var.inner | 1;
1225 msg_ref = (long)&msg_var;
1227 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1229 case LDKMessageSendEvent_SendClosingSigned: {
1230 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1231 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1232 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1233 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1234 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1236 if (msg_var.is_owned) {
1237 msg_ref = (long)msg_var.inner | 1;
1239 msg_ref = (long)&msg_var;
1241 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1243 case LDKMessageSendEvent_SendShutdown: {
1244 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1245 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1246 LDKShutdown msg_var = obj->send_shutdown.msg;
1247 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1248 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1250 if (msg_var.is_owned) {
1251 msg_ref = (long)msg_var.inner | 1;
1253 msg_ref = (long)&msg_var;
1255 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1257 case LDKMessageSendEvent_SendChannelReestablish: {
1258 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1259 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1260 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1261 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1262 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1264 if (msg_var.is_owned) {
1265 msg_ref = (long)msg_var.inner | 1;
1267 msg_ref = (long)&msg_var;
1269 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1271 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1272 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1273 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1274 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1276 if (msg_var.is_owned) {
1277 msg_ref = (long)msg_var.inner | 1;
1279 msg_ref = (long)&msg_var;
1281 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1282 DO_ASSERT((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1283 DO_ASSERT((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 long update_msg_ref;
1285 if (update_msg_var.is_owned) {
1286 update_msg_ref = (long)update_msg_var.inner | 1;
1288 update_msg_ref = (long)&update_msg_var;
1290 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1292 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1293 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1294 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1295 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1297 if (msg_var.is_owned) {
1298 msg_ref = (long)msg_var.inner | 1;
1300 msg_ref = (long)&msg_var;
1302 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1304 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1305 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1306 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1307 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1309 if (msg_var.is_owned) {
1310 msg_ref = (long)msg_var.inner | 1;
1312 msg_ref = (long)&msg_var;
1314 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1316 case LDKMessageSendEvent_HandleError: {
1317 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1318 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1319 long action_ref = (long)&obj->handle_error.action;
1320 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1322 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1323 long update_ref = (long)&obj->payment_failure_network_update.update;
1324 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1329 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1330 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1331 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1334 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1335 ret->datalen = (*env)->GetArrayLength(env, elems);
1336 if (ret->datalen == 0) {
1339 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1340 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1341 for (size_t i = 0; i < ret->datalen; i++) {
1342 jlong arr_elem = java_elems[i];
1343 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1344 FREE((void*)arr_elem);
1345 ret->data[i] = arr_elem_conv;
1347 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1351 typedef struct LDKMessageSendEventsProvider_JCalls {
1352 atomic_size_t refcnt;
1355 jmethodID get_and_clear_pending_msg_events_meth;
1356 } LDKMessageSendEventsProvider_JCalls;
1357 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1358 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1360 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1361 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1362 DO_ASSERT(obj != NULL);
1363 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1364 LDKCVec_MessageSendEventZ res = *ret;
1368 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1369 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1370 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1372 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1373 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1377 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1378 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1379 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1380 return (void*) this_arg;
1382 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1383 jclass c = (*env)->GetObjectClass(env, o);
1384 DO_ASSERT(c != NULL);
1385 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1386 atomic_init(&calls->refcnt, 1);
1387 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1388 calls->o = (*env)->NewWeakGlobalRef(env, o);
1389 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1390 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1392 LDKMessageSendEventsProvider ret = {
1393 .this_arg = (void*) calls,
1394 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1395 .free = LDKMessageSendEventsProvider_JCalls_free,
1399 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1400 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1401 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1402 return (long)res_ptr;
1404 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1405 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1406 DO_ASSERT(ret != NULL);
1409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1410 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1411 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1412 *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1416 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1417 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1418 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1421 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1422 ret->datalen = (*env)->GetArrayLength(env, elems);
1423 if (ret->datalen == 0) {
1426 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1427 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1428 for (size_t i = 0; i < ret->datalen; i++) {
1429 jlong arr_elem = java_elems[i];
1430 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1431 FREE((void*)arr_elem);
1432 ret->data[i] = arr_elem_conv;
1434 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1438 typedef struct LDKEventsProvider_JCalls {
1439 atomic_size_t refcnt;
1442 jmethodID get_and_clear_pending_events_meth;
1443 } LDKEventsProvider_JCalls;
1444 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1445 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1447 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1448 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1449 DO_ASSERT(obj != NULL);
1450 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1451 LDKCVec_EventZ res = *ret;
1455 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1456 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1457 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1459 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1460 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1464 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1465 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1466 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1467 return (void*) this_arg;
1469 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1470 jclass c = (*env)->GetObjectClass(env, o);
1471 DO_ASSERT(c != NULL);
1472 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1473 atomic_init(&calls->refcnt, 1);
1474 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1475 calls->o = (*env)->NewWeakGlobalRef(env, o);
1476 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1477 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1479 LDKEventsProvider ret = {
1480 .this_arg = (void*) calls,
1481 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1482 .free = LDKEventsProvider_JCalls_free,
1486 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1487 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1488 *res_ptr = LDKEventsProvider_init(env, _a, o);
1489 return (long)res_ptr;
1491 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1492 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1493 DO_ASSERT(ret != NULL);
1496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1497 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1498 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1499 *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1503 typedef struct LDKLogger_JCalls {
1504 atomic_size_t refcnt;
1509 void log_jcall(const void* this_arg, const char *record) {
1510 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1512 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1513 jstring record_conv = (*env)->NewStringUTF(env, record);
1514 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1515 DO_ASSERT(obj != NULL);
1516 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1518 static void LDKLogger_JCalls_free(void* this_arg) {
1519 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1520 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1522 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1523 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1527 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1528 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1529 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1530 return (void*) this_arg;
1532 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1533 jclass c = (*env)->GetObjectClass(env, o);
1534 DO_ASSERT(c != NULL);
1535 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1536 atomic_init(&calls->refcnt, 1);
1537 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1538 calls->o = (*env)->NewWeakGlobalRef(env, o);
1539 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1540 DO_ASSERT(calls->log_meth != NULL);
1543 .this_arg = (void*) calls,
1545 .free = LDKLogger_JCalls_free,
1549 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1550 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1551 *res_ptr = LDKLogger_init(env, _a, o);
1552 return (long)res_ptr;
1554 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1555 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1556 DO_ASSERT(ret != NULL);
1559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1560 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1563 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1564 if (val->result_ok) {
1565 return (long)val->contents.result;
1567 return (long)val->contents.err;
1570 typedef struct LDKAccess_JCalls {
1571 atomic_size_t refcnt;
1574 jmethodID get_utxo_meth;
1576 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1577 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1579 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1580 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1581 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1582 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1583 DO_ASSERT(obj != NULL);
1584 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1585 LDKCResult_TxOutAccessErrorZ res = *ret;
1589 static void LDKAccess_JCalls_free(void* this_arg) {
1590 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1591 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1593 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1594 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1598 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1599 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1600 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1601 return (void*) this_arg;
1603 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1604 jclass c = (*env)->GetObjectClass(env, o);
1605 DO_ASSERT(c != NULL);
1606 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1607 atomic_init(&calls->refcnt, 1);
1608 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1609 calls->o = (*env)->NewWeakGlobalRef(env, o);
1610 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1611 DO_ASSERT(calls->get_utxo_meth != NULL);
1614 .this_arg = (void*) calls,
1615 .get_utxo = get_utxo_jcall,
1616 .free = LDKAccess_JCalls_free,
1620 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1621 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1622 *res_ptr = LDKAccess_init(env, _a, o);
1623 return (long)res_ptr;
1625 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1626 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1627 DO_ASSERT(ret != NULL);
1630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
1631 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1632 unsigned char genesis_hash_arr[32];
1633 DO_ASSERT((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1634 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1635 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1636 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1637 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1641 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1642 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1643 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1644 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1645 for (size_t i = 0; i < vec->datalen; i++) {
1646 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1647 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1649 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1653 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1654 ret->datalen = (*env)->GetArrayLength(env, elems);
1655 if (ret->datalen == 0) {
1658 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1659 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1660 for (size_t i = 0; i < ret->datalen; i++) {
1661 jlong arr_elem = java_elems[i];
1662 LDKHTLCOutputInCommitment arr_elem_conv;
1663 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1664 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1665 if (arr_elem_conv.inner != NULL)
1666 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1667 ret->data[i] = arr_elem_conv;
1669 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1673 typedef struct LDKChannelKeys_JCalls {
1674 atomic_size_t refcnt;
1677 jmethodID get_per_commitment_point_meth;
1678 jmethodID release_commitment_secret_meth;
1679 jmethodID key_derivation_params_meth;
1680 jmethodID sign_counterparty_commitment_meth;
1681 jmethodID sign_holder_commitment_meth;
1682 jmethodID sign_holder_commitment_htlc_transactions_meth;
1683 jmethodID sign_justice_transaction_meth;
1684 jmethodID sign_counterparty_htlc_transaction_meth;
1685 jmethodID sign_closing_transaction_meth;
1686 jmethodID sign_channel_announcement_meth;
1687 jmethodID on_accept_meth;
1688 } LDKChannelKeys_JCalls;
1689 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1690 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1692 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1693 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1694 DO_ASSERT(obj != NULL);
1695 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1697 DO_ASSERT((*env)->GetArrayLength(env, jret) == 33);
1698 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1701 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1702 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1704 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1705 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1706 DO_ASSERT(obj != NULL);
1707 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1708 LDKThirtyTwoBytes ret;
1709 DO_ASSERT((*env)->GetArrayLength(env, jret) == 32);
1710 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1713 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1714 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1716 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1717 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1718 DO_ASSERT(obj != NULL);
1719 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1720 LDKC2Tuple_u64u64Z res = *ret;
1724 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) {
1725 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1727 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1728 long commitment_tx_ref = (long)&commitment_tx;
1729 long htlcs_ref = (long)&htlcs;
1730 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1731 DO_ASSERT(obj != NULL);
1732 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
1733 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1737 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1738 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1742 DO_ASSERT(obj != NULL);
1743 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1744 LDKCResult_SignatureNoneZ res = *ret;
1748 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1749 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1751 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1752 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1753 DO_ASSERT(obj != NULL);
1754 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1755 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1759 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) {
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 justice_tx_ref = (long)&justice_tx;
1764 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1765 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1766 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1767 DO_ASSERT(obj != NULL);
1768 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1769 LDKCResult_SignatureNoneZ res = *ret;
1773 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) {
1774 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1777 long htlc_tx_ref = (long)&htlc_tx;
1778 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1779 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1780 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1781 DO_ASSERT(obj != NULL);
1782 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc);
1783 LDKCResult_SignatureNoneZ res = *ret;
1787 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1788 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1790 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1791 long closing_tx_ref = (long)&closing_tx;
1792 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1793 DO_ASSERT(obj != NULL);
1794 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1795 LDKCResult_SignatureNoneZ res = *ret;
1799 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1800 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1802 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1803 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1804 DO_ASSERT(obj != NULL);
1805 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1806 LDKCResult_SignatureNoneZ res = *ret;
1810 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1811 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1813 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1814 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1815 DO_ASSERT(obj != NULL);
1816 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1818 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1819 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1820 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1822 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1823 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1827 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1828 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1829 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1830 return (void*) this_arg;
1832 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1833 jclass c = (*env)->GetObjectClass(env, o);
1834 DO_ASSERT(c != NULL);
1835 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1836 atomic_init(&calls->refcnt, 1);
1837 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1838 calls->o = (*env)->NewWeakGlobalRef(env, o);
1839 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1840 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1841 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1842 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1843 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1844 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1845 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1846 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1847 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1848 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1849 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1850 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1851 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1852 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1853 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1854 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1855 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1856 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1857 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1858 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1859 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1860 DO_ASSERT(calls->on_accept_meth != NULL);
1862 LDKChannelKeys ret = {
1863 .this_arg = (void*) calls,
1864 .get_per_commitment_point = get_per_commitment_point_jcall,
1865 .release_commitment_secret = release_commitment_secret_jcall,
1866 .key_derivation_params = key_derivation_params_jcall,
1867 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1868 .sign_holder_commitment = sign_holder_commitment_jcall,
1869 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1870 .sign_justice_transaction = sign_justice_transaction_jcall,
1871 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1872 .sign_closing_transaction = sign_closing_transaction_jcall,
1873 .sign_channel_announcement = sign_channel_announcement_jcall,
1874 .on_accept = on_accept_jcall,
1875 .clone = LDKChannelKeys_JCalls_clone,
1876 .free = LDKChannelKeys_JCalls_free,
1880 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1881 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1882 *res_ptr = LDKChannelKeys_init(env, _a, o);
1883 return (long)res_ptr;
1885 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1886 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1887 DO_ASSERT(ret != NULL);
1890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1891 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1892 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1893 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1897 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1898 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1905 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1906 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1907 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1912 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1913 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1914 FREE((void*)commitment_tx);
1915 LDKPreCalculatedTxCreationKeys keys_conv;
1916 keys_conv.inner = (void*)(keys & (~1));
1917 keys_conv.is_owned = (keys & 1) || (keys == 0);
1918 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1920 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1921 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1925 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1926 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1927 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1928 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1929 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1930 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1931 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1936 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1937 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1938 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1939 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1940 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1941 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1946 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1947 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1948 FREE((void*)justice_tx);
1949 unsigned char per_commitment_key_arr[32];
1950 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
1951 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1952 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1953 LDKHTLCOutputInCommitment htlc_conv;
1954 htlc_conv.inner = (void*)(htlc & (~1));
1955 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1956 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1957 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1962 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1963 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1964 FREE((void*)htlc_tx);
1965 LDKPublicKey per_commitment_point_ref;
1966 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
1967 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1968 LDKHTLCOutputInCommitment htlc_conv;
1969 htlc_conv.inner = (void*)(htlc & (~1));
1970 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1971 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1972 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
1977 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1978 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1979 FREE((void*)closing_tx);
1980 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1981 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
1985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
1986 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1987 LDKUnsignedChannelAnnouncement msg_conv;
1988 msg_conv.inner = (void*)(msg & (~1));
1989 msg_conv.is_owned = (msg & 1) || (msg == 0);
1990 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1991 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
1996 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1997 LDKChannelPublicKeys channel_points_conv;
1998 channel_points_conv.inner = (void*)(channel_points & (~1));
1999 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2000 return (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2003 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2004 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2005 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2006 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2007 for (size_t i = 0; i < vec->datalen; i++) {
2008 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2009 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2011 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2015 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2016 ret->datalen = (*env)->GetArrayLength(env, elems);
2017 if (ret->datalen == 0) {
2020 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2021 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2022 for (size_t i = 0; i < ret->datalen; i++) {
2023 jlong arr_elem = java_elems[i];
2024 LDKMonitorEvent arr_elem_conv;
2025 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2026 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2027 ret->data[i] = arr_elem_conv;
2029 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2033 typedef struct LDKWatch_JCalls {
2034 atomic_size_t refcnt;
2037 jmethodID watch_channel_meth;
2038 jmethodID update_channel_meth;
2039 jmethodID release_pending_monitor_events_meth;
2041 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2042 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2044 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2045 LDKOutPoint funding_txo_var = funding_txo;
2046 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2047 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2048 long funding_txo_ref;
2049 if (funding_txo_var.is_owned) {
2050 funding_txo_ref = (long)funding_txo_var.inner | 1;
2052 funding_txo_ref = (long)&funding_txo_var;
2054 LDKChannelMonitor monitor_var = monitor;
2055 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2056 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2058 if (monitor_var.is_owned) {
2059 monitor_ref = (long)monitor_var.inner | 1;
2061 monitor_ref = (long)&monitor_var;
2063 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2064 DO_ASSERT(obj != NULL);
2065 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2066 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2070 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2071 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2073 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2074 LDKOutPoint funding_txo_var = funding_txo;
2075 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2076 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2077 long funding_txo_ref;
2078 if (funding_txo_var.is_owned) {
2079 funding_txo_ref = (long)funding_txo_var.inner | 1;
2081 funding_txo_ref = (long)&funding_txo_var;
2083 LDKChannelMonitorUpdate update_var = update;
2084 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2085 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2087 if (update_var.is_owned) {
2088 update_ref = (long)update_var.inner | 1;
2090 update_ref = (long)&update_var;
2092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2093 DO_ASSERT(obj != NULL);
2094 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2095 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2099 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2100 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2102 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2103 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2104 DO_ASSERT(obj != NULL);
2105 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2106 LDKCVec_MonitorEventZ res = *ret;
2110 static void LDKWatch_JCalls_free(void* this_arg) {
2111 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2112 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2114 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2115 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2119 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2120 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2121 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2122 return (void*) this_arg;
2124 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2125 jclass c = (*env)->GetObjectClass(env, o);
2126 DO_ASSERT(c != NULL);
2127 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2128 atomic_init(&calls->refcnt, 1);
2129 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2130 calls->o = (*env)->NewWeakGlobalRef(env, o);
2131 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2132 DO_ASSERT(calls->watch_channel_meth != NULL);
2133 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2134 DO_ASSERT(calls->update_channel_meth != NULL);
2135 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2136 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2139 .this_arg = (void*) calls,
2140 .watch_channel = watch_channel_jcall,
2141 .update_channel = update_channel_jcall,
2142 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2143 .free = LDKWatch_JCalls_free,
2147 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2148 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2149 *res_ptr = LDKWatch_init(env, _a, o);
2150 return (long)res_ptr;
2152 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2153 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2154 DO_ASSERT(ret != NULL);
2157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2158 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2159 LDKOutPoint funding_txo_conv;
2160 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2161 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2162 if (funding_txo_conv.inner != NULL)
2163 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2164 LDKChannelMonitor monitor_conv;
2165 monitor_conv.inner = (void*)(monitor & (~1));
2166 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2167 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2168 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2173 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2174 LDKOutPoint funding_txo_conv;
2175 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2176 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2177 if (funding_txo_conv.inner != NULL)
2178 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2179 LDKChannelMonitorUpdate update_conv;
2180 update_conv.inner = (void*)(update & (~1));
2181 update_conv.is_owned = (update & 1) || (update == 0);
2182 if (update_conv.inner != NULL)
2183 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2184 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2185 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2190 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2191 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2192 *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2196 typedef struct LDKFilter_JCalls {
2197 atomic_size_t refcnt;
2200 jmethodID register_tx_meth;
2201 jmethodID register_output_meth;
2203 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2204 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2206 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2207 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2208 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2209 long script_pubkey_ref = (long)&script_pubkey;
2210 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2211 DO_ASSERT(obj != NULL);
2212 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2214 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2215 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2217 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2218 long script_pubkey_ref = (long)&script_pubkey;
2219 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2220 DO_ASSERT(obj != NULL);
2221 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2223 static void LDKFilter_JCalls_free(void* this_arg) {
2224 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2225 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2227 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2228 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2232 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2233 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2234 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2235 return (void*) this_arg;
2237 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2238 jclass c = (*env)->GetObjectClass(env, o);
2239 DO_ASSERT(c != NULL);
2240 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2241 atomic_init(&calls->refcnt, 1);
2242 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2243 calls->o = (*env)->NewWeakGlobalRef(env, o);
2244 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2245 DO_ASSERT(calls->register_tx_meth != NULL);
2246 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2247 DO_ASSERT(calls->register_output_meth != NULL);
2250 .this_arg = (void*) calls,
2251 .register_tx = register_tx_jcall,
2252 .register_output = register_output_jcall,
2253 .free = LDKFilter_JCalls_free,
2257 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2258 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2259 *res_ptr = LDKFilter_init(env, _a, o);
2260 return (long)res_ptr;
2262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2263 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2264 DO_ASSERT(ret != NULL);
2267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jlong script_pubkey) {
2268 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2269 unsigned char txid_arr[32];
2270 DO_ASSERT((*_env)->GetArrayLength (_env, txid) == 32);
2271 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2272 unsigned char (*txid_ref)[32] = &txid_arr;
2273 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2274 return (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_conv);
2277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jlong script_pubkey) {
2278 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2279 LDKOutPoint outpoint_conv;
2280 outpoint_conv.inner = (void*)(outpoint & (~1));
2281 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2282 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2283 return (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2286 typedef struct LDKBroadcasterInterface_JCalls {
2287 atomic_size_t refcnt;
2290 jmethodID broadcast_transaction_meth;
2291 } LDKBroadcasterInterface_JCalls;
2292 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2293 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2295 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2296 long tx_ref = (long)&tx;
2297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2298 DO_ASSERT(obj != NULL);
2299 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2301 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2302 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2303 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2305 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2306 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2310 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2311 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2312 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2313 return (void*) this_arg;
2315 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2316 jclass c = (*env)->GetObjectClass(env, o);
2317 DO_ASSERT(c != NULL);
2318 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2319 atomic_init(&calls->refcnt, 1);
2320 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2321 calls->o = (*env)->NewWeakGlobalRef(env, o);
2322 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2323 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2325 LDKBroadcasterInterface ret = {
2326 .this_arg = (void*) calls,
2327 .broadcast_transaction = broadcast_transaction_jcall,
2328 .free = LDKBroadcasterInterface_JCalls_free,
2332 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2333 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2334 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2335 return (long)res_ptr;
2337 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2338 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2339 DO_ASSERT(ret != NULL);
2342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2343 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2344 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2346 return (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2349 typedef struct LDKFeeEstimator_JCalls {
2350 atomic_size_t refcnt;
2353 jmethodID get_est_sat_per_1000_weight_meth;
2354 } LDKFeeEstimator_JCalls;
2355 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2356 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2358 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2359 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2360 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2361 DO_ASSERT(obj != NULL);
2362 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2364 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2365 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2366 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2368 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2369 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2373 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2374 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2375 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2376 return (void*) this_arg;
2378 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2379 jclass c = (*env)->GetObjectClass(env, o);
2380 DO_ASSERT(c != NULL);
2381 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2382 atomic_init(&calls->refcnt, 1);
2383 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2384 calls->o = (*env)->NewWeakGlobalRef(env, o);
2385 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2386 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2388 LDKFeeEstimator ret = {
2389 .this_arg = (void*) calls,
2390 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2391 .free = LDKFeeEstimator_JCalls_free,
2395 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2396 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2397 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2398 return (long)res_ptr;
2400 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2401 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2402 DO_ASSERT(ret != NULL);
2405 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong this_arg, jclass confirmation_target) {
2406 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2407 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2408 return (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2411 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2412 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2413 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2416 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2417 ret->datalen = (*env)->GetArrayLength(env, elems);
2418 if (ret->datalen == 0) {
2421 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2422 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2423 for (size_t i = 0; i < ret->datalen; i++) {
2424 jlong arr_elem = java_elems[i];
2425 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2426 FREE((void*)arr_elem);
2427 ret->data[i] = arr_elem_conv;
2429 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2433 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2434 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2435 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2438 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2439 ret->datalen = (*env)->GetArrayLength(env, elems);
2440 if (ret->datalen == 0) {
2443 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2444 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2445 for (size_t i = 0; i < ret->datalen; i++) {
2446 jlong arr_elem = java_elems[i];
2447 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2448 FREE((void*)arr_elem);
2449 ret->data[i] = arr_elem_conv;
2451 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2456 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2457 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2460 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2461 ret->datalen = (*env)->GetArrayLength(env, elems);
2462 if (ret->datalen == 0) {
2465 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2466 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2467 for (size_t i = 0; i < ret->datalen; i++) {
2468 jlong arr_elem = java_elems[i];
2469 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2470 FREE((void*)arr_elem);
2471 ret->data[i] = arr_elem_conv;
2473 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2477 typedef struct LDKKeysInterface_JCalls {
2478 atomic_size_t refcnt;
2481 jmethodID get_node_secret_meth;
2482 jmethodID get_destination_script_meth;
2483 jmethodID get_shutdown_pubkey_meth;
2484 jmethodID get_channel_keys_meth;
2485 jmethodID get_secure_random_bytes_meth;
2486 } LDKKeysInterface_JCalls;
2487 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2488 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2491 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2492 DO_ASSERT(obj != NULL);
2493 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2495 DO_ASSERT((*env)->GetArrayLength(env, jret) == 32);
2496 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes);
2499 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2500 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2502 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2503 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2504 DO_ASSERT(obj != NULL);
2505 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2506 LDKCVec_u8Z res = *ret;
2510 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2511 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2513 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2514 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2515 DO_ASSERT(obj != NULL);
2516 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2518 DO_ASSERT((*env)->GetArrayLength(env, jret) == 33);
2519 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2522 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2523 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2525 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2526 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2527 DO_ASSERT(obj != NULL);
2528 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2529 LDKChannelKeys res = *ret;
2533 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2534 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2536 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2537 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2538 DO_ASSERT(obj != NULL);
2539 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2540 LDKThirtyTwoBytes ret;
2541 DO_ASSERT((*env)->GetArrayLength(env, jret) == 32);
2542 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2545 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2546 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2547 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2550 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2554 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2555 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2556 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2557 return (void*) this_arg;
2559 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2560 jclass c = (*env)->GetObjectClass(env, o);
2561 DO_ASSERT(c != NULL);
2562 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2563 atomic_init(&calls->refcnt, 1);
2564 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2565 calls->o = (*env)->NewWeakGlobalRef(env, o);
2566 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2567 DO_ASSERT(calls->get_node_secret_meth != NULL);
2568 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2569 DO_ASSERT(calls->get_destination_script_meth != NULL);
2570 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2571 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2572 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2573 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2574 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2575 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2577 LDKKeysInterface ret = {
2578 .this_arg = (void*) calls,
2579 .get_node_secret = get_node_secret_jcall,
2580 .get_destination_script = get_destination_script_jcall,
2581 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2582 .get_channel_keys = get_channel_keys_jcall,
2583 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2584 .free = LDKKeysInterface_JCalls_free,
2588 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2589 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2590 *res_ptr = LDKKeysInterface_init(env, _a, o);
2591 return (long)res_ptr;
2593 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2594 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2595 DO_ASSERT(ret != NULL);
2598 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2599 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2600 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2601 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2606 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2607 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2608 *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2612 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2613 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2614 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2615 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jboolean inbound, jlong channel_value_satoshis) {
2620 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2621 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2622 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2626 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2627 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2628 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2629 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2633 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2634 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2635 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2636 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2637 for (size_t i = 0; i < vec->datalen; i++) {
2638 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2639 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2641 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2645 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2646 ret->datalen = (*env)->GetArrayLength(env, elems);
2647 if (ret->datalen == 0) {
2650 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2651 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2652 for (size_t i = 0; i < ret->datalen; i++) {
2653 jlong arr_elem = java_elems[i];
2654 LDKChannelDetails arr_elem_conv;
2655 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2656 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2657 ret->data[i] = arr_elem_conv;
2659 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2663 static jclass LDKNetAddress_IPv4_class = NULL;
2664 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2665 static jclass LDKNetAddress_IPv6_class = NULL;
2666 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2667 static jclass LDKNetAddress_OnionV2_class = NULL;
2668 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2669 static jclass LDKNetAddress_OnionV3_class = NULL;
2670 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2672 LDKNetAddress_IPv4_class =
2673 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2674 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2675 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2676 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2677 LDKNetAddress_IPv6_class =
2678 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2679 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2680 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2681 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2682 LDKNetAddress_OnionV2_class =
2683 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2684 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2685 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2686 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2687 LDKNetAddress_OnionV3_class =
2688 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2689 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2690 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2691 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2693 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2694 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2696 case LDKNetAddress_IPv4: {
2697 long addr_ref = (long)&obj->i_pv4.addr;
2698 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2700 case LDKNetAddress_IPv6: {
2701 long addr_ref = (long)&obj->i_pv6.addr;
2702 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2704 case LDKNetAddress_OnionV2: {
2705 long addr_ref = (long)&obj->onion_v2.addr;
2706 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2708 case LDKNetAddress_OnionV3: {
2709 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2710 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2711 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);
2716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2717 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2718 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2721 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2722 ret->datalen = (*env)->GetArrayLength(env, elems);
2723 if (ret->datalen == 0) {
2726 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2727 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2728 for (size_t i = 0; i < ret->datalen; i++) {
2729 jlong arr_elem = java_elems[i];
2730 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2731 FREE((void*)arr_elem);
2732 ret->data[i] = arr_elem_conv;
2734 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2738 typedef struct LDKChannelMessageHandler_JCalls {
2739 atomic_size_t refcnt;
2742 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2743 jmethodID handle_open_channel_meth;
2744 jmethodID handle_accept_channel_meth;
2745 jmethodID handle_funding_created_meth;
2746 jmethodID handle_funding_signed_meth;
2747 jmethodID handle_funding_locked_meth;
2748 jmethodID handle_shutdown_meth;
2749 jmethodID handle_closing_signed_meth;
2750 jmethodID handle_update_add_htlc_meth;
2751 jmethodID handle_update_fulfill_htlc_meth;
2752 jmethodID handle_update_fail_htlc_meth;
2753 jmethodID handle_update_fail_malformed_htlc_meth;
2754 jmethodID handle_commitment_signed_meth;
2755 jmethodID handle_revoke_and_ack_meth;
2756 jmethodID handle_update_fee_meth;
2757 jmethodID handle_announcement_signatures_meth;
2758 jmethodID peer_disconnected_meth;
2759 jmethodID peer_connected_meth;
2760 jmethodID handle_channel_reestablish_meth;
2761 jmethodID handle_error_meth;
2762 } LDKChannelMessageHandler_JCalls;
2763 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *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 LDKInitFeatures their_features_var = their_features;
2770 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2771 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2772 long their_features_ref;
2773 if (their_features_var.is_owned) {
2774 their_features_ref = (long)their_features_var.inner | 1;
2776 their_features_ref = (long)&their_features_var;
2778 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2779 DO_ASSERT(obj != NULL);
2780 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2782 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2783 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2785 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2786 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2787 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2788 LDKInitFeatures their_features_var = their_features;
2789 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2790 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2791 long their_features_ref;
2792 if (their_features_var.is_owned) {
2793 their_features_ref = (long)their_features_var.inner | 1;
2795 their_features_ref = (long)&their_features_var;
2797 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2798 DO_ASSERT(obj != NULL);
2799 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2801 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2802 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2804 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2805 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2806 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2808 DO_ASSERT(obj != NULL);
2809 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2811 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *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 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2818 DO_ASSERT(obj != NULL);
2819 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2821 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2822 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2824 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2825 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2826 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2827 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2828 DO_ASSERT(obj != NULL);
2829 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2831 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2832 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2834 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2835 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2836 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2838 DO_ASSERT(obj != NULL);
2839 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2841 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2842 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2844 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2845 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2846 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2847 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2848 DO_ASSERT(obj != NULL);
2849 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2851 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2852 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2855 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2856 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2857 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2858 DO_ASSERT(obj != NULL);
2859 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2861 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2862 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2864 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2865 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2866 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2868 DO_ASSERT(obj != NULL);
2869 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2871 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2872 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2874 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2875 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2876 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2877 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2878 DO_ASSERT(obj != NULL);
2879 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2881 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2882 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2884 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2885 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2886 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2887 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2888 DO_ASSERT(obj != NULL);
2889 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2891 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2892 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2894 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2895 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2896 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2897 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2898 DO_ASSERT(obj != NULL);
2899 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2901 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2902 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2904 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2905 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2906 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2907 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2908 DO_ASSERT(obj != NULL);
2909 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2911 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2912 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2914 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2915 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2916 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2917 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2918 DO_ASSERT(obj != NULL);
2919 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2921 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2922 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2925 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2926 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2928 DO_ASSERT(obj != NULL);
2929 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2931 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2932 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2934 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2935 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2936 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2937 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2938 DO_ASSERT(obj != NULL);
2939 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2941 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2942 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2944 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2945 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2946 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2948 DO_ASSERT(obj != NULL);
2949 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
2951 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2952 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2954 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2955 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2956 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2957 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2958 DO_ASSERT(obj != NULL);
2959 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2961 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2962 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2964 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2965 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2966 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2967 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2968 DO_ASSERT(obj != NULL);
2969 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
2971 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2972 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2973 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2975 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2976 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2980 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2981 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2982 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2983 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2984 return (void*) this_arg;
2986 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2987 jclass c = (*env)->GetObjectClass(env, o);
2988 DO_ASSERT(c != NULL);
2989 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
2990 atomic_init(&calls->refcnt, 1);
2991 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2992 calls->o = (*env)->NewWeakGlobalRef(env, o);
2993 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
2994 DO_ASSERT(calls->handle_open_channel_meth != NULL);
2995 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
2996 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
2997 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
2998 DO_ASSERT(calls->handle_funding_created_meth != NULL);
2999 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3000 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
3001 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3002 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
3003 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3004 DO_ASSERT(calls->handle_shutdown_meth != NULL);
3005 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3006 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
3007 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3008 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
3009 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3010 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
3011 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3012 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
3013 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3014 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
3015 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3016 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
3017 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3018 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
3019 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3020 DO_ASSERT(calls->handle_update_fee_meth != NULL);
3021 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3022 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
3023 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3024 DO_ASSERT(calls->peer_disconnected_meth != NULL);
3025 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3026 DO_ASSERT(calls->peer_connected_meth != NULL);
3027 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3028 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
3029 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3030 DO_ASSERT(calls->handle_error_meth != NULL);
3032 LDKChannelMessageHandler ret = {
3033 .this_arg = (void*) calls,
3034 .handle_open_channel = handle_open_channel_jcall,
3035 .handle_accept_channel = handle_accept_channel_jcall,
3036 .handle_funding_created = handle_funding_created_jcall,
3037 .handle_funding_signed = handle_funding_signed_jcall,
3038 .handle_funding_locked = handle_funding_locked_jcall,
3039 .handle_shutdown = handle_shutdown_jcall,
3040 .handle_closing_signed = handle_closing_signed_jcall,
3041 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3042 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3043 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3044 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3045 .handle_commitment_signed = handle_commitment_signed_jcall,
3046 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3047 .handle_update_fee = handle_update_fee_jcall,
3048 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3049 .peer_disconnected = peer_disconnected_jcall,
3050 .peer_connected = peer_connected_jcall,
3051 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3052 .handle_error = handle_error_jcall,
3053 .free = LDKChannelMessageHandler_JCalls_free,
3054 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3056 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3059 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3060 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3061 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3062 return (long)res_ptr;
3064 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3065 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3066 DO_ASSERT(ret != NULL);
3069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3070 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3071 LDKPublicKey their_node_id_ref;
3072 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3073 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3074 LDKInitFeatures their_features_conv;
3075 their_features_conv.inner = (void*)(their_features & (~1));
3076 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3077 LDKOpenChannel msg_conv;
3078 msg_conv.inner = (void*)(msg & (~1));
3079 msg_conv.is_owned = (msg & 1) || (msg == 0);
3080 return (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3084 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3085 LDKPublicKey their_node_id_ref;
3086 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3087 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3088 LDKInitFeatures their_features_conv;
3089 their_features_conv.inner = (void*)(their_features & (~1));
3090 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3091 LDKAcceptChannel msg_conv;
3092 msg_conv.inner = (void*)(msg & (~1));
3093 msg_conv.is_owned = (msg & 1) || (msg == 0);
3094 return (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3098 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3099 LDKPublicKey their_node_id_ref;
3100 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3101 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3102 LDKFundingCreated msg_conv;
3103 msg_conv.inner = (void*)(msg & (~1));
3104 msg_conv.is_owned = (msg & 1) || (msg == 0);
3105 return (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3109 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3110 LDKPublicKey their_node_id_ref;
3111 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3112 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3113 LDKFundingSigned msg_conv;
3114 msg_conv.inner = (void*)(msg & (~1));
3115 msg_conv.is_owned = (msg & 1) || (msg == 0);
3116 return (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3120 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3121 LDKPublicKey their_node_id_ref;
3122 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3123 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3124 LDKFundingLocked msg_conv;
3125 msg_conv.inner = (void*)(msg & (~1));
3126 msg_conv.is_owned = (msg & 1) || (msg == 0);
3127 return (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3131 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3132 LDKPublicKey their_node_id_ref;
3133 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3134 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3135 LDKShutdown msg_conv;
3136 msg_conv.inner = (void*)(msg & (~1));
3137 msg_conv.is_owned = (msg & 1) || (msg == 0);
3138 return (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3142 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3143 LDKPublicKey their_node_id_ref;
3144 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3145 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3146 LDKClosingSigned msg_conv;
3147 msg_conv.inner = (void*)(msg & (~1));
3148 msg_conv.is_owned = (msg & 1) || (msg == 0);
3149 return (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3153 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3154 LDKPublicKey their_node_id_ref;
3155 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3156 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3157 LDKUpdateAddHTLC msg_conv;
3158 msg_conv.inner = (void*)(msg & (~1));
3159 msg_conv.is_owned = (msg & 1) || (msg == 0);
3160 return (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3164 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3165 LDKPublicKey their_node_id_ref;
3166 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3167 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3168 LDKUpdateFulfillHTLC msg_conv;
3169 msg_conv.inner = (void*)(msg & (~1));
3170 msg_conv.is_owned = (msg & 1) || (msg == 0);
3171 return (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3175 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3176 LDKPublicKey their_node_id_ref;
3177 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3178 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3179 LDKUpdateFailHTLC msg_conv;
3180 msg_conv.inner = (void*)(msg & (~1));
3181 msg_conv.is_owned = (msg & 1) || (msg == 0);
3182 return (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3186 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3187 LDKPublicKey their_node_id_ref;
3188 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3189 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3190 LDKUpdateFailMalformedHTLC msg_conv;
3191 msg_conv.inner = (void*)(msg & (~1));
3192 msg_conv.is_owned = (msg & 1) || (msg == 0);
3193 return (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3197 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3198 LDKPublicKey their_node_id_ref;
3199 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3200 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3201 LDKCommitmentSigned msg_conv;
3202 msg_conv.inner = (void*)(msg & (~1));
3203 msg_conv.is_owned = (msg & 1) || (msg == 0);
3204 return (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3208 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3209 LDKPublicKey their_node_id_ref;
3210 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3211 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3212 LDKRevokeAndACK msg_conv;
3213 msg_conv.inner = (void*)(msg & (~1));
3214 msg_conv.is_owned = (msg & 1) || (msg == 0);
3215 return (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3219 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3220 LDKPublicKey their_node_id_ref;
3221 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3222 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3223 LDKUpdateFee msg_conv;
3224 msg_conv.inner = (void*)(msg & (~1));
3225 msg_conv.is_owned = (msg & 1) || (msg == 0);
3226 return (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3230 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3231 LDKPublicKey their_node_id_ref;
3232 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3233 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3234 LDKAnnouncementSignatures msg_conv;
3235 msg_conv.inner = (void*)(msg & (~1));
3236 msg_conv.is_owned = (msg & 1) || (msg == 0);
3237 return (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jboolean no_connection_possible) {
3241 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3242 LDKPublicKey their_node_id_ref;
3243 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3244 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3245 return (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3249 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3250 LDKPublicKey their_node_id_ref;
3251 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3252 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3254 msg_conv.inner = (void*)(msg & (~1));
3255 msg_conv.is_owned = (msg & 1) || (msg == 0);
3256 return (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3260 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3261 LDKPublicKey their_node_id_ref;
3262 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3263 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3264 LDKChannelReestablish msg_conv;
3265 msg_conv.inner = (void*)(msg & (~1));
3266 msg_conv.is_owned = (msg & 1) || (msg == 0);
3267 return (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3271 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3272 LDKPublicKey their_node_id_ref;
3273 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
3274 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3275 LDKErrorMessage msg_conv;
3276 msg_conv.inner = (void*)(msg & (~1));
3277 msg_conv.is_owned = (msg & 1) || (msg == 0);
3278 return (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3281 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3282 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3283 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3284 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3285 for (size_t i = 0; i < vec->datalen; i++) {
3286 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3287 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3289 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3293 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3294 ret->datalen = (*env)->GetArrayLength(env, elems);
3295 if (ret->datalen == 0) {
3298 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3299 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3300 for (size_t i = 0; i < ret->datalen; i++) {
3301 jlong arr_elem = java_elems[i];
3302 LDKChannelMonitor arr_elem_conv;
3303 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3304 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3305 ret->data[i] = arr_elem_conv;
3307 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3311 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3312 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3313 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3316 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3317 ret->datalen = (*env)->GetArrayLength(env, elems);
3318 if (ret->datalen == 0) {
3321 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3322 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3323 for (size_t i = 0; i < ret->datalen; i++) {
3324 ret->data[i] = java_elems[i];
3326 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3330 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3331 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3332 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3333 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3334 for (size_t i = 0; i < vec->datalen; i++) {
3335 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3336 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3338 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3342 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3343 ret->datalen = (*env)->GetArrayLength(env, elems);
3344 if (ret->datalen == 0) {
3347 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3348 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3349 for (size_t i = 0; i < ret->datalen; i++) {
3350 jlong arr_elem = java_elems[i];
3351 LDKUpdateAddHTLC arr_elem_conv;
3352 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3353 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3354 if (arr_elem_conv.inner != NULL)
3355 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3356 ret->data[i] = arr_elem_conv;
3358 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3362 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3363 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3364 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3365 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3366 for (size_t i = 0; i < vec->datalen; i++) {
3367 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3368 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3370 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3374 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3375 ret->datalen = (*env)->GetArrayLength(env, elems);
3376 if (ret->datalen == 0) {
3379 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3380 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3381 for (size_t i = 0; i < ret->datalen; i++) {
3382 jlong arr_elem = java_elems[i];
3383 LDKUpdateFulfillHTLC arr_elem_conv;
3384 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3385 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3386 if (arr_elem_conv.inner != NULL)
3387 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3388 ret->data[i] = arr_elem_conv;
3390 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3394 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3395 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3396 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3397 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3398 for (size_t i = 0; i < vec->datalen; i++) {
3399 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3400 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3402 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3406 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3407 ret->datalen = (*env)->GetArrayLength(env, elems);
3408 if (ret->datalen == 0) {
3411 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3412 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3413 for (size_t i = 0; i < ret->datalen; i++) {
3414 jlong arr_elem = java_elems[i];
3415 LDKUpdateFailHTLC arr_elem_conv;
3416 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3417 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3418 if (arr_elem_conv.inner != NULL)
3419 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3420 ret->data[i] = arr_elem_conv;
3422 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3426 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3427 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3428 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3429 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3430 for (size_t i = 0; i < vec->datalen; i++) {
3431 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3432 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3434 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3438 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3439 ret->datalen = (*env)->GetArrayLength(env, elems);
3440 if (ret->datalen == 0) {
3443 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3444 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3445 for (size_t i = 0; i < ret->datalen; i++) {
3446 jlong arr_elem = java_elems[i];
3447 LDKUpdateFailMalformedHTLC arr_elem_conv;
3448 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3449 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3450 if (arr_elem_conv.inner != NULL)
3451 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3452 ret->data[i] = arr_elem_conv;
3454 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3458 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3459 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3462 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3463 if (val->result_ok) {
3464 return (long)val->contents.result;
3466 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3469 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3470 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3471 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3474 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3475 ret->datalen = (*env)->GetArrayLength(env, elems);
3476 if (ret->datalen == 0) {
3479 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3480 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3481 for (size_t i = 0; i < ret->datalen; i++) {
3482 jlong arr_elem = java_elems[i];
3483 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3484 FREE((void*)arr_elem);
3485 ret->data[i] = arr_elem_conv;
3487 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3491 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3492 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3493 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3494 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3495 for (size_t i = 0; i < vec->datalen; i++) {
3496 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3497 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3499 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3503 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3504 ret->datalen = (*env)->GetArrayLength(env, elems);
3505 if (ret->datalen == 0) {
3508 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3509 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3510 for (size_t i = 0; i < ret->datalen; i++) {
3511 jlong arr_elem = java_elems[i];
3512 LDKNodeAnnouncement arr_elem_conv;
3513 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3514 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3515 if (arr_elem_conv.inner != NULL)
3516 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3517 ret->data[i] = arr_elem_conv;
3519 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3523 typedef struct LDKRoutingMessageHandler_JCalls {
3524 atomic_size_t refcnt;
3527 jmethodID handle_node_announcement_meth;
3528 jmethodID handle_channel_announcement_meth;
3529 jmethodID handle_channel_update_meth;
3530 jmethodID handle_htlc_fail_channel_update_meth;
3531 jmethodID get_next_channel_announcements_meth;
3532 jmethodID get_next_node_announcements_meth;
3533 jmethodID should_request_full_sync_meth;
3534 } LDKRoutingMessageHandler_JCalls;
3535 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3536 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3538 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3539 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3540 DO_ASSERT(obj != NULL);
3541 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3542 LDKCResult_boolLightningErrorZ res = *ret;
3546 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3547 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3550 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3551 DO_ASSERT(obj != NULL);
3552 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3553 LDKCResult_boolLightningErrorZ res = *ret;
3557 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3558 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3560 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3561 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3562 DO_ASSERT(obj != NULL);
3563 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3564 LDKCResult_boolLightningErrorZ res = *ret;
3568 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3569 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3571 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3572 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3573 DO_ASSERT(obj != NULL);
3574 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3576 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3577 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3579 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3580 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3581 DO_ASSERT(obj != NULL);
3582 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3583 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3587 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3588 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3590 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3591 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3592 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3594 DO_ASSERT(obj != NULL);
3595 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3596 LDKCVec_NodeAnnouncementZ res = *ret;
3600 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3601 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3603 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3604 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3605 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3606 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3607 DO_ASSERT(obj != NULL);
3608 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3610 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3611 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3612 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3614 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3615 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3619 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3620 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3621 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3622 return (void*) this_arg;
3624 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3625 jclass c = (*env)->GetObjectClass(env, o);
3626 DO_ASSERT(c != NULL);
3627 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3628 atomic_init(&calls->refcnt, 1);
3629 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3630 calls->o = (*env)->NewWeakGlobalRef(env, o);
3631 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3632 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3633 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3634 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3635 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3636 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3637 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3638 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3639 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3640 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3641 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3642 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3643 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3644 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3646 LDKRoutingMessageHandler ret = {
3647 .this_arg = (void*) calls,
3648 .handle_node_announcement = handle_node_announcement_jcall,
3649 .handle_channel_announcement = handle_channel_announcement_jcall,
3650 .handle_channel_update = handle_channel_update_jcall,
3651 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3652 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3653 .get_next_node_announcements = get_next_node_announcements_jcall,
3654 .should_request_full_sync = should_request_full_sync_jcall,
3655 .free = LDKRoutingMessageHandler_JCalls_free,
3659 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3660 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3661 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3662 return (long)res_ptr;
3664 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3665 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3666 DO_ASSERT(ret != NULL);
3669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3670 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3671 LDKNodeAnnouncement msg_conv;
3672 msg_conv.inner = (void*)(msg & (~1));
3673 msg_conv.is_owned = (msg & 1) || (msg == 0);
3674 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3675 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3680 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3681 LDKChannelAnnouncement msg_conv;
3682 msg_conv.inner = (void*)(msg & (~1));
3683 msg_conv.is_owned = (msg & 1) || (msg == 0);
3684 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3685 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3690 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3691 LDKChannelUpdate msg_conv;
3692 msg_conv.inner = (void*)(msg & (~1));
3693 msg_conv.is_owned = (msg & 1) || (msg == 0);
3694 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3695 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3700 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3701 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3702 return (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) {
3706 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3707 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3708 *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) {
3713 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3714 LDKPublicKey starting_point_ref;
3715 DO_ASSERT((*_env)->GetArrayLength (_env, starting_point) == 33);
3716 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3717 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3718 *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3723 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3724 LDKPublicKey node_id_ref;
3725 DO_ASSERT((*_env)->GetArrayLength (_env, node_id) == 33);
3726 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3727 return (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3730 typedef struct LDKSocketDescriptor_JCalls {
3731 atomic_size_t refcnt;
3734 jmethodID send_data_meth;
3735 jmethodID disconnect_socket_meth;
3737 jmethodID hash_meth;
3738 } LDKSocketDescriptor_JCalls;
3739 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3740 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3742 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3743 long data_ref = (long)&data;
3744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3745 DO_ASSERT(obj != NULL);
3746 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_ref, resume_read);
3748 void disconnect_socket_jcall(void* this_arg) {
3749 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3751 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3752 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3753 DO_ASSERT(obj != NULL);
3754 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3756 bool eq_jcall(const void* this_arg, const void *other_arg) {
3757 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3759 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3760 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3761 DO_ASSERT(obj != NULL);
3762 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3764 uint64_t hash_jcall(const void* this_arg) {
3765 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3767 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3768 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3769 DO_ASSERT(obj != NULL);
3770 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3772 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3773 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3774 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3777 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3781 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3782 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3783 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3784 return (void*) this_arg;
3786 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3787 jclass c = (*env)->GetObjectClass(env, o);
3788 DO_ASSERT(c != NULL);
3789 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3790 atomic_init(&calls->refcnt, 1);
3791 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3792 calls->o = (*env)->NewWeakGlobalRef(env, o);
3793 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3794 DO_ASSERT(calls->send_data_meth != NULL);
3795 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3796 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3797 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3798 DO_ASSERT(calls->eq_meth != NULL);
3799 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3800 DO_ASSERT(calls->hash_meth != NULL);
3802 LDKSocketDescriptor ret = {
3803 .this_arg = (void*) calls,
3804 .send_data = send_data_jcall,
3805 .disconnect_socket = disconnect_socket_jcall,
3808 .clone = LDKSocketDescriptor_JCalls_clone,
3809 .free = LDKSocketDescriptor_JCalls_free,
3813 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3814 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3815 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3816 return (long)res_ptr;
3818 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3819 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3820 DO_ASSERT(ret != NULL);
3823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jlong data, jboolean resume_read) {
3824 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3825 LDKu8slice data_conv = *(LDKu8slice*)data;
3826 return (this_arg_conv->send_data)(this_arg_conv->this_arg, data_conv, resume_read);
3829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
3830 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3831 return (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
3834 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
3835 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3836 return (this_arg_conv->hash)(this_arg_conv->this_arg);
3839 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3840 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3841 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3844 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3847 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3848 if (val->result_ok) {
3849 return (long)val->contents.result;
3851 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3855 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3858 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3859 if (val->result_ok) {
3860 return (long)val->contents.result;
3862 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3866 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3869 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3870 if (val->result_ok) {
3871 return (long)val->contents.result;
3873 return (long)val->contents.err;
3876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3877 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3880 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3881 if (val->result_ok) {
3882 return (long)val->contents.result;
3884 return (long)val->contents.err;
3887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3888 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3891 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3892 if (val->result_ok) {
3893 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3895 return (long)val->contents.err;
3898 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3899 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3900 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3903 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3904 ret->datalen = (*env)->GetArrayLength(env, elems);
3905 if (ret->datalen == 0) {
3908 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3909 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3910 for (size_t i = 0; i < ret->datalen; i++) {
3911 jlong arr_elem = java_elems[i];
3912 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3913 FREE((void*)arr_elem);
3914 ret->data[i] = arr_elem_conv;
3916 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3920 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3921 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3922 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3923 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3924 for (size_t i = 0; i < vec->datalen; i++) {
3925 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3926 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3928 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3932 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3933 ret->datalen = (*env)->GetArrayLength(env, elems);
3934 if (ret->datalen == 0) {
3937 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3938 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3939 for (size_t i = 0; i < ret->datalen; i++) {
3940 jlong arr_elem = java_elems[i];
3941 LDKRouteHop arr_elem_conv;
3942 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3943 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3944 if (arr_elem_conv.inner != NULL)
3945 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3946 ret->data[i] = arr_elem_conv;
3948 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3952 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3953 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3954 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3957 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3958 ret->datalen = (*env)->GetArrayLength(env, elems);
3959 if (ret->datalen == 0) {
3962 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3963 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3964 for (size_t i = 0; i < ret->datalen; i++) {
3965 jlong arr_elem = java_elems[i];
3966 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3967 FREE((void*)arr_elem);
3968 ret->data[i] = arr_elem_conv;
3970 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3974 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3975 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3978 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3979 if (val->result_ok) {
3980 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3982 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3985 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3986 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3987 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3988 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3989 for (size_t i = 0; i < vec->datalen; i++) {
3990 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3991 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3993 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3997 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3998 ret->datalen = (*env)->GetArrayLength(env, elems);
3999 if (ret->datalen == 0) {
4002 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4003 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4004 for (size_t i = 0; i < ret->datalen; i++) {
4005 jlong arr_elem = java_elems[i];
4006 LDKRouteHint arr_elem_conv;
4007 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4008 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4009 ret->data[i] = arr_elem_conv;
4011 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4016 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4018 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4022 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4024 return C2Tuple_OutPointScriptZ_free(arg_conv);
4027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4028 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4030 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4034 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4036 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4040 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4042 return C2Tuple_u64u64Z_free(arg_conv);
4045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4046 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4048 return C2Tuple_usizeTransactionZ_free(arg_conv);
4051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4052 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4054 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4058 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4060 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4064 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4066 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4067 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4072 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4074 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
4077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4078 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4080 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4081 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4085 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4086 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4088 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4089 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4094 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4096 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4100 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4102 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4103 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4108 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4110 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4111 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4116 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4118 return CResult_NoneAPIErrorZ_free(arg_conv);
4121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4122 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4124 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4125 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4130 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4132 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4136 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4138 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4139 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4144 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4146 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4150 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4152 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4153 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4158 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4160 return CResult_NonePaymentSendFailureZ_free(arg_conv);
4163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4164 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4166 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4167 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4172 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4174 return CResult_NonePeerHandleErrorZ_free(arg_conv);
4177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4178 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4180 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4181 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4186 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4188 return CResult_PublicKeySecpErrorZ_free(arg_conv);
4191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4192 LDKPublicKey arg_ref;
4193 DO_ASSERT((*_env)->GetArrayLength (_env, arg) == 33);
4194 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4195 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4196 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4200 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4201 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4203 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4204 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4209 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4211 return CResult_RouteLightningErrorZ_free(arg_conv);
4214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4215 LDKRoute arg_conv = *(LDKRoute*)arg;
4217 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4218 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4223 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4225 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4226 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4231 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4233 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4236 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4237 LDKSecretKey arg_ref;
4238 DO_ASSERT((*_env)->GetArrayLength (_env, arg) == 32);
4239 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4240 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4241 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4246 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4248 return CResult_SignatureNoneZ_free(arg_conv);
4251 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4252 LDKSignature arg_ref;
4253 DO_ASSERT((*_env)->GetArrayLength (_env, arg) == 64);
4254 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4255 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4256 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4261 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4263 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4264 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4269 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4271 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4275 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4277 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4278 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4283 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4285 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4286 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4291 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4293 return CResult_TxOutAccessErrorZ_free(arg_conv);
4296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4297 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4299 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4300 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4305 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4307 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4308 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4313 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4315 return CResult_boolLightningErrorZ_free(arg_conv);
4318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4319 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4320 *ret = CResult_boolLightningErrorZ_ok(arg);
4324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4325 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4327 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4328 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4333 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4335 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4339 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4340 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4345 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4347 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4351 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4353 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4357 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4359 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4363 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4365 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4369 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4371 return CVec_CVec_RouteHopZZ_free(arg_conv);
4374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4375 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4377 return CVec_ChannelDetailsZ_free(arg_conv);
4380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4381 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4383 return CVec_ChannelMonitorZ_free(arg_conv);
4386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4387 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4389 return CVec_EventZ_free(arg_conv);
4392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4393 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4395 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4399 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4401 return CVec_MessageSendEventZ_free(arg_conv);
4404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4405 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4407 return CVec_MonitorEventZ_free(arg_conv);
4410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4411 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4413 return CVec_NetAddressZ_free(arg_conv);
4416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4417 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4419 return CVec_NodeAnnouncementZ_free(arg_conv);
4422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4423 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4425 return CVec_PublicKeyZ_free(arg_conv);
4428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4429 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4431 return CVec_RouteHintZ_free(arg_conv);
4434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4435 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4437 return CVec_RouteHopZ_free(arg_conv);
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4443 return CVec_SignatureZ_free(arg_conv);
4446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4447 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4449 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4453 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4455 return CVec_TransactionZ_free(arg_conv);
4458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4459 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4461 return CVec_TxOutZ_free(arg_conv);
4464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4465 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4467 return CVec_UpdateAddHTLCZ_free(arg_conv);
4470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4471 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4473 return CVec_UpdateFailHTLCZ_free(arg_conv);
4476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4477 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4479 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4483 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4485 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4489 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4491 return CVec_u64Z_free(arg_conv);
4494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4495 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4497 return CVec_u8Z_free(arg_conv);
4500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4501 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4503 return Transaction_free(_res_conv);
4506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4507 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4509 return TxOut_free(_res_conv);
4512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4513 LDKTransaction b_conv = *(LDKTransaction*)b;
4515 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4516 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4521 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4522 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4527 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4528 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4534 a_conv.inner = (void*)(a & (~1));
4535 a_conv.is_owned = (a & 1) || (a == 0);
4536 if (a_conv.inner != NULL)
4537 a_conv = OutPoint_clone(&a_conv);
4538 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4540 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4541 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4546 LDKThirtyTwoBytes a_ref;
4547 DO_ASSERT((*_env)->GetArrayLength (_env, a) == 32);
4548 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4549 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4551 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4552 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4557 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4558 *ret = C2Tuple_u64u64Z_new(a, b);
4562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4564 DO_ASSERT((*_env)->GetArrayLength (_env, a) == 64);
4565 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
4566 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4568 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4569 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_conv);
4573 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4574 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4575 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4580 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4581 *ret = CResult_SignatureNoneZ_err();
4585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4586 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4587 *ret = CResult_CVec_SignatureZNoneZ_err();
4591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4592 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4593 *ret = CResult_NoneAPIErrorZ_ok();
4597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4598 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4599 *ret = CResult_NonePaymentSendFailureZ_ok();
4603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4604 LDKChannelAnnouncement a_conv;
4605 a_conv.inner = (void*)(a & (~1));
4606 a_conv.is_owned = (a & 1) || (a == 0);
4607 if (a_conv.inner != NULL)
4608 a_conv = ChannelAnnouncement_clone(&a_conv);
4609 LDKChannelUpdate b_conv;
4610 b_conv.inner = (void*)(b & (~1));
4611 b_conv.is_owned = (b & 1) || (b == 0);
4612 if (b_conv.inner != NULL)
4613 b_conv = ChannelUpdate_clone(&b_conv);
4614 LDKChannelUpdate c_conv;
4615 c_conv.inner = (void*)(c & (~1));
4616 c_conv.is_owned = (c & 1) || (c == 0);
4617 if (c_conv.inner != NULL)
4618 c_conv = ChannelUpdate_clone(&c_conv);
4619 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4620 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4625 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4626 *ret = CResult_NonePeerHandleErrorZ_ok();
4630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
4631 LDKHTLCOutputInCommitment a_conv;
4632 a_conv.inner = (void*)(a & (~1));
4633 a_conv.is_owned = (a & 1) || (a == 0);
4634 if (a_conv.inner != NULL)
4635 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4637 DO_ASSERT((*_env)->GetArrayLength (_env, b) == 64);
4638 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
4639 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4640 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
4644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4645 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4646 FREE((void*)this_ptr);
4647 return Event_free(this_ptr_conv);
4650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4651 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4652 FREE((void*)this_ptr);
4653 return MessageSendEvent_free(this_ptr_conv);
4656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4657 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4658 FREE((void*)this_ptr);
4659 return MessageSendEventsProvider_free(this_ptr_conv);
4662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4663 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4664 FREE((void*)this_ptr);
4665 return EventsProvider_free(this_ptr_conv);
4668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4669 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4670 FREE((void*)this_ptr);
4671 return APIError_free(this_ptr_conv);
4674 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4675 jclass ret = LDKLevel_to_java(_env, Level_max());
4679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4680 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4681 FREE((void*)this_ptr);
4682 return Logger_free(this_ptr_conv);
4685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4686 LDKChannelHandshakeConfig this_ptr_conv;
4687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4689 return ChannelHandshakeConfig_free(this_ptr_conv);
4692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4693 LDKChannelHandshakeConfig orig_conv;
4694 orig_conv.inner = (void*)(orig & (~1));
4695 orig_conv.is_owned = (orig & 1) || (orig == 0);
4696 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4697 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4700 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4701 LDKChannelHandshakeConfig this_ptr_conv;
4702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4704 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4708 LDKChannelHandshakeConfig this_ptr_conv;
4709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4711 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4714 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4715 LDKChannelHandshakeConfig this_ptr_conv;
4716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4718 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4722 LDKChannelHandshakeConfig this_ptr_conv;
4723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4725 return ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4729 LDKChannelHandshakeConfig this_ptr_conv;
4730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4732 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4736 LDKChannelHandshakeConfig this_ptr_conv;
4737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4739 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4742 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) {
4743 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4744 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4748 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4749 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4753 LDKChannelHandshakeLimits this_ptr_conv;
4754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4756 return ChannelHandshakeLimits_free(this_ptr_conv);
4759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4760 LDKChannelHandshakeLimits orig_conv;
4761 orig_conv.inner = (void*)(orig & (~1));
4762 orig_conv.is_owned = (orig & 1) || (orig == 0);
4763 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4764 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4767 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4768 LDKChannelHandshakeLimits this_ptr_conv;
4769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4771 return ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4775 LDKChannelHandshakeLimits this_ptr_conv;
4776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4778 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4782 LDKChannelHandshakeLimits this_ptr_conv;
4783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4785 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4789 LDKChannelHandshakeLimits this_ptr_conv;
4790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4792 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4796 LDKChannelHandshakeLimits this_ptr_conv;
4797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4799 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4802 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) {
4803 LDKChannelHandshakeLimits this_ptr_conv;
4804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4806 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4810 LDKChannelHandshakeLimits this_ptr_conv;
4811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4813 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4817 LDKChannelHandshakeLimits this_ptr_conv;
4818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4820 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4823 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4824 LDKChannelHandshakeLimits this_ptr_conv;
4825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4827 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4831 LDKChannelHandshakeLimits this_ptr_conv;
4832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4834 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4837 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4838 LDKChannelHandshakeLimits this_ptr_conv;
4839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4841 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4845 LDKChannelHandshakeLimits this_ptr_conv;
4846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4848 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4852 LDKChannelHandshakeLimits this_ptr_conv;
4853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4855 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4859 LDKChannelHandshakeLimits this_ptr_conv;
4860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4862 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4865 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4866 LDKChannelHandshakeLimits this_ptr_conv;
4867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4869 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4873 LDKChannelHandshakeLimits this_ptr_conv;
4874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4876 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4880 LDKChannelHandshakeLimits this_ptr_conv;
4881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4883 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4887 LDKChannelHandshakeLimits this_ptr_conv;
4888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4890 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4893 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4894 LDKChannelHandshakeLimits this_ptr_conv;
4895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4897 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4901 LDKChannelHandshakeLimits this_ptr_conv;
4902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4904 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4907 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) {
4908 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);
4909 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4913 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4914 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4918 LDKChannelConfig this_ptr_conv;
4919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4921 return ChannelConfig_free(this_ptr_conv);
4924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4925 LDKChannelConfig orig_conv;
4926 orig_conv.inner = (void*)(orig & (~1));
4927 orig_conv.is_owned = (orig & 1) || (orig == 0);
4928 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
4929 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4932 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4933 LDKChannelConfig this_ptr_conv;
4934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4936 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4940 LDKChannelConfig this_ptr_conv;
4941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4943 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4946 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4947 LDKChannelConfig this_ptr_conv;
4948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4950 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4954 LDKChannelConfig this_ptr_conv;
4955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4957 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4961 LDKChannelConfig this_ptr_conv;
4962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4964 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4968 LDKChannelConfig this_ptr_conv;
4969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4971 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4974 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) {
4975 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4976 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4980 LDKChannelConfig ret = ChannelConfig_default();
4981 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4985 LDKChannelConfig obj_conv;
4986 obj_conv.inner = (void*)(obj & (~1));
4987 obj_conv.is_owned = (obj & 1) || (obj == 0);
4988 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4989 *ret = ChannelConfig_write(&obj_conv);
4993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4994 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4995 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4996 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5000 LDKUserConfig 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 UserConfig_free(this_ptr_conv);
5006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5007 LDKUserConfig orig_conv;
5008 orig_conv.inner = (void*)(orig & (~1));
5009 orig_conv.is_owned = (orig & 1) || (orig == 0);
5010 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5011 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5015 LDKUserConfig this_ptr_conv;
5016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5018 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5019 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5023 LDKUserConfig this_ptr_conv;
5024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5026 LDKChannelHandshakeConfig val_conv;
5027 val_conv.inner = (void*)(val & (~1));
5028 val_conv.is_owned = (val & 1) || (val == 0);
5029 if (val_conv.inner != NULL)
5030 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5031 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5035 LDKUserConfig this_ptr_conv;
5036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5038 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5039 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5043 LDKUserConfig this_ptr_conv;
5044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5046 LDKChannelHandshakeLimits val_conv;
5047 val_conv.inner = (void*)(val & (~1));
5048 val_conv.is_owned = (val & 1) || (val == 0);
5049 if (val_conv.inner != NULL)
5050 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5051 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5055 LDKUserConfig this_ptr_conv;
5056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5058 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5059 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5063 LDKUserConfig this_ptr_conv;
5064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5066 LDKChannelConfig val_conv;
5067 val_conv.inner = (void*)(val & (~1));
5068 val_conv.is_owned = (val & 1) || (val == 0);
5069 if (val_conv.inner != NULL)
5070 val_conv = ChannelConfig_clone(&val_conv);
5071 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5074 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) {
5075 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5076 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5077 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5078 if (own_channel_config_arg_conv.inner != NULL)
5079 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5080 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5081 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5082 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5083 if (peer_channel_config_limits_arg_conv.inner != NULL)
5084 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5085 LDKChannelConfig channel_options_arg_conv;
5086 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5087 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5088 if (channel_options_arg_conv.inner != NULL)
5089 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5090 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5091 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5095 LDKUserConfig ret = UserConfig_default();
5096 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5100 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5101 FREE((void*)this_ptr);
5102 return Access_free(this_ptr_conv);
5105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5106 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5107 FREE((void*)this_ptr);
5108 return Watch_free(this_ptr_conv);
5111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5112 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5113 FREE((void*)this_ptr);
5114 return Filter_free(this_ptr_conv);
5117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5118 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5119 FREE((void*)this_ptr);
5120 return BroadcasterInterface_free(this_ptr_conv);
5123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5124 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5125 FREE((void*)this_ptr);
5126 return FeeEstimator_free(this_ptr_conv);
5129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5130 LDKChainMonitor this_ptr_conv;
5131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5133 return ChainMonitor_free(this_ptr_conv);
5136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5137 LDKChainMonitor this_arg_conv;
5138 this_arg_conv.inner = (void*)(this_arg & (~1));
5139 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5140 unsigned char header_arr[80];
5141 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
5142 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5143 unsigned char (*header_ref)[80] = &header_arr;
5144 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5145 FREE((void*)txdata);
5146 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5150 LDKChainMonitor this_arg_conv;
5151 this_arg_conv.inner = (void*)(this_arg & (~1));
5152 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5153 unsigned char header_arr[80];
5154 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
5155 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5156 unsigned char (*header_ref)[80] = &header_arr;
5157 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5161 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5162 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5163 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5164 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5165 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5167 LDKLogger logger_conv = *(LDKLogger*)logger;
5168 if (logger_conv.free == LDKLogger_JCalls_free) {
5169 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5170 LDKLogger_JCalls_clone(logger_conv.this_arg);
5172 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5173 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5174 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5175 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5177 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5178 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5182 LDKChainMonitor this_arg_conv;
5183 this_arg_conv.inner = (void*)(this_arg & (~1));
5184 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5185 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5186 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5190 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5191 LDKChainMonitor this_arg_conv;
5192 this_arg_conv.inner = (void*)(this_arg & (~1));
5193 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5194 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5195 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5200 LDKChannelMonitorUpdate this_ptr_conv;
5201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5203 return ChannelMonitorUpdate_free(this_ptr_conv);
5206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5207 LDKChannelMonitorUpdate orig_conv;
5208 orig_conv.inner = (void*)(orig & (~1));
5209 orig_conv.is_owned = (orig & 1) || (orig == 0);
5210 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5211 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5215 LDKChannelMonitorUpdate this_ptr_conv;
5216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5218 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5222 LDKChannelMonitorUpdate this_ptr_conv;
5223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5225 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5229 LDKChannelMonitorUpdate obj_conv;
5230 obj_conv.inner = (void*)(obj & (~1));
5231 obj_conv.is_owned = (obj & 1) || (obj == 0);
5232 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5233 *ret = ChannelMonitorUpdate_write(&obj_conv);
5237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5238 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5239 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
5240 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5244 LDKMonitorUpdateError this_ptr_conv;
5245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5247 return MonitorUpdateError_free(this_ptr_conv);
5250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5251 LDKMonitorEvent this_ptr_conv;
5252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5254 return MonitorEvent_free(this_ptr_conv);
5257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5258 LDKHTLCUpdate this_ptr_conv;
5259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5261 return HTLCUpdate_free(this_ptr_conv);
5264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5265 LDKHTLCUpdate orig_conv;
5266 orig_conv.inner = (void*)(orig & (~1));
5267 orig_conv.is_owned = (orig & 1) || (orig == 0);
5268 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5269 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5273 LDKHTLCUpdate obj_conv;
5274 obj_conv.inner = (void*)(obj & (~1));
5275 obj_conv.is_owned = (obj & 1) || (obj == 0);
5276 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5277 *ret = HTLCUpdate_write(&obj_conv);
5281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5282 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5283 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5284 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5288 LDKChannelMonitor 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 return ChannelMonitor_free(this_ptr_conv);
5294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5295 LDKChannelMonitor this_arg_conv;
5296 this_arg_conv.inner = (void*)(this_arg & (~1));
5297 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5298 LDKChannelMonitorUpdate updates_conv;
5299 updates_conv.inner = (void*)(updates & (~1));
5300 updates_conv.is_owned = (updates & 1) || (updates == 0);
5301 if (updates_conv.inner != NULL)
5302 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5303 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5304 LDKLogger* logger_conv = (LDKLogger*)logger;
5305 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5306 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5311 LDKChannelMonitor this_arg_conv;
5312 this_arg_conv.inner = (void*)(this_arg & (~1));
5313 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5314 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5318 LDKChannelMonitor this_arg_conv;
5319 this_arg_conv.inner = (void*)(this_arg & (~1));
5320 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5321 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5322 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5327 LDKChannelMonitor this_arg_conv;
5328 this_arg_conv.inner = (void*)(this_arg & (~1));
5329 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5330 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5331 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5336 LDKChannelMonitor this_arg_conv;
5337 this_arg_conv.inner = (void*)(this_arg & (~1));
5338 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5339 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5340 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5345 LDKChannelMonitor this_arg_conv;
5346 this_arg_conv.inner = (void*)(this_arg & (~1));
5347 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5348 LDKLogger* logger_conv = (LDKLogger*)logger;
5349 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5350 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5354 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) {
5355 LDKChannelMonitor this_arg_conv;
5356 this_arg_conv.inner = (void*)(this_arg & (~1));
5357 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5358 unsigned char header_arr[80];
5359 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
5360 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5361 unsigned char (*header_ref)[80] = &header_arr;
5362 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5363 FREE((void*)txdata);
5364 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5365 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5366 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5367 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5369 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5370 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5371 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5372 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5374 LDKLogger logger_conv = *(LDKLogger*)logger;
5375 if (logger_conv.free == LDKLogger_JCalls_free) {
5376 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5377 LDKLogger_JCalls_clone(logger_conv.this_arg);
5379 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5380 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5384 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) {
5385 LDKChannelMonitor 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 unsigned char header_arr[80];
5389 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
5390 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5391 unsigned char (*header_ref)[80] = &header_arr;
5392 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5393 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5394 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5395 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5397 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5398 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5399 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5400 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5402 LDKLogger logger_conv = *(LDKLogger*)logger;
5403 if (logger_conv.free == LDKLogger_JCalls_free) {
5404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5405 LDKLogger_JCalls_clone(logger_conv.this_arg);
5407 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5411 LDKOutPoint this_ptr_conv;
5412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5414 return OutPoint_free(this_ptr_conv);
5417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5418 LDKOutPoint orig_conv;
5419 orig_conv.inner = (void*)(orig & (~1));
5420 orig_conv.is_owned = (orig & 1) || (orig == 0);
5421 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5422 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5426 LDKOutPoint this_ptr_conv;
5427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5429 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5430 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5435 LDKOutPoint this_ptr_conv;
5436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5438 LDKThirtyTwoBytes val_ref;
5439 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5440 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5441 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5444 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5445 LDKOutPoint this_ptr_conv;
5446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5448 return OutPoint_get_index(&this_ptr_conv);
5451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5452 LDKOutPoint this_ptr_conv;
5453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5455 return OutPoint_set_index(&this_ptr_conv, val);
5458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5459 LDKThirtyTwoBytes txid_arg_ref;
5460 DO_ASSERT((*_env)->GetArrayLength (_env, txid_arg) == 32);
5461 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5462 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5463 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5466 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5467 LDKOutPoint this_arg_conv;
5468 this_arg_conv.inner = (void*)(this_arg & (~1));
5469 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5470 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5471 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5476 LDKOutPoint obj_conv;
5477 obj_conv.inner = (void*)(obj & (~1));
5478 obj_conv.is_owned = (obj & 1) || (obj == 0);
5479 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5480 *ret = OutPoint_write(&obj_conv);
5484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5485 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5486 LDKOutPoint ret = OutPoint_read(ser_conv);
5487 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5491 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5492 FREE((void*)this_ptr);
5493 return SpendableOutputDescriptor_free(this_ptr_conv);
5496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5497 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5498 FREE((void*)this_ptr);
5499 return ChannelKeys_free(this_ptr_conv);
5502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5503 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5504 FREE((void*)this_ptr);
5505 return KeysInterface_free(this_ptr_conv);
5508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5509 LDKInMemoryChannelKeys this_ptr_conv;
5510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5512 return InMemoryChannelKeys_free(this_ptr_conv);
5515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5516 LDKInMemoryChannelKeys orig_conv;
5517 orig_conv.inner = (void*)(orig & (~1));
5518 orig_conv.is_owned = (orig & 1) || (orig == 0);
5519 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5520 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5523 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5524 LDKInMemoryChannelKeys this_ptr_conv;
5525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5527 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5528 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5533 LDKInMemoryChannelKeys this_ptr_conv;
5534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5536 LDKSecretKey val_ref;
5537 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5538 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5539 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5542 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5543 LDKInMemoryChannelKeys this_ptr_conv;
5544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5546 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5547 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5552 LDKInMemoryChannelKeys 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 LDKSecretKey val_ref;
5556 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5557 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5558 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5561 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5562 LDKInMemoryChannelKeys this_ptr_conv;
5563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5565 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5566 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5571 LDKInMemoryChannelKeys this_ptr_conv;
5572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5574 LDKSecretKey val_ref;
5575 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5576 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5577 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5580 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5581 LDKInMemoryChannelKeys this_ptr_conv;
5582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5584 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5585 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5590 LDKInMemoryChannelKeys this_ptr_conv;
5591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5593 LDKSecretKey val_ref;
5594 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5595 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5596 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5599 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5600 LDKInMemoryChannelKeys this_ptr_conv;
5601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5603 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5604 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5609 LDKInMemoryChannelKeys this_ptr_conv;
5610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5612 LDKSecretKey val_ref;
5613 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5614 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5615 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
5618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5619 LDKInMemoryChannelKeys this_ptr_conv;
5620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5622 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5623 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5628 LDKInMemoryChannelKeys this_ptr_conv;
5629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5631 LDKThirtyTwoBytes val_ref;
5632 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5633 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5634 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_key, jbyteArray revocation_base_key, jbyteArray payment_key, jbyteArray delayed_payment_base_key, jbyteArray htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
5638 LDKSecretKey funding_key_ref;
5639 DO_ASSERT((*_env)->GetArrayLength (_env, funding_key) == 32);
5640 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
5641 LDKSecretKey revocation_base_key_ref;
5642 DO_ASSERT((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
5643 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
5644 LDKSecretKey payment_key_ref;
5645 DO_ASSERT((*_env)->GetArrayLength (_env, payment_key) == 32);
5646 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
5647 LDKSecretKey delayed_payment_base_key_ref;
5648 DO_ASSERT((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
5649 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
5650 LDKSecretKey htlc_base_key_ref;
5651 DO_ASSERT((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
5652 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
5653 LDKThirtyTwoBytes commitment_seed_ref;
5654 DO_ASSERT((*_env)->GetArrayLength (_env, commitment_seed) == 32);
5655 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5656 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5657 FREE((void*)key_derivation_params);
5658 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
5659 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5663 LDKInMemoryChannelKeys this_arg_conv;
5664 this_arg_conv.inner = (void*)(this_arg & (~1));
5665 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5666 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5667 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5670 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5671 LDKInMemoryChannelKeys this_arg_conv;
5672 this_arg_conv.inner = (void*)(this_arg & (~1));
5673 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5674 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5677 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5678 LDKInMemoryChannelKeys this_arg_conv;
5679 this_arg_conv.inner = (void*)(this_arg & (~1));
5680 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5681 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5685 LDKInMemoryChannelKeys this_arg_conv;
5686 this_arg_conv.inner = (void*)(this_arg & (~1));
5687 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5688 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5689 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5694 LDKInMemoryChannelKeys obj_conv;
5695 obj_conv.inner = (void*)(obj & (~1));
5696 obj_conv.is_owned = (obj & 1) || (obj == 0);
5697 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5698 *ret = InMemoryChannelKeys_write(&obj_conv);
5702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5703 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5704 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5709 LDKKeysManager this_ptr_conv;
5710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5712 return KeysManager_free(this_ptr_conv);
5715 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) {
5716 unsigned char seed_arr[32];
5717 DO_ASSERT((*_env)->GetArrayLength (_env, seed) == 32);
5718 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5719 unsigned char (*seed_ref)[32] = &seed_arr;
5720 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5721 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5722 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5725 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) {
5726 LDKKeysManager this_arg_conv;
5727 this_arg_conv.inner = (void*)(this_arg & (~1));
5728 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5729 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5730 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5734 LDKKeysManager this_arg_conv;
5735 this_arg_conv.inner = (void*)(this_arg & (~1));
5736 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5737 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5738 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5743 LDKChannelManager this_ptr_conv;
5744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5746 return ChannelManager_free(this_ptr_conv);
5749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5750 LDKChannelDetails this_ptr_conv;
5751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5753 return ChannelDetails_free(this_ptr_conv);
5756 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5757 LDKChannelDetails this_ptr_conv;
5758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5760 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5761 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5766 LDKChannelDetails this_ptr_conv;
5767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5769 LDKThirtyTwoBytes val_ref;
5770 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
5771 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5772 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5775 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5776 LDKChannelDetails this_ptr_conv;
5777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5778 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5779 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5780 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5785 LDKChannelDetails this_ptr_conv;
5786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5788 LDKPublicKey val_ref;
5789 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
5790 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5791 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5795 LDKChannelDetails this_ptr_conv;
5796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5798 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5799 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5803 LDKChannelDetails this_ptr_conv;
5804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5806 LDKInitFeatures val_conv;
5807 val_conv.inner = (void*)(val & (~1));
5808 val_conv.is_owned = (val & 1) || (val == 0);
5809 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5813 LDKChannelDetails this_ptr_conv;
5814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5816 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5820 LDKChannelDetails this_ptr_conv;
5821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5823 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5827 LDKChannelDetails this_ptr_conv;
5828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5830 return ChannelDetails_get_user_id(&this_ptr_conv);
5833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5834 LDKChannelDetails this_ptr_conv;
5835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5837 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5841 LDKChannelDetails this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5848 LDKChannelDetails this_ptr_conv;
5849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5851 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5855 LDKChannelDetails this_ptr_conv;
5856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5858 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5862 LDKChannelDetails this_ptr_conv;
5863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5865 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5869 LDKChannelDetails this_ptr_conv;
5870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5872 return ChannelDetails_get_is_live(&this_ptr_conv);
5875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5876 LDKChannelDetails this_ptr_conv;
5877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5879 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5883 LDKPaymentSendFailure 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 return PaymentSendFailure_free(this_ptr_conv);
5889 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) {
5890 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5891 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5892 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5893 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5894 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5896 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5897 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5898 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5899 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5901 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5902 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5904 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5906 LDKLogger logger_conv = *(LDKLogger*)logger;
5907 if (logger_conv.free == LDKLogger_JCalls_free) {
5908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5909 LDKLogger_JCalls_clone(logger_conv.this_arg);
5911 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5912 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5913 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5914 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5916 LDKUserConfig config_conv;
5917 config_conv.inner = (void*)(config & (~1));
5918 config_conv.is_owned = (config & 1) || (config == 0);
5919 if (config_conv.inner != NULL)
5920 config_conv = UserConfig_clone(&config_conv);
5921 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);
5922 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5925 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) {
5926 LDKChannelManager this_arg_conv;
5927 this_arg_conv.inner = (void*)(this_arg & (~1));
5928 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5929 LDKPublicKey their_network_key_ref;
5930 DO_ASSERT((*_env)->GetArrayLength (_env, their_network_key) == 33);
5931 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
5932 LDKUserConfig override_config_conv;
5933 override_config_conv.inner = (void*)(override_config & (~1));
5934 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5935 if (override_config_conv.inner != NULL)
5936 override_config_conv = UserConfig_clone(&override_config_conv);
5937 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5938 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
5942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5943 LDKChannelManager this_arg_conv;
5944 this_arg_conv.inner = (void*)(this_arg & (~1));
5945 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5946 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5947 *ret = ChannelManager_list_channels(&this_arg_conv);
5951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5952 LDKChannelManager this_arg_conv;
5953 this_arg_conv.inner = (void*)(this_arg & (~1));
5954 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5955 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5956 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5961 LDKChannelManager this_arg_conv;
5962 this_arg_conv.inner = (void*)(this_arg & (~1));
5963 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5964 unsigned char channel_id_arr[32];
5965 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id) == 32);
5966 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5967 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5968 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5969 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5974 LDKChannelManager this_arg_conv;
5975 this_arg_conv.inner = (void*)(this_arg & (~1));
5976 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5977 unsigned char channel_id_arr[32];
5978 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id) == 32);
5979 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5980 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5981 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5985 LDKChannelManager this_arg_conv;
5986 this_arg_conv.inner = (void*)(this_arg & (~1));
5987 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5988 return ChannelManager_force_close_all_channels(&this_arg_conv);
5991 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) {
5992 LDKChannelManager this_arg_conv;
5993 this_arg_conv.inner = (void*)(this_arg & (~1));
5994 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5995 LDKRoute route_conv;
5996 route_conv.inner = (void*)(route & (~1));
5997 route_conv.is_owned = (route & 1) || (route == 0);
5998 LDKThirtyTwoBytes payment_hash_ref;
5999 DO_ASSERT((*_env)->GetArrayLength (_env, payment_hash) == 32);
6000 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6001 LDKThirtyTwoBytes payment_secret_ref;
6002 DO_ASSERT((*_env)->GetArrayLength (_env, payment_secret) == 32);
6003 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6004 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6005 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6009 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) {
6010 LDKChannelManager this_arg_conv;
6011 this_arg_conv.inner = (void*)(this_arg & (~1));
6012 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6013 unsigned char temporary_channel_id_arr[32];
6014 DO_ASSERT((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6015 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6016 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6017 LDKOutPoint funding_txo_conv;
6018 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6019 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6020 if (funding_txo_conv.inner != NULL)
6021 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6022 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6025 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) {
6026 LDKChannelManager this_arg_conv;
6027 this_arg_conv.inner = (void*)(this_arg & (~1));
6028 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6029 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
6031 LDKThirtyTwoBytes alias_ref;
6032 DO_ASSERT((*_env)->GetArrayLength (_env, alias) == 32);
6033 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6034 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
6035 FREE((void*)addresses);
6036 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
6039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6040 LDKChannelManager this_arg_conv;
6041 this_arg_conv.inner = (void*)(this_arg & (~1));
6042 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6043 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6047 LDKChannelManager this_arg_conv;
6048 this_arg_conv.inner = (void*)(this_arg & (~1));
6049 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6050 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6053 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) {
6054 LDKChannelManager this_arg_conv;
6055 this_arg_conv.inner = (void*)(this_arg & (~1));
6056 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6057 unsigned char payment_hash_arr[32];
6058 DO_ASSERT((*_env)->GetArrayLength (_env, payment_hash) == 32);
6059 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6060 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6061 LDKThirtyTwoBytes payment_secret_ref;
6062 DO_ASSERT((*_env)->GetArrayLength (_env, payment_secret) == 32);
6063 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6064 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6067 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) {
6068 LDKChannelManager this_arg_conv;
6069 this_arg_conv.inner = (void*)(this_arg & (~1));
6070 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6071 LDKThirtyTwoBytes payment_preimage_ref;
6072 DO_ASSERT((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6073 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6074 LDKThirtyTwoBytes payment_secret_ref;
6075 DO_ASSERT((*_env)->GetArrayLength (_env, payment_secret) == 32);
6076 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6077 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6080 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6081 LDKChannelManager this_arg_conv;
6082 this_arg_conv.inner = (void*)(this_arg & (~1));
6083 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6084 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6085 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6089 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) {
6090 LDKChannelManager this_arg_conv;
6091 this_arg_conv.inner = (void*)(this_arg & (~1));
6092 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6093 LDKOutPoint funding_txo_conv;
6094 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6095 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6096 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6100 LDKChannelManager this_arg_conv;
6101 this_arg_conv.inner = (void*)(this_arg & (~1));
6102 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6103 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6104 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6109 LDKChannelManager this_arg_conv;
6110 this_arg_conv.inner = (void*)(this_arg & (~1));
6111 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6112 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6113 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6118 LDKChannelManager this_arg_conv;
6119 this_arg_conv.inner = (void*)(this_arg & (~1));
6120 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6121 unsigned char header_arr[80];
6122 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
6123 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6124 unsigned char (*header_ref)[80] = &header_arr;
6125 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6126 FREE((void*)txdata);
6127 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6131 LDKChannelManager this_arg_conv;
6132 this_arg_conv.inner = (void*)(this_arg & (~1));
6133 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6134 unsigned char header_arr[80];
6135 DO_ASSERT((*_env)->GetArrayLength (_env, header) == 80);
6136 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6137 unsigned char (*header_ref)[80] = &header_arr;
6138 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6142 LDKChannelManager this_arg_conv;
6143 this_arg_conv.inner = (void*)(this_arg & (~1));
6144 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6145 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6146 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6151 LDKChannelManagerReadArgs this_ptr_conv;
6152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6154 return ChannelManagerReadArgs_free(this_ptr_conv);
6157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6158 LDKChannelManagerReadArgs this_ptr_conv;
6159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6161 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6166 LDKChannelManagerReadArgs this_ptr_conv;
6167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6169 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6170 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6171 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6172 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6174 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6178 LDKChannelManagerReadArgs 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 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6186 LDKChannelManagerReadArgs this_ptr_conv;
6187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6189 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6190 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6191 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6192 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6194 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6198 LDKChannelManagerReadArgs this_ptr_conv;
6199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6201 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6206 LDKChannelManagerReadArgs 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 LDKWatch val_conv = *(LDKWatch*)val;
6210 if (val_conv.free == LDKWatch_JCalls_free) {
6211 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6212 LDKWatch_JCalls_clone(val_conv.this_arg);
6214 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6217 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6218 LDKChannelManagerReadArgs this_ptr_conv;
6219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6221 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6226 LDKChannelManagerReadArgs this_ptr_conv;
6227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6229 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6230 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6231 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6232 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6234 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6238 LDKChannelManagerReadArgs this_ptr_conv;
6239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6241 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6246 LDKChannelManagerReadArgs this_ptr_conv;
6247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6249 LDKLogger val_conv = *(LDKLogger*)val;
6250 if (val_conv.free == LDKLogger_JCalls_free) {
6251 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6252 LDKLogger_JCalls_clone(val_conv.this_arg);
6254 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6258 LDKChannelManagerReadArgs this_ptr_conv;
6259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6261 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6262 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6266 LDKChannelManagerReadArgs this_ptr_conv;
6267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6269 LDKUserConfig val_conv;
6270 val_conv.inner = (void*)(val & (~1));
6271 val_conv.is_owned = (val & 1) || (val == 0);
6272 if (val_conv.inner != NULL)
6273 val_conv = UserConfig_clone(&val_conv);
6274 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6277 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) {
6278 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6279 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6280 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6281 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6283 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6284 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6285 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6286 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6288 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6289 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6291 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6293 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6294 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6295 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6296 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6298 LDKLogger logger_conv = *(LDKLogger*)logger;
6299 if (logger_conv.free == LDKLogger_JCalls_free) {
6300 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6301 LDKLogger_JCalls_clone(logger_conv.this_arg);
6303 LDKUserConfig default_config_conv;
6304 default_config_conv.inner = (void*)(default_config & (~1));
6305 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6306 if (default_config_conv.inner != NULL)
6307 default_config_conv = UserConfig_clone(&default_config_conv);
6308 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6309 FREE((void*)channel_monitors);
6310 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6311 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6315 LDKDecodeError 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 return DecodeError_free(this_ptr_conv);
6321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6322 LDKInit this_ptr_conv;
6323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6325 return Init_free(this_ptr_conv);
6328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6329 LDKErrorMessage this_ptr_conv;
6330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6332 return ErrorMessage_free(this_ptr_conv);
6335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6336 LDKErrorMessage orig_conv;
6337 orig_conv.inner = (void*)(orig & (~1));
6338 orig_conv.is_owned = (orig & 1) || (orig == 0);
6339 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6340 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6344 LDKErrorMessage this_ptr_conv;
6345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6347 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6348 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6353 LDKErrorMessage this_ptr_conv;
6354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6356 LDKThirtyTwoBytes val_ref;
6357 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
6358 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6359 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6363 LDKErrorMessage this_ptr_conv;
6364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6366 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6367 *ret = ErrorMessage_get_data(&this_ptr_conv);
6371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6372 LDKErrorMessage this_ptr_conv;
6373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6375 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6377 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6381 LDKThirtyTwoBytes channel_id_arg_ref;
6382 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
6383 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6384 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6385 FREE((void*)data_arg);
6386 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6387 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6391 LDKPing this_ptr_conv;
6392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6394 return Ping_free(this_ptr_conv);
6397 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6398 LDKPing this_ptr_conv;
6399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6401 return Ping_get_ponglen(&this_ptr_conv);
6404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6405 LDKPing 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 Ping_set_ponglen(&this_ptr_conv, val);
6411 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6412 LDKPing 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 Ping_get_byteslen(&this_ptr_conv);
6418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6419 LDKPing 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 Ping_set_byteslen(&this_ptr_conv, val);
6425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6426 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6427 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6431 LDKPong this_ptr_conv;
6432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6434 return Pong_free(this_ptr_conv);
6437 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6438 LDKPong this_ptr_conv;
6439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6441 return Pong_get_byteslen(&this_ptr_conv);
6444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6445 LDKPong this_ptr_conv;
6446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6448 return Pong_set_byteslen(&this_ptr_conv, val);
6451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6452 LDKPong ret = Pong_new(byteslen_arg);
6453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6457 LDKOpenChannel this_ptr_conv;
6458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6460 return OpenChannel_free(this_ptr_conv);
6463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6464 LDKOpenChannel orig_conv;
6465 orig_conv.inner = (void*)(orig & (~1));
6466 orig_conv.is_owned = (orig & 1) || (orig == 0);
6467 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6468 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6471 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6472 LDKOpenChannel this_ptr_conv;
6473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6475 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6476 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6481 LDKOpenChannel this_ptr_conv;
6482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6484 LDKThirtyTwoBytes val_ref;
6485 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
6486 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6487 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6490 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6491 LDKOpenChannel this_ptr_conv;
6492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6494 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6495 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6500 LDKOpenChannel this_ptr_conv;
6501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6503 LDKThirtyTwoBytes val_ref;
6504 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
6505 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6506 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6510 LDKOpenChannel this_ptr_conv;
6511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6513 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6517 LDKOpenChannel this_ptr_conv;
6518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6520 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6524 LDKOpenChannel this_ptr_conv;
6525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6527 return OpenChannel_get_push_msat(&this_ptr_conv);
6530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6531 LDKOpenChannel this_ptr_conv;
6532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6534 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6538 LDKOpenChannel this_ptr_conv;
6539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6541 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6545 LDKOpenChannel this_ptr_conv;
6546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6548 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6552 LDKOpenChannel this_ptr_conv;
6553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6555 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6558 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) {
6559 LDKOpenChannel this_ptr_conv;
6560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6562 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6566 LDKOpenChannel this_ptr_conv;
6567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6569 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6573 LDKOpenChannel this_ptr_conv;
6574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6576 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6580 LDKOpenChannel this_ptr_conv;
6581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6583 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6587 LDKOpenChannel 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 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6593 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6594 LDKOpenChannel this_ptr_conv;
6595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6597 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6601 LDKOpenChannel this_ptr_conv;
6602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6604 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6607 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6608 LDKOpenChannel this_ptr_conv;
6609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6611 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6615 LDKOpenChannel this_ptr_conv;
6616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6618 return OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6621 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6622 LDKOpenChannel this_ptr_conv;
6623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6625 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6629 LDKOpenChannel this_ptr_conv;
6630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6632 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6636 LDKOpenChannel this_ptr_conv;
6637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6639 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6640 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6645 LDKOpenChannel this_ptr_conv;
6646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6648 LDKPublicKey val_ref;
6649 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6650 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6651 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6654 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6655 LDKOpenChannel this_ptr_conv;
6656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6658 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6659 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6664 LDKOpenChannel this_ptr_conv;
6665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6667 LDKPublicKey val_ref;
6668 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6669 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6670 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6673 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6674 LDKOpenChannel this_ptr_conv;
6675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6677 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6678 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6683 LDKOpenChannel this_ptr_conv;
6684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6686 LDKPublicKey val_ref;
6687 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6688 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6689 return OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6692 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6693 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6697 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6702 LDKOpenChannel this_ptr_conv;
6703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6705 LDKPublicKey val_ref;
6706 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6707 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6708 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6711 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6712 LDKOpenChannel this_ptr_conv;
6713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6715 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6716 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6721 LDKOpenChannel this_ptr_conv;
6722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6724 LDKPublicKey val_ref;
6725 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6726 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6727 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6730 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6731 LDKOpenChannel this_ptr_conv;
6732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6734 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6735 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6740 LDKOpenChannel this_ptr_conv;
6741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6743 LDKPublicKey val_ref;
6744 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6745 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6746 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6749 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6750 LDKOpenChannel this_ptr_conv;
6751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6753 return OpenChannel_get_channel_flags(&this_ptr_conv);
6756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6757 LDKOpenChannel this_ptr_conv;
6758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6760 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6764 LDKAcceptChannel this_ptr_conv;
6765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6767 return AcceptChannel_free(this_ptr_conv);
6770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6771 LDKAcceptChannel orig_conv;
6772 orig_conv.inner = (void*)(orig & (~1));
6773 orig_conv.is_owned = (orig & 1) || (orig == 0);
6774 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6775 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6778 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6779 LDKAcceptChannel this_ptr_conv;
6780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6782 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6783 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6788 LDKAcceptChannel this_ptr_conv;
6789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6791 LDKThirtyTwoBytes val_ref;
6792 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
6793 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6794 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6798 LDKAcceptChannel this_ptr_conv;
6799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6801 return AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6805 LDKAcceptChannel this_ptr_conv;
6806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6808 return AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6812 LDKAcceptChannel this_ptr_conv;
6813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6815 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6818 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) {
6819 LDKAcceptChannel this_ptr_conv;
6820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6822 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6826 LDKAcceptChannel this_ptr_conv;
6827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6829 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6833 LDKAcceptChannel this_ptr_conv;
6834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6836 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6840 LDKAcceptChannel 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 AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6847 LDKAcceptChannel 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 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6853 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6854 LDKAcceptChannel this_ptr_conv;
6855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6857 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6861 LDKAcceptChannel this_ptr_conv;
6862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6864 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6867 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6868 LDKAcceptChannel this_ptr_conv;
6869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6871 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6875 LDKAcceptChannel this_ptr_conv;
6876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6878 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6881 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6882 LDKAcceptChannel this_ptr_conv;
6883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6885 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6889 LDKAcceptChannel this_ptr_conv;
6890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6892 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6895 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6896 LDKAcceptChannel this_ptr_conv;
6897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6905 LDKAcceptChannel this_ptr_conv;
6906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6908 LDKPublicKey val_ref;
6909 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6910 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6911 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6914 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6915 LDKAcceptChannel this_ptr_conv;
6916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6918 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6919 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6924 LDKAcceptChannel 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 LDKPublicKey val_ref;
6928 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6929 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6930 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6934 LDKAcceptChannel this_ptr_conv;
6935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6937 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6938 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
6942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6943 LDKAcceptChannel this_ptr_conv;
6944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6946 LDKPublicKey val_ref;
6947 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6948 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6949 return AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
6952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6953 LDKAcceptChannel this_ptr_conv;
6954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6962 LDKAcceptChannel this_ptr_conv;
6963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6965 LDKPublicKey val_ref;
6966 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6967 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6968 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6971 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6972 LDKAcceptChannel this_ptr_conv;
6973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6975 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6976 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6981 LDKAcceptChannel this_ptr_conv;
6982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6984 LDKPublicKey val_ref;
6985 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
6986 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6987 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6990 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6991 LDKAcceptChannel this_ptr_conv;
6992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6994 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6995 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7000 LDKAcceptChannel this_ptr_conv;
7001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7003 LDKPublicKey val_ref;
7004 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
7005 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7006 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7010 LDKFundingCreated this_ptr_conv;
7011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7013 return FundingCreated_free(this_ptr_conv);
7016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7017 LDKFundingCreated orig_conv;
7018 orig_conv.inner = (void*)(orig & (~1));
7019 orig_conv.is_owned = (orig & 1) || (orig == 0);
7020 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7021 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7024 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7025 LDKFundingCreated this_ptr_conv;
7026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7028 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7029 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7034 LDKFundingCreated this_ptr_conv;
7035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7037 LDKThirtyTwoBytes val_ref;
7038 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7039 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7040 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7043 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7044 LDKFundingCreated this_ptr_conv;
7045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7047 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7048 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7053 LDKFundingCreated this_ptr_conv;
7054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7056 LDKThirtyTwoBytes val_ref;
7057 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7058 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7059 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7062 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7063 LDKFundingCreated this_ptr_conv;
7064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7066 return FundingCreated_get_funding_output_index(&this_ptr_conv);
7069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7070 LDKFundingCreated this_ptr_conv;
7071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7073 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7076 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7077 LDKFundingCreated this_ptr_conv;
7078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7080 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7081 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7086 LDKFundingCreated this_ptr_conv;
7087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7089 LDKSignature val_ref;
7090 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
7091 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7092 return FundingCreated_set_signature(&this_ptr_conv, val_ref);
7095 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, jbyteArray signature_arg) {
7096 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7097 DO_ASSERT((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7098 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7099 LDKThirtyTwoBytes funding_txid_arg_ref;
7100 DO_ASSERT((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7101 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7102 LDKSignature signature_arg_ref;
7103 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
7104 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7105 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7106 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7110 LDKFundingSigned this_ptr_conv;
7111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7113 return FundingSigned_free(this_ptr_conv);
7116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7117 LDKFundingSigned orig_conv;
7118 orig_conv.inner = (void*)(orig & (~1));
7119 orig_conv.is_owned = (orig & 1) || (orig == 0);
7120 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7121 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7125 LDKFundingSigned this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7128 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7129 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7134 LDKFundingSigned 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 LDKThirtyTwoBytes val_ref;
7138 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7139 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7140 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7143 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7144 LDKFundingSigned this_ptr_conv;
7145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7147 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7148 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
7152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7153 LDKFundingSigned this_ptr_conv;
7154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7156 LDKSignature val_ref;
7157 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
7158 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7159 return FundingSigned_set_signature(&this_ptr_conv, val_ref);
7162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
7163 LDKThirtyTwoBytes channel_id_arg_ref;
7164 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7165 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7166 LDKSignature signature_arg_ref;
7167 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
7168 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7169 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
7170 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7174 LDKFundingLocked this_ptr_conv;
7175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7177 return FundingLocked_free(this_ptr_conv);
7180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7181 LDKFundingLocked orig_conv;
7182 orig_conv.inner = (void*)(orig & (~1));
7183 orig_conv.is_owned = (orig & 1) || (orig == 0);
7184 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7185 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7188 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7189 LDKFundingLocked this_ptr_conv;
7190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7192 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7193 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7198 LDKFundingLocked this_ptr_conv;
7199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7201 LDKThirtyTwoBytes val_ref;
7202 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7203 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7204 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7207 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7208 LDKFundingLocked 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 arg_arr = (*_env)->NewByteArray(_env, 33);
7212 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7217 LDKFundingLocked 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 LDKPublicKey val_ref;
7221 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
7222 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7223 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7227 LDKThirtyTwoBytes channel_id_arg_ref;
7228 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7229 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7230 LDKPublicKey next_per_commitment_point_arg_ref;
7231 DO_ASSERT((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7232 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7233 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7234 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7238 LDKShutdown this_ptr_conv;
7239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7241 return Shutdown_free(this_ptr_conv);
7244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7245 LDKShutdown orig_conv;
7246 orig_conv.inner = (void*)(orig & (~1));
7247 orig_conv.is_owned = (orig & 1) || (orig == 0);
7248 LDKShutdown ret = Shutdown_clone(&orig_conv);
7249 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7252 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7253 LDKShutdown this_ptr_conv;
7254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7256 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7257 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7262 LDKShutdown this_ptr_conv;
7263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7265 LDKThirtyTwoBytes val_ref;
7266 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7267 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7268 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7272 LDKShutdown this_ptr_conv;
7273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7275 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
7276 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
7280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7281 LDKShutdown this_ptr_conv;
7282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7284 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7286 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7290 LDKThirtyTwoBytes channel_id_arg_ref;
7291 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7292 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7293 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7294 FREE((void*)scriptpubkey_arg);
7295 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7296 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7300 LDKClosingSigned this_ptr_conv;
7301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7303 return ClosingSigned_free(this_ptr_conv);
7306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7307 LDKClosingSigned orig_conv;
7308 orig_conv.inner = (void*)(orig & (~1));
7309 orig_conv.is_owned = (orig & 1) || (orig == 0);
7310 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7311 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7314 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7315 LDKClosingSigned this_ptr_conv;
7316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7318 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7319 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7324 LDKClosingSigned this_ptr_conv;
7325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7327 LDKThirtyTwoBytes val_ref;
7328 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7329 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7330 return ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7334 LDKClosingSigned this_ptr_conv;
7335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7337 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7341 LDKClosingSigned this_ptr_conv;
7342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7344 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7347 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7348 LDKClosingSigned this_ptr_conv;
7349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7351 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7352 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
7356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7357 LDKClosingSigned this_ptr_conv;
7358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7360 LDKSignature val_ref;
7361 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
7362 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7363 return ClosingSigned_set_signature(&this_ptr_conv, val_ref);
7366 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jbyteArray signature_arg) {
7367 LDKThirtyTwoBytes channel_id_arg_ref;
7368 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7369 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7370 LDKSignature signature_arg_ref;
7371 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
7372 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7373 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
7374 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7378 LDKUpdateAddHTLC this_ptr_conv;
7379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7381 return UpdateAddHTLC_free(this_ptr_conv);
7384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7385 LDKUpdateAddHTLC orig_conv;
7386 orig_conv.inner = (void*)(orig & (~1));
7387 orig_conv.is_owned = (orig & 1) || (orig == 0);
7388 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7389 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7393 LDKUpdateAddHTLC this_ptr_conv;
7394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7396 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7397 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7402 LDKUpdateAddHTLC this_ptr_conv;
7403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7405 LDKThirtyTwoBytes val_ref;
7406 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7407 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7408 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7412 LDKUpdateAddHTLC this_ptr_conv;
7413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7415 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7419 LDKUpdateAddHTLC this_ptr_conv;
7420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7422 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7426 LDKUpdateAddHTLC this_ptr_conv;
7427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7429 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7433 LDKUpdateAddHTLC this_ptr_conv;
7434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7436 return UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7439 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7440 LDKUpdateAddHTLC this_ptr_conv;
7441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7443 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7444 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7449 LDKUpdateAddHTLC this_ptr_conv;
7450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7452 LDKThirtyTwoBytes val_ref;
7453 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7454 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7455 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7458 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7459 LDKUpdateAddHTLC 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 UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7466 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7473 LDKUpdateFulfillHTLC 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 UpdateFulfillHTLC_free(this_ptr_conv);
7479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7480 LDKUpdateFulfillHTLC orig_conv;
7481 orig_conv.inner = (void*)(orig & (~1));
7482 orig_conv.is_owned = (orig & 1) || (orig == 0);
7483 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7484 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7488 LDKUpdateFulfillHTLC this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7491 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7492 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7497 LDKUpdateFulfillHTLC this_ptr_conv;
7498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7500 LDKThirtyTwoBytes val_ref;
7501 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7502 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7503 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7507 LDKUpdateFulfillHTLC this_ptr_conv;
7508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7510 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7514 LDKUpdateFulfillHTLC this_ptr_conv;
7515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7517 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7520 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7521 LDKUpdateFulfillHTLC this_ptr_conv;
7522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7524 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7525 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7530 LDKUpdateFulfillHTLC this_ptr_conv;
7531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7532 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7533 LDKThirtyTwoBytes val_ref;
7534 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7535 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7536 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7539 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) {
7540 LDKThirtyTwoBytes channel_id_arg_ref;
7541 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7542 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7543 LDKThirtyTwoBytes payment_preimage_arg_ref;
7544 DO_ASSERT((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
7545 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7546 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7547 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7551 LDKUpdateFailHTLC this_ptr_conv;
7552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7554 return UpdateFailHTLC_free(this_ptr_conv);
7557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7558 LDKUpdateFailHTLC orig_conv;
7559 orig_conv.inner = (void*)(orig & (~1));
7560 orig_conv.is_owned = (orig & 1) || (orig == 0);
7561 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7562 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7565 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7566 LDKUpdateFailHTLC this_ptr_conv;
7567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7569 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7570 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7575 LDKUpdateFailHTLC this_ptr_conv;
7576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7578 LDKThirtyTwoBytes val_ref;
7579 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7580 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7581 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7585 LDKUpdateFailHTLC this_ptr_conv;
7586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7588 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7592 LDKUpdateFailHTLC this_ptr_conv;
7593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7595 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7599 LDKUpdateFailMalformedHTLC this_ptr_conv;
7600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7602 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7606 LDKUpdateFailMalformedHTLC orig_conv;
7607 orig_conv.inner = (void*)(orig & (~1));
7608 orig_conv.is_owned = (orig & 1) || (orig == 0);
7609 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7610 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7614 LDKUpdateFailMalformedHTLC this_ptr_conv;
7615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7617 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7618 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7623 LDKUpdateFailMalformedHTLC this_ptr_conv;
7624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7626 LDKThirtyTwoBytes val_ref;
7627 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7628 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7629 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7633 LDKUpdateFailMalformedHTLC this_ptr_conv;
7634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7636 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7640 LDKUpdateFailMalformedHTLC this_ptr_conv;
7641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7643 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7646 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7647 LDKUpdateFailMalformedHTLC this_ptr_conv;
7648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7650 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7654 LDKUpdateFailMalformedHTLC 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 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7661 LDKCommitmentSigned this_ptr_conv;
7662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7664 return CommitmentSigned_free(this_ptr_conv);
7667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7668 LDKCommitmentSigned orig_conv;
7669 orig_conv.inner = (void*)(orig & (~1));
7670 orig_conv.is_owned = (orig & 1) || (orig == 0);
7671 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7672 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7675 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7676 LDKCommitmentSigned this_ptr_conv;
7677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7679 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7680 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7685 LDKCommitmentSigned this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7688 LDKThirtyTwoBytes val_ref;
7689 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7690 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7691 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7694 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7695 LDKCommitmentSigned this_ptr_conv;
7696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7698 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7699 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
7703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7704 LDKCommitmentSigned this_ptr_conv;
7705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7707 LDKSignature val_ref;
7708 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
7709 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7710 return CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
7713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7714 LDKCommitmentSigned 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 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7719 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg, jlong htlc_signatures_arg) {
7723 LDKThirtyTwoBytes channel_id_arg_ref;
7724 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7725 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7726 LDKSignature signature_arg_ref;
7727 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
7728 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7729 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7730 FREE((void*)htlc_signatures_arg);
7731 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_conv);
7732 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7736 LDKRevokeAndACK this_ptr_conv;
7737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7739 return RevokeAndACK_free(this_ptr_conv);
7742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7743 LDKRevokeAndACK orig_conv;
7744 orig_conv.inner = (void*)(orig & (~1));
7745 orig_conv.is_owned = (orig & 1) || (orig == 0);
7746 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7747 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7750 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7751 LDKRevokeAndACK this_ptr_conv;
7752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7754 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7755 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7760 LDKRevokeAndACK this_ptr_conv;
7761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7763 LDKThirtyTwoBytes val_ref;
7764 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7765 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7766 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7769 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7770 LDKRevokeAndACK this_ptr_conv;
7771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7773 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7774 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7779 LDKRevokeAndACK this_ptr_conv;
7780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7782 LDKThirtyTwoBytes val_ref;
7783 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7784 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7785 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7789 LDKRevokeAndACK this_ptr_conv;
7790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7792 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7793 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7798 LDKRevokeAndACK this_ptr_conv;
7799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7801 LDKPublicKey val_ref;
7802 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
7803 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7804 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7807 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) {
7808 LDKThirtyTwoBytes channel_id_arg_ref;
7809 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7810 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7811 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7812 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
7813 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7814 LDKPublicKey next_per_commitment_point_arg_ref;
7815 DO_ASSERT((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7816 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7817 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7818 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7822 LDKUpdateFee this_ptr_conv;
7823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7825 return UpdateFee_free(this_ptr_conv);
7828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7829 LDKUpdateFee orig_conv;
7830 orig_conv.inner = (void*)(orig & (~1));
7831 orig_conv.is_owned = (orig & 1) || (orig == 0);
7832 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
7833 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7836 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7837 LDKUpdateFee this_ptr_conv;
7838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7840 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7841 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7846 LDKUpdateFee this_ptr_conv;
7847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7849 LDKThirtyTwoBytes val_ref;
7850 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7851 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7852 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7855 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7856 LDKUpdateFee this_ptr_conv;
7857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7859 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7863 LDKUpdateFee 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 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7870 LDKThirtyTwoBytes channel_id_arg_ref;
7871 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7872 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7873 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7874 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7878 LDKDataLossProtect this_ptr_conv;
7879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7881 return DataLossProtect_free(this_ptr_conv);
7884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7885 LDKDataLossProtect orig_conv;
7886 orig_conv.inner = (void*)(orig & (~1));
7887 orig_conv.is_owned = (orig & 1) || (orig == 0);
7888 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
7889 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7892 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7893 LDKDataLossProtect this_ptr_conv;
7894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7896 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7897 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7902 LDKDataLossProtect this_ptr_conv;
7903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7905 LDKThirtyTwoBytes val_ref;
7906 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7907 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7908 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7912 LDKDataLossProtect this_ptr_conv;
7913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
7920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7921 LDKDataLossProtect this_ptr_conv;
7922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7924 LDKPublicKey val_ref;
7925 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
7926 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7927 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
7930 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) {
7931 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7932 DO_ASSERT((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
7933 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7934 LDKPublicKey my_current_per_commitment_point_arg_ref;
7935 DO_ASSERT((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
7936 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
7937 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
7938 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7942 LDKChannelReestablish 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 return ChannelReestablish_free(this_ptr_conv);
7948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7949 LDKChannelReestablish orig_conv;
7950 orig_conv.inner = (void*)(orig & (~1));
7951 orig_conv.is_owned = (orig & 1) || (orig == 0);
7952 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
7953 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7956 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7957 LDKChannelReestablish this_ptr_conv;
7958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7960 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7961 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7966 LDKChannelReestablish this_ptr_conv;
7967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7969 LDKThirtyTwoBytes val_ref;
7970 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
7971 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7972 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7976 LDKChannelReestablish 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 ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7983 LDKChannelReestablish 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 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7990 LDKChannelReestablish this_ptr_conv;
7991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7993 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7997 LDKChannelReestablish this_ptr_conv;
7998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8000 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8004 LDKAnnouncementSignatures this_ptr_conv;
8005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8007 return AnnouncementSignatures_free(this_ptr_conv);
8010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8011 LDKAnnouncementSignatures orig_conv;
8012 orig_conv.inner = (void*)(orig & (~1));
8013 orig_conv.is_owned = (orig & 1) || (orig == 0);
8014 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8015 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8018 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8019 LDKAnnouncementSignatures this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8022 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8023 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8028 LDKAnnouncementSignatures this_ptr_conv;
8029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8031 LDKThirtyTwoBytes val_ref;
8032 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8033 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8034 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8038 LDKAnnouncementSignatures this_ptr_conv;
8039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8041 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8045 LDKAnnouncementSignatures this_ptr_conv;
8046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8048 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8051 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8052 LDKAnnouncementSignatures this_ptr_conv;
8053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8055 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8056 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8061 LDKAnnouncementSignatures this_ptr_conv;
8062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8064 LDKSignature val_ref;
8065 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8066 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8067 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8070 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8071 LDKAnnouncementSignatures 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8075 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8080 LDKAnnouncementSignatures this_ptr_conv;
8081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8083 LDKSignature val_ref;
8084 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8085 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8086 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jbyteArray node_signature_arg, jbyteArray bitcoin_signature_arg) {
8090 LDKThirtyTwoBytes channel_id_arg_ref;
8091 DO_ASSERT((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8092 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8093 LDKSignature node_signature_arg_ref;
8094 DO_ASSERT((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8095 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8096 LDKSignature bitcoin_signature_arg_ref;
8097 DO_ASSERT((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8098 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8099 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8100 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8104 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8105 FREE((void*)this_ptr);
8106 return NetAddress_free(this_ptr_conv);
8109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8110 LDKUnsignedNodeAnnouncement this_ptr_conv;
8111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8113 return UnsignedNodeAnnouncement_free(this_ptr_conv);
8116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8117 LDKUnsignedNodeAnnouncement orig_conv;
8118 orig_conv.inner = (void*)(orig & (~1));
8119 orig_conv.is_owned = (orig & 1) || (orig == 0);
8120 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
8121 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8125 LDKUnsignedNodeAnnouncement this_ptr_conv;
8126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8128 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8129 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8133 LDKUnsignedNodeAnnouncement this_ptr_conv;
8134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8136 LDKNodeFeatures val_conv;
8137 val_conv.inner = (void*)(val & (~1));
8138 val_conv.is_owned = (val & 1) || (val == 0);
8139 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8142 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8143 LDKUnsignedNodeAnnouncement this_ptr_conv;
8144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8146 return UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8150 LDKUnsignedNodeAnnouncement this_ptr_conv;
8151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8153 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8156 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8157 LDKUnsignedNodeAnnouncement this_ptr_conv;
8158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8160 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8161 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8166 LDKUnsignedNodeAnnouncement this_ptr_conv;
8167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8169 LDKPublicKey val_ref;
8170 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
8171 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8172 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8175 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8176 LDKUnsignedNodeAnnouncement this_ptr_conv;
8177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8179 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8180 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8185 LDKUnsignedNodeAnnouncement this_ptr_conv;
8186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8188 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
8190 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
8193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8194 LDKUnsignedNodeAnnouncement this_ptr_conv;
8195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8197 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8198 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8203 LDKUnsignedNodeAnnouncement this_ptr_conv;
8204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8206 LDKThirtyTwoBytes val_ref;
8207 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8208 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8209 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8213 LDKUnsignedNodeAnnouncement this_ptr_conv;
8214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8216 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8218 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8222 LDKNodeAnnouncement this_ptr_conv;
8223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8225 return NodeAnnouncement_free(this_ptr_conv);
8228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8229 LDKNodeAnnouncement orig_conv;
8230 orig_conv.inner = (void*)(orig & (~1));
8231 orig_conv.is_owned = (orig & 1) || (orig == 0);
8232 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8233 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8236 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8237 LDKNodeAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8241 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
8245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8246 LDKNodeAnnouncement this_ptr_conv;
8247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8249 LDKSignature val_ref;
8250 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8251 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8252 return NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
8255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8256 LDKNodeAnnouncement this_ptr_conv;
8257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8259 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8260 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8264 LDKNodeAnnouncement this_ptr_conv;
8265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8267 LDKUnsignedNodeAnnouncement val_conv;
8268 val_conv.inner = (void*)(val & (~1));
8269 val_conv.is_owned = (val & 1) || (val == 0);
8270 if (val_conv.inner != NULL)
8271 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8272 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8276 LDKSignature signature_arg_ref;
8277 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
8278 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8279 LDKUnsignedNodeAnnouncement contents_arg_conv;
8280 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8281 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8282 if (contents_arg_conv.inner != NULL)
8283 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8284 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
8285 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8289 LDKUnsignedChannelAnnouncement this_ptr_conv;
8290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8292 return UnsignedChannelAnnouncement_free(this_ptr_conv);
8295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8296 LDKUnsignedChannelAnnouncement orig_conv;
8297 orig_conv.inner = (void*)(orig & (~1));
8298 orig_conv.is_owned = (orig & 1) || (orig == 0);
8299 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8300 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8304 LDKUnsignedChannelAnnouncement 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 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8308 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8312 LDKUnsignedChannelAnnouncement this_ptr_conv;
8313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8315 LDKChannelFeatures val_conv;
8316 val_conv.inner = (void*)(val & (~1));
8317 val_conv.is_owned = (val & 1) || (val == 0);
8318 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8321 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8322 LDKUnsignedChannelAnnouncement 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8326 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8331 LDKUnsignedChannelAnnouncement this_ptr_conv;
8332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8334 LDKThirtyTwoBytes val_ref;
8335 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8336 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8337 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8341 LDKUnsignedChannelAnnouncement this_ptr_conv;
8342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8344 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8348 LDKUnsignedChannelAnnouncement this_ptr_conv;
8349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8351 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8355 LDKUnsignedChannelAnnouncement this_ptr_conv;
8356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8358 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8359 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8364 LDKUnsignedChannelAnnouncement this_ptr_conv;
8365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8367 LDKPublicKey val_ref;
8368 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
8369 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8370 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8374 LDKUnsignedChannelAnnouncement this_ptr_conv;
8375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8377 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8378 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8383 LDKUnsignedChannelAnnouncement this_ptr_conv;
8384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8386 LDKPublicKey val_ref;
8387 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
8388 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8389 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8393 LDKUnsignedChannelAnnouncement 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 arg_arr = (*_env)->NewByteArray(_env, 33);
8397 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8402 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
8406 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
8407 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8408 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8411 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8412 LDKUnsignedChannelAnnouncement this_ptr_conv;
8413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8415 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8416 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8421 LDKUnsignedChannelAnnouncement this_ptr_conv;
8422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8424 LDKPublicKey val_ref;
8425 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
8426 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8427 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8431 LDKChannelAnnouncement this_ptr_conv;
8432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8434 return ChannelAnnouncement_free(this_ptr_conv);
8437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8438 LDKChannelAnnouncement orig_conv;
8439 orig_conv.inner = (void*)(orig & (~1));
8440 orig_conv.is_owned = (orig & 1) || (orig == 0);
8441 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8442 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8445 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8446 LDKChannelAnnouncement this_ptr_conv;
8447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8449 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8450 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
8454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8455 LDKChannelAnnouncement this_ptr_conv;
8456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8458 LDKSignature val_ref;
8459 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8460 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8461 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
8464 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8465 LDKChannelAnnouncement this_ptr_conv;
8466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8468 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8469 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
8473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8474 LDKChannelAnnouncement this_ptr_conv;
8475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8477 LDKSignature val_ref;
8478 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8479 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8480 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
8483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8484 LDKChannelAnnouncement this_ptr_conv;
8485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8487 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8488 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
8492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8493 LDKChannelAnnouncement this_ptr_conv;
8494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8496 LDKSignature val_ref;
8497 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8498 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8499 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
8502 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8503 LDKChannelAnnouncement this_ptr_conv;
8504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8506 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8507 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
8511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8512 LDKChannelAnnouncement this_ptr_conv;
8513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8515 LDKSignature val_ref;
8516 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8517 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8518 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
8521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8522 LDKChannelAnnouncement this_ptr_conv;
8523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8525 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8526 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8530 LDKChannelAnnouncement this_ptr_conv;
8531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8532 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8533 LDKUnsignedChannelAnnouncement val_conv;
8534 val_conv.inner = (void*)(val & (~1));
8535 val_conv.is_owned = (val & 1) || (val == 0);
8536 if (val_conv.inner != NULL)
8537 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8538 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray node_signature_1_arg, jbyteArray node_signature_2_arg, jbyteArray bitcoin_signature_1_arg, jbyteArray bitcoin_signature_2_arg, jlong contents_arg) {
8542 LDKSignature node_signature_1_arg_ref;
8543 DO_ASSERT((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
8544 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
8545 LDKSignature node_signature_2_arg_ref;
8546 DO_ASSERT((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
8547 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
8548 LDKSignature bitcoin_signature_1_arg_ref;
8549 DO_ASSERT((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
8550 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
8551 LDKSignature bitcoin_signature_2_arg_ref;
8552 DO_ASSERT((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
8553 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
8554 LDKUnsignedChannelAnnouncement contents_arg_conv;
8555 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8556 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8557 if (contents_arg_conv.inner != NULL)
8558 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8559 LDKChannelAnnouncement ret = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
8560 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8564 LDKUnsignedChannelUpdate this_ptr_conv;
8565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8567 return UnsignedChannelUpdate_free(this_ptr_conv);
8570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8571 LDKUnsignedChannelUpdate orig_conv;
8572 orig_conv.inner = (void*)(orig & (~1));
8573 orig_conv.is_owned = (orig & 1) || (orig == 0);
8574 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8575 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8578 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8579 LDKUnsignedChannelUpdate this_ptr_conv;
8580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8582 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8583 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8588 LDKUnsignedChannelUpdate this_ptr_conv;
8589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8590 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8591 LDKThirtyTwoBytes val_ref;
8592 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8593 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8594 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8598 LDKUnsignedChannelUpdate this_ptr_conv;
8599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8601 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8605 LDKUnsignedChannelUpdate this_ptr_conv;
8606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8608 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8611 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8612 LDKUnsignedChannelUpdate this_ptr_conv;
8613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8615 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8619 LDKUnsignedChannelUpdate this_ptr_conv;
8620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8622 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8625 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8626 LDKUnsignedChannelUpdate this_ptr_conv;
8627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8629 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8633 LDKUnsignedChannelUpdate this_ptr_conv;
8634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8636 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8639 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8640 LDKUnsignedChannelUpdate this_ptr_conv;
8641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8643 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8647 LDKUnsignedChannelUpdate this_ptr_conv;
8648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8650 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8654 LDKUnsignedChannelUpdate this_ptr_conv;
8655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8657 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8661 LDKUnsignedChannelUpdate this_ptr_conv;
8662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8664 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8667 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8668 LDKUnsignedChannelUpdate this_ptr_conv;
8669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8671 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8675 LDKUnsignedChannelUpdate this_ptr_conv;
8676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8678 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8681 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8682 LDKUnsignedChannelUpdate this_ptr_conv;
8683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8685 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8689 LDKUnsignedChannelUpdate this_ptr_conv;
8690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8692 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8696 LDKChannelUpdate this_ptr_conv;
8697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8699 return ChannelUpdate_free(this_ptr_conv);
8702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8703 LDKChannelUpdate orig_conv;
8704 orig_conv.inner = (void*)(orig & (~1));
8705 orig_conv.is_owned = (orig & 1) || (orig == 0);
8706 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8710 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8711 LDKChannelUpdate this_ptr_conv;
8712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8714 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8715 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
8719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8720 LDKChannelUpdate this_ptr_conv;
8721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8723 LDKSignature val_ref;
8724 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
8725 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8726 return ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
8729 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8730 LDKChannelUpdate this_ptr_conv;
8731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8733 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8734 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8738 LDKChannelUpdate this_ptr_conv;
8739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8741 LDKUnsignedChannelUpdate val_conv;
8742 val_conv.inner = (void*)(val & (~1));
8743 val_conv.is_owned = (val & 1) || (val == 0);
8744 if (val_conv.inner != NULL)
8745 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8746 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8750 LDKSignature signature_arg_ref;
8751 DO_ASSERT((*_env)->GetArrayLength (_env, signature_arg) == 64);
8752 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8753 LDKUnsignedChannelUpdate contents_arg_conv;
8754 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8755 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8756 if (contents_arg_conv.inner != NULL)
8757 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
8758 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
8759 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8763 LDKQueryChannelRange this_ptr_conv;
8764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8766 return QueryChannelRange_free(this_ptr_conv);
8769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8770 LDKQueryChannelRange orig_conv;
8771 orig_conv.inner = (void*)(orig & (~1));
8772 orig_conv.is_owned = (orig & 1) || (orig == 0);
8773 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
8774 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8777 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8778 LDKQueryChannelRange this_ptr_conv;
8779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8781 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8782 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8787 LDKQueryChannelRange this_ptr_conv;
8788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8790 LDKThirtyTwoBytes val_ref;
8791 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8792 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8793 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8796 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8797 LDKQueryChannelRange this_ptr_conv;
8798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8800 return QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8804 LDKQueryChannelRange this_ptr_conv;
8805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8807 return QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8810 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8811 LDKQueryChannelRange this_ptr_conv;
8812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8814 return QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8818 LDKQueryChannelRange this_ptr_conv;
8819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8821 return QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8824 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) {
8825 LDKThirtyTwoBytes chain_hash_arg_ref;
8826 DO_ASSERT((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
8827 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8828 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8829 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8833 LDKReplyChannelRange this_ptr_conv;
8834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8836 return ReplyChannelRange_free(this_ptr_conv);
8839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8840 LDKReplyChannelRange orig_conv;
8841 orig_conv.inner = (void*)(orig & (~1));
8842 orig_conv.is_owned = (orig & 1) || (orig == 0);
8843 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
8844 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8847 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8848 LDKReplyChannelRange this_ptr_conv;
8849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8851 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8852 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8857 LDKReplyChannelRange this_ptr_conv;
8858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8860 LDKThirtyTwoBytes val_ref;
8861 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8862 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8863 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8866 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8867 LDKReplyChannelRange this_ptr_conv;
8868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8870 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8874 LDKReplyChannelRange this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8877 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8880 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8881 LDKReplyChannelRange this_ptr_conv;
8882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8884 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8888 LDKReplyChannelRange this_ptr_conv;
8889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8891 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8895 LDKReplyChannelRange this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8898 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8902 LDKReplyChannelRange this_ptr_conv;
8903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8905 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8909 LDKReplyChannelRange this_ptr_conv;
8910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8912 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8914 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8917 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) {
8918 LDKThirtyTwoBytes chain_hash_arg_ref;
8919 DO_ASSERT((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
8920 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8921 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8922 FREE((void*)short_channel_ids_arg);
8923 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8924 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8928 LDKQueryShortChannelIds this_ptr_conv;
8929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8931 return QueryShortChannelIds_free(this_ptr_conv);
8934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8935 LDKQueryShortChannelIds orig_conv;
8936 orig_conv.inner = (void*)(orig & (~1));
8937 orig_conv.is_owned = (orig & 1) || (orig == 0);
8938 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
8939 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8942 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8943 LDKQueryShortChannelIds this_ptr_conv;
8944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8946 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8947 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8952 LDKQueryShortChannelIds this_ptr_conv;
8953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8955 LDKThirtyTwoBytes val_ref;
8956 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
8957 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8958 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8962 LDKQueryShortChannelIds this_ptr_conv;
8963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8965 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8967 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8971 LDKThirtyTwoBytes chain_hash_arg_ref;
8972 DO_ASSERT((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
8973 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8974 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8975 FREE((void*)short_channel_ids_arg);
8976 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8977 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8981 LDKReplyShortChannelIdsEnd this_ptr_conv;
8982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8984 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8988 LDKReplyShortChannelIdsEnd orig_conv;
8989 orig_conv.inner = (void*)(orig & (~1));
8990 orig_conv.is_owned = (orig & 1) || (orig == 0);
8991 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
8992 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8995 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8996 LDKReplyShortChannelIdsEnd this_ptr_conv;
8997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8999 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9000 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9005 LDKReplyShortChannelIdsEnd this_ptr_conv;
9006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9008 LDKThirtyTwoBytes val_ref;
9009 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
9010 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9011 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9015 LDKReplyShortChannelIdsEnd this_ptr_conv;
9016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9018 return ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9022 LDKReplyShortChannelIdsEnd this_ptr_conv;
9023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9025 return ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9029 LDKThirtyTwoBytes chain_hash_arg_ref;
9030 DO_ASSERT((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9031 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9032 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
9033 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9037 LDKGossipTimestampFilter this_ptr_conv;
9038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9040 return GossipTimestampFilter_free(this_ptr_conv);
9043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9044 LDKGossipTimestampFilter orig_conv;
9045 orig_conv.inner = (void*)(orig & (~1));
9046 orig_conv.is_owned = (orig & 1) || (orig == 0);
9047 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
9048 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9051 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9052 LDKGossipTimestampFilter this_ptr_conv;
9053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9055 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9056 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
9060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9061 LDKGossipTimestampFilter this_ptr_conv;
9062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9064 LDKThirtyTwoBytes val_ref;
9065 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
9066 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9067 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
9070 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9071 LDKGossipTimestampFilter this_ptr_conv;
9072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9074 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
9077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9078 LDKGossipTimestampFilter this_ptr_conv;
9079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9081 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
9084 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
9085 LDKGossipTimestampFilter 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 GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
9091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9092 LDKGossipTimestampFilter 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 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
9098 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) {
9099 LDKThirtyTwoBytes chain_hash_arg_ref;
9100 DO_ASSERT((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9101 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9102 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
9103 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9107 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
9108 FREE((void*)this_ptr);
9109 return ErrorAction_free(this_ptr_conv);
9112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9113 LDKLightningError this_ptr_conv;
9114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9116 return LightningError_free(this_ptr_conv);
9119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
9120 LDKLightningError 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 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
9124 *ret = LightningError_get_err(&this_ptr_conv);
9128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9129 LDKLightningError this_ptr_conv;
9130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9132 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
9134 return LightningError_set_err(&this_ptr_conv, val_conv);
9137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
9138 LDKLightningError this_ptr_conv;
9139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9141 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
9142 *ret = LightningError_get_action(&this_ptr_conv);
9146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9147 LDKLightningError this_ptr_conv;
9148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9150 LDKErrorAction val_conv = *(LDKErrorAction*)val;
9152 return LightningError_set_action(&this_ptr_conv, val_conv);
9155 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
9156 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
9157 FREE((void*)err_arg);
9158 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9159 FREE((void*)action_arg);
9160 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
9161 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9165 LDKCommitmentUpdate this_ptr_conv;
9166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9168 return CommitmentUpdate_free(this_ptr_conv);
9171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9172 LDKCommitmentUpdate orig_conv;
9173 orig_conv.inner = (void*)(orig & (~1));
9174 orig_conv.is_owned = (orig & 1) || (orig == 0);
9175 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9176 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9180 LDKCommitmentUpdate this_ptr_conv;
9181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9183 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9185 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9189 LDKCommitmentUpdate this_ptr_conv;
9190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9192 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9194 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9198 LDKCommitmentUpdate this_ptr_conv;
9199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9201 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9203 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9207 LDKCommitmentUpdate this_ptr_conv;
9208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9210 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9212 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9216 LDKCommitmentUpdate this_ptr_conv;
9217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9219 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9220 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9224 LDKCommitmentUpdate this_ptr_conv;
9225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9226 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9227 LDKUpdateFee val_conv;
9228 val_conv.inner = (void*)(val & (~1));
9229 val_conv.is_owned = (val & 1) || (val == 0);
9230 if (val_conv.inner != NULL)
9231 val_conv = UpdateFee_clone(&val_conv);
9232 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9236 LDKCommitmentUpdate this_ptr_conv;
9237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9239 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9240 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9244 LDKCommitmentUpdate this_ptr_conv;
9245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9247 LDKCommitmentSigned val_conv;
9248 val_conv.inner = (void*)(val & (~1));
9249 val_conv.is_owned = (val & 1) || (val == 0);
9250 if (val_conv.inner != NULL)
9251 val_conv = CommitmentSigned_clone(&val_conv);
9252 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9255 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) {
9256 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9257 FREE((void*)update_add_htlcs_arg);
9258 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9259 FREE((void*)update_fulfill_htlcs_arg);
9260 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9261 FREE((void*)update_fail_htlcs_arg);
9262 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9263 FREE((void*)update_fail_malformed_htlcs_arg);
9264 LDKUpdateFee update_fee_arg_conv;
9265 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9266 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9267 if (update_fee_arg_conv.inner != NULL)
9268 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9269 LDKCommitmentSigned commitment_signed_arg_conv;
9270 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9271 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9272 if (commitment_signed_arg_conv.inner != NULL)
9273 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9274 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);
9275 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9279 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9280 FREE((void*)this_ptr);
9281 return HTLCFailChannelUpdate_free(this_ptr_conv);
9284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9285 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9286 FREE((void*)this_ptr);
9287 return ChannelMessageHandler_free(this_ptr_conv);
9290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9291 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9292 FREE((void*)this_ptr);
9293 return RoutingMessageHandler_free(this_ptr_conv);
9296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9297 LDKAcceptChannel obj_conv;
9298 obj_conv.inner = (void*)(obj & (~1));
9299 obj_conv.is_owned = (obj & 1) || (obj == 0);
9300 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9301 *ret = AcceptChannel_write(&obj_conv);
9305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9306 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9307 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
9308 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9312 LDKAnnouncementSignatures obj_conv;
9313 obj_conv.inner = (void*)(obj & (~1));
9314 obj_conv.is_owned = (obj & 1) || (obj == 0);
9315 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9316 *ret = AnnouncementSignatures_write(&obj_conv);
9320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
9321 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9322 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
9323 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9327 LDKChannelReestablish obj_conv;
9328 obj_conv.inner = (void*)(obj & (~1));
9329 obj_conv.is_owned = (obj & 1) || (obj == 0);
9330 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9331 *ret = ChannelReestablish_write(&obj_conv);
9335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
9336 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9337 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
9338 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9342 LDKClosingSigned obj_conv;
9343 obj_conv.inner = (void*)(obj & (~1));
9344 obj_conv.is_owned = (obj & 1) || (obj == 0);
9345 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9346 *ret = ClosingSigned_write(&obj_conv);
9350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9351 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9352 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
9353 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9357 LDKCommitmentSigned obj_conv;
9358 obj_conv.inner = (void*)(obj & (~1));
9359 obj_conv.is_owned = (obj & 1) || (obj == 0);
9360 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9361 *ret = CommitmentSigned_write(&obj_conv);
9365 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9366 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9367 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
9368 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9372 LDKFundingCreated obj_conv;
9373 obj_conv.inner = (void*)(obj & (~1));
9374 obj_conv.is_owned = (obj & 1) || (obj == 0);
9375 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9376 *ret = FundingCreated_write(&obj_conv);
9380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
9381 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9382 LDKFundingCreated ret = FundingCreated_read(ser_conv);
9383 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9387 LDKFundingSigned obj_conv;
9388 obj_conv.inner = (void*)(obj & (~1));
9389 obj_conv.is_owned = (obj & 1) || (obj == 0);
9390 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9391 *ret = FundingSigned_write(&obj_conv);
9395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9396 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9397 LDKFundingSigned ret = FundingSigned_read(ser_conv);
9398 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9402 LDKFundingLocked obj_conv;
9403 obj_conv.inner = (void*)(obj & (~1));
9404 obj_conv.is_owned = (obj & 1) || (obj == 0);
9405 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9406 *ret = FundingLocked_write(&obj_conv);
9410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
9411 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9412 LDKFundingLocked ret = FundingLocked_read(ser_conv);
9413 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9418 obj_conv.inner = (void*)(obj & (~1));
9419 obj_conv.is_owned = (obj & 1) || (obj == 0);
9420 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9421 *ret = Init_write(&obj_conv);
9425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
9426 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9427 LDKInit ret = Init_read(ser_conv);
9428 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9432 LDKOpenChannel obj_conv;
9433 obj_conv.inner = (void*)(obj & (~1));
9434 obj_conv.is_owned = (obj & 1) || (obj == 0);
9435 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9436 *ret = OpenChannel_write(&obj_conv);
9440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9441 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9442 LDKOpenChannel ret = OpenChannel_read(ser_conv);
9443 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9447 LDKRevokeAndACK obj_conv;
9448 obj_conv.inner = (void*)(obj & (~1));
9449 obj_conv.is_owned = (obj & 1) || (obj == 0);
9450 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9451 *ret = RevokeAndACK_write(&obj_conv);
9455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
9456 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9457 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
9458 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9462 LDKShutdown obj_conv;
9463 obj_conv.inner = (void*)(obj & (~1));
9464 obj_conv.is_owned = (obj & 1) || (obj == 0);
9465 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9466 *ret = Shutdown_write(&obj_conv);
9470 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
9471 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9472 LDKShutdown ret = Shutdown_read(ser_conv);
9473 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9477 LDKUpdateFailHTLC obj_conv;
9478 obj_conv.inner = (void*)(obj & (~1));
9479 obj_conv.is_owned = (obj & 1) || (obj == 0);
9480 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9481 *ret = UpdateFailHTLC_write(&obj_conv);
9485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9486 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9487 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
9488 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9492 LDKUpdateFailMalformedHTLC obj_conv;
9493 obj_conv.inner = (void*)(obj & (~1));
9494 obj_conv.is_owned = (obj & 1) || (obj == 0);
9495 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9496 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
9500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9501 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9502 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
9503 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9507 LDKUpdateFee obj_conv;
9508 obj_conv.inner = (void*)(obj & (~1));
9509 obj_conv.is_owned = (obj & 1) || (obj == 0);
9510 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9511 *ret = UpdateFee_write(&obj_conv);
9515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
9516 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9517 LDKUpdateFee ret = UpdateFee_read(ser_conv);
9518 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9522 LDKUpdateFulfillHTLC obj_conv;
9523 obj_conv.inner = (void*)(obj & (~1));
9524 obj_conv.is_owned = (obj & 1) || (obj == 0);
9525 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9526 *ret = UpdateFulfillHTLC_write(&obj_conv);
9530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9531 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9532 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
9533 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9537 LDKUpdateAddHTLC obj_conv;
9538 obj_conv.inner = (void*)(obj & (~1));
9539 obj_conv.is_owned = (obj & 1) || (obj == 0);
9540 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9541 *ret = UpdateAddHTLC_write(&obj_conv);
9545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9546 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9547 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
9548 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9553 obj_conv.inner = (void*)(obj & (~1));
9554 obj_conv.is_owned = (obj & 1) || (obj == 0);
9555 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9556 *ret = Ping_write(&obj_conv);
9560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
9561 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9562 LDKPing ret = Ping_read(ser_conv);
9563 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9568 obj_conv.inner = (void*)(obj & (~1));
9569 obj_conv.is_owned = (obj & 1) || (obj == 0);
9570 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9571 *ret = Pong_write(&obj_conv);
9575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
9576 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9577 LDKPong ret = Pong_read(ser_conv);
9578 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9582 LDKUnsignedChannelAnnouncement obj_conv;
9583 obj_conv.inner = (void*)(obj & (~1));
9584 obj_conv.is_owned = (obj & 1) || (obj == 0);
9585 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9586 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9591 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9592 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
9593 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9597 LDKChannelAnnouncement obj_conv;
9598 obj_conv.inner = (void*)(obj & (~1));
9599 obj_conv.is_owned = (obj & 1) || (obj == 0);
9600 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9601 *ret = ChannelAnnouncement_write(&obj_conv);
9605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9606 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9607 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
9608 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9612 LDKUnsignedChannelUpdate obj_conv;
9613 obj_conv.inner = (void*)(obj & (~1));
9614 obj_conv.is_owned = (obj & 1) || (obj == 0);
9615 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9616 *ret = UnsignedChannelUpdate_write(&obj_conv);
9620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9621 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9622 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
9623 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9627 LDKChannelUpdate obj_conv;
9628 obj_conv.inner = (void*)(obj & (~1));
9629 obj_conv.is_owned = (obj & 1) || (obj == 0);
9630 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9631 *ret = ChannelUpdate_write(&obj_conv);
9635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9636 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9637 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
9638 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9642 LDKErrorMessage obj_conv;
9643 obj_conv.inner = (void*)(obj & (~1));
9644 obj_conv.is_owned = (obj & 1) || (obj == 0);
9645 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9646 *ret = ErrorMessage_write(&obj_conv);
9650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
9651 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9652 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
9653 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9657 LDKUnsignedNodeAnnouncement obj_conv;
9658 obj_conv.inner = (void*)(obj & (~1));
9659 obj_conv.is_owned = (obj & 1) || (obj == 0);
9660 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9661 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9666 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9667 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
9668 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9672 LDKNodeAnnouncement obj_conv;
9673 obj_conv.inner = (void*)(obj & (~1));
9674 obj_conv.is_owned = (obj & 1) || (obj == 0);
9675 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9676 *ret = NodeAnnouncement_write(&obj_conv);
9680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9681 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9682 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9683 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9687 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9688 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9689 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9693 LDKQueryShortChannelIds obj_conv;
9694 obj_conv.inner = (void*)(obj & (~1));
9695 obj_conv.is_owned = (obj & 1) || (obj == 0);
9696 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9697 *ret = QueryShortChannelIds_write(&obj_conv);
9701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9702 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9703 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9704 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9708 LDKReplyShortChannelIdsEnd obj_conv;
9709 obj_conv.inner = (void*)(obj & (~1));
9710 obj_conv.is_owned = (obj & 1) || (obj == 0);
9711 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9712 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9717 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9718 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9719 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9723 LDKQueryChannelRange obj_conv;
9724 obj_conv.inner = (void*)(obj & (~1));
9725 obj_conv.is_owned = (obj & 1) || (obj == 0);
9726 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9727 *ret = QueryChannelRange_write(&obj_conv);
9731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9732 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9733 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9734 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9738 LDKReplyChannelRange obj_conv;
9739 obj_conv.inner = (void*)(obj & (~1));
9740 obj_conv.is_owned = (obj & 1) || (obj == 0);
9741 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9742 *ret = ReplyChannelRange_write(&obj_conv);
9746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9747 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9748 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9749 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9753 LDKGossipTimestampFilter obj_conv;
9754 obj_conv.inner = (void*)(obj & (~1));
9755 obj_conv.is_owned = (obj & 1) || (obj == 0);
9756 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9757 *ret = GossipTimestampFilter_write(&obj_conv);
9761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9762 LDKMessageHandler this_ptr_conv;
9763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9765 return MessageHandler_free(this_ptr_conv);
9768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9769 LDKMessageHandler this_ptr_conv;
9770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9772 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9777 LDKMessageHandler 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 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9781 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9782 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9783 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9785 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9789 LDKMessageHandler this_ptr_conv;
9790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9792 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9797 LDKMessageHandler this_ptr_conv;
9798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9800 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9801 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9802 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9803 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9805 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9809 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9810 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9811 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9812 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9814 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9815 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9816 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9817 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9819 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9820 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9824 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9825 FREE((void*)this_ptr);
9826 return SocketDescriptor_free(this_ptr_conv);
9829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9830 LDKPeerHandleError this_ptr_conv;
9831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9833 return PeerHandleError_free(this_ptr_conv);
9836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9837 LDKPeerHandleError this_ptr_conv;
9838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9840 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9844 LDKPeerHandleError this_ptr_conv;
9845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9847 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9851 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9852 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9856 LDKPeerManager this_ptr_conv;
9857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9859 return PeerManager_free(this_ptr_conv);
9862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jbyteArray our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
9863 LDKMessageHandler message_handler_conv;
9864 message_handler_conv.inner = (void*)(message_handler & (~1));
9865 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9866 LDKSecretKey our_node_secret_ref;
9867 DO_ASSERT((*_env)->GetArrayLength (_env, our_node_secret) == 32);
9868 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
9869 unsigned char ephemeral_random_data_arr[32];
9870 DO_ASSERT((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
9871 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9872 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9873 LDKLogger logger_conv = *(LDKLogger*)logger;
9874 if (logger_conv.free == LDKLogger_JCalls_free) {
9875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9876 LDKLogger_JCalls_clone(logger_conv.this_arg);
9878 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
9879 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9883 LDKPeerManager this_arg_conv;
9884 this_arg_conv.inner = (void*)(this_arg & (~1));
9885 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9886 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9887 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9891 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) {
9892 LDKPeerManager this_arg_conv;
9893 this_arg_conv.inner = (void*)(this_arg & (~1));
9894 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9895 LDKPublicKey their_node_id_ref;
9896 DO_ASSERT((*_env)->GetArrayLength (_env, their_node_id) == 33);
9897 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9898 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9899 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9900 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9901 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9903 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9904 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
9908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9909 LDKPeerManager this_arg_conv;
9910 this_arg_conv.inner = (void*)(this_arg & (~1));
9911 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9912 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9913 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9914 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9915 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9917 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9918 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9923 LDKPeerManager this_arg_conv;
9924 this_arg_conv.inner = (void*)(this_arg & (~1));
9925 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9926 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9927 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9928 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9933 LDKPeerManager this_arg_conv;
9934 this_arg_conv.inner = (void*)(this_arg & (~1));
9935 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9936 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9937 LDKu8slice data_conv = *(LDKu8slice*)data;
9938 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9939 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9944 LDKPeerManager this_arg_conv;
9945 this_arg_conv.inner = (void*)(this_arg & (~1));
9946 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9947 return PeerManager_process_events(&this_arg_conv);
9950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9951 LDKPeerManager this_arg_conv;
9952 this_arg_conv.inner = (void*)(this_arg & (~1));
9953 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9954 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9955 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9959 LDKPeerManager this_arg_conv;
9960 this_arg_conv.inner = (void*)(this_arg & (~1));
9961 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9962 return PeerManager_timer_tick_occured(&this_arg_conv);
9965 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9966 unsigned char commitment_seed_arr[32];
9967 DO_ASSERT((*_env)->GetArrayLength (_env, commitment_seed) == 32);
9968 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9969 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9970 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9971 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
9976 LDKPublicKey per_commitment_point_ref;
9977 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
9978 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9979 unsigned char base_secret_arr[32];
9980 DO_ASSERT((*_env)->GetArrayLength (_env, base_secret) == 32);
9981 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9982 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9983 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9984 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
9988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
9989 LDKPublicKey per_commitment_point_ref;
9990 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
9991 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9992 LDKPublicKey base_point_ref;
9993 DO_ASSERT((*_env)->GetArrayLength (_env, base_point) == 33);
9994 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
9995 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9996 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
10000 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) {
10001 unsigned char per_commitment_secret_arr[32];
10002 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
10003 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
10004 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
10005 unsigned char countersignatory_revocation_base_secret_arr[32];
10006 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
10007 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
10008 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
10009 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10010 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
10014 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) {
10015 LDKPublicKey per_commitment_point_ref;
10016 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10017 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10018 LDKPublicKey countersignatory_revocation_base_point_ref;
10019 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
10020 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
10021 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10022 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
10026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10027 LDKTxCreationKeys this_ptr_conv;
10028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10030 return TxCreationKeys_free(this_ptr_conv);
10033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10034 LDKTxCreationKeys orig_conv;
10035 orig_conv.inner = (void*)(orig & (~1));
10036 orig_conv.is_owned = (orig & 1) || (orig == 0);
10037 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
10038 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10041 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10042 LDKTxCreationKeys this_ptr_conv;
10043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10045 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10046 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
10050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10051 LDKTxCreationKeys this_ptr_conv;
10052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10054 LDKPublicKey val_ref;
10055 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10056 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10057 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
10060 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10061 LDKTxCreationKeys this_ptr_conv;
10062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10064 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10065 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
10069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10070 LDKTxCreationKeys this_ptr_conv;
10071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10073 LDKPublicKey val_ref;
10074 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10075 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10076 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
10079 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10080 LDKTxCreationKeys this_ptr_conv;
10081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10083 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10084 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
10088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10089 LDKTxCreationKeys this_ptr_conv;
10090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10092 LDKPublicKey val_ref;
10093 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10094 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10095 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
10098 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10099 LDKTxCreationKeys this_ptr_conv;
10100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10102 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10103 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
10107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10108 LDKTxCreationKeys this_ptr_conv;
10109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10111 LDKPublicKey val_ref;
10112 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10113 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10114 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
10117 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10118 LDKTxCreationKeys this_ptr_conv;
10119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10121 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10122 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
10126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10127 LDKTxCreationKeys this_ptr_conv;
10128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10130 LDKPublicKey val_ref;
10131 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10132 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10133 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
10136 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) {
10137 LDKPublicKey per_commitment_point_arg_ref;
10138 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
10139 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
10140 LDKPublicKey revocation_key_arg_ref;
10141 DO_ASSERT((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
10142 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
10143 LDKPublicKey broadcaster_htlc_key_arg_ref;
10144 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
10145 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
10146 LDKPublicKey countersignatory_htlc_key_arg_ref;
10147 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
10148 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
10149 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
10150 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
10151 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
10152 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);
10153 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10157 LDKTxCreationKeys obj_conv;
10158 obj_conv.inner = (void*)(obj & (~1));
10159 obj_conv.is_owned = (obj & 1) || (obj == 0);
10160 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10161 *ret = TxCreationKeys_write(&obj_conv);
10165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
10166 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10167 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
10168 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10172 LDKPreCalculatedTxCreationKeys this_ptr_conv;
10173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10175 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
10178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10179 LDKTxCreationKeys keys_conv;
10180 keys_conv.inner = (void*)(keys & (~1));
10181 keys_conv.is_owned = (keys & 1) || (keys == 0);
10182 if (keys_conv.inner != NULL)
10183 keys_conv = TxCreationKeys_clone(&keys_conv);
10184 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10185 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10189 LDKPreCalculatedTxCreationKeys this_arg_conv;
10190 this_arg_conv.inner = (void*)(this_arg & (~1));
10191 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10192 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10193 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10196 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10197 LDKPreCalculatedTxCreationKeys this_arg_conv;
10198 this_arg_conv.inner = (void*)(this_arg & (~1));
10199 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10200 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10201 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10206 LDKChannelPublicKeys this_ptr_conv;
10207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10209 return ChannelPublicKeys_free(this_ptr_conv);
10212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10213 LDKChannelPublicKeys orig_conv;
10214 orig_conv.inner = (void*)(orig & (~1));
10215 orig_conv.is_owned = (orig & 1) || (orig == 0);
10216 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10217 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10220 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10221 LDKChannelPublicKeys this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10224 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10225 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10230 LDKChannelPublicKeys this_ptr_conv;
10231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10232 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10233 LDKPublicKey val_ref;
10234 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10235 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10236 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10239 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10240 LDKChannelPublicKeys this_ptr_conv;
10241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10243 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10244 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10249 LDKChannelPublicKeys this_ptr_conv;
10250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10252 LDKPublicKey val_ref;
10253 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10254 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10255 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10258 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10259 LDKChannelPublicKeys this_ptr_conv;
10260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10262 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10263 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10268 LDKChannelPublicKeys this_ptr_conv;
10269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10271 LDKPublicKey val_ref;
10272 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10273 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10274 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10277 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10278 LDKChannelPublicKeys this_ptr_conv;
10279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10280 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10281 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10282 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10287 LDKChannelPublicKeys 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 LDKPublicKey val_ref;
10291 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10292 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10293 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10297 LDKChannelPublicKeys this_ptr_conv;
10298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10300 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10301 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10306 LDKChannelPublicKeys this_ptr_conv;
10307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10309 LDKPublicKey val_ref;
10310 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10311 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10312 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10315 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) {
10316 LDKPublicKey funding_pubkey_arg_ref;
10317 DO_ASSERT((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
10318 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10319 LDKPublicKey revocation_basepoint_arg_ref;
10320 DO_ASSERT((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
10321 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10322 LDKPublicKey payment_point_arg_ref;
10323 DO_ASSERT((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
10324 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10325 LDKPublicKey delayed_payment_basepoint_arg_ref;
10326 DO_ASSERT((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
10327 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10328 LDKPublicKey htlc_basepoint_arg_ref;
10329 DO_ASSERT((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
10330 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10331 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);
10332 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10336 LDKChannelPublicKeys obj_conv;
10337 obj_conv.inner = (void*)(obj & (~1));
10338 obj_conv.is_owned = (obj & 1) || (obj == 0);
10339 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10340 *ret = ChannelPublicKeys_write(&obj_conv);
10344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
10345 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10346 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
10347 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10350 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) {
10351 LDKPublicKey per_commitment_point_ref;
10352 DO_ASSERT((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10353 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10354 LDKPublicKey broadcaster_delayed_payment_base_ref;
10355 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
10356 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10357 LDKPublicKey broadcaster_htlc_base_ref;
10358 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
10359 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10360 LDKPublicKey countersignatory_revocation_base_ref;
10361 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
10362 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10363 LDKPublicKey countersignatory_htlc_base_ref;
10364 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
10365 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10366 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10367 *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);
10371 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) {
10372 LDKPublicKey revocation_key_ref;
10373 DO_ASSERT((*_env)->GetArrayLength (_env, revocation_key) == 33);
10374 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10375 LDKPublicKey broadcaster_delayed_payment_key_ref;
10376 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10377 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10378 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10379 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10384 LDKHTLCOutputInCommitment 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 return HTLCOutputInCommitment_free(this_ptr_conv);
10390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10391 LDKHTLCOutputInCommitment orig_conv;
10392 orig_conv.inner = (void*)(orig & (~1));
10393 orig_conv.is_owned = (orig & 1) || (orig == 0);
10394 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10395 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10399 LDKHTLCOutputInCommitment this_ptr_conv;
10400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10402 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10406 LDKHTLCOutputInCommitment this_ptr_conv;
10407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10409 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10413 LDKHTLCOutputInCommitment this_ptr_conv;
10414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10416 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10420 LDKHTLCOutputInCommitment 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 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10426 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10427 LDKHTLCOutputInCommitment this_ptr_conv;
10428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10430 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10434 LDKHTLCOutputInCommitment this_ptr_conv;
10435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10437 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10440 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10441 LDKHTLCOutputInCommitment this_ptr_conv;
10442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10444 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10445 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10450 LDKHTLCOutputInCommitment this_ptr_conv;
10451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10453 LDKThirtyTwoBytes val_ref;
10454 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
10455 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10456 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10460 LDKHTLCOutputInCommitment obj_conv;
10461 obj_conv.inner = (void*)(obj & (~1));
10462 obj_conv.is_owned = (obj & 1) || (obj == 0);
10463 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10464 *ret = HTLCOutputInCommitment_write(&obj_conv);
10468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
10469 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10470 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
10471 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10475 LDKHTLCOutputInCommitment htlc_conv;
10476 htlc_conv.inner = (void*)(htlc & (~1));
10477 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10478 LDKTxCreationKeys keys_conv;
10479 keys_conv.inner = (void*)(keys & (~1));
10480 keys_conv.is_owned = (keys & 1) || (keys == 0);
10481 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10482 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10487 LDKPublicKey broadcaster_ref;
10488 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster) == 33);
10489 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10490 LDKPublicKey countersignatory_ref;
10491 DO_ASSERT((*_env)->GetArrayLength (_env, countersignatory) == 33);
10492 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10493 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10494 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10498 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) {
10499 unsigned char prev_hash_arr[32];
10500 DO_ASSERT((*_env)->GetArrayLength (_env, prev_hash) == 32);
10501 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10502 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10503 LDKHTLCOutputInCommitment htlc_conv;
10504 htlc_conv.inner = (void*)(htlc & (~1));
10505 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10506 LDKPublicKey broadcaster_delayed_payment_key_ref;
10507 DO_ASSERT((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10508 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10509 LDKPublicKey revocation_key_ref;
10510 DO_ASSERT((*_env)->GetArrayLength (_env, revocation_key) == 33);
10511 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10512 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10513 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10518 LDKHolderCommitmentTransaction this_ptr_conv;
10519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10521 return HolderCommitmentTransaction_free(this_ptr_conv);
10524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10525 LDKHolderCommitmentTransaction orig_conv;
10526 orig_conv.inner = (void*)(orig & (~1));
10527 orig_conv.is_owned = (orig & 1) || (orig == 0);
10528 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10529 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10533 LDKHolderCommitmentTransaction this_ptr_conv;
10534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10536 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10537 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10542 LDKHolderCommitmentTransaction this_ptr_conv;
10543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10545 LDKTransaction val_conv = *(LDKTransaction*)val;
10547 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10551 LDKHolderCommitmentTransaction this_ptr_conv;
10552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
10559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10560 LDKHolderCommitmentTransaction this_ptr_conv;
10561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10563 LDKSignature val_ref;
10564 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 64);
10565 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10566 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
10569 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10570 LDKHolderCommitmentTransaction this_ptr_conv;
10571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10573 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10577 LDKHolderCommitmentTransaction this_ptr_conv;
10578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10580 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10584 LDKHolderCommitmentTransaction this_ptr_conv;
10585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10587 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10589 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
10592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
10593 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
10594 FREE((void*)unsigned_tx);
10595 LDKSignature counterparty_sig_ref;
10596 DO_ASSERT((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
10597 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
10598 LDKPublicKey holder_funding_key_ref;
10599 DO_ASSERT((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
10600 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
10601 LDKPublicKey counterparty_funding_key_ref;
10602 DO_ASSERT((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
10603 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
10604 LDKTxCreationKeys keys_conv;
10605 keys_conv.inner = (void*)(keys & (~1));
10606 keys_conv.is_owned = (keys & 1) || (keys == 0);
10607 if (keys_conv.inner != NULL)
10608 keys_conv = TxCreationKeys_clone(&keys_conv);
10609 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
10610 FREE((void*)htlc_data);
10611 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_conv);
10612 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10616 LDKHolderCommitmentTransaction this_arg_conv;
10617 this_arg_conv.inner = (void*)(this_arg & (~1));
10618 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10619 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10620 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10623 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10624 LDKHolderCommitmentTransaction this_arg_conv;
10625 this_arg_conv.inner = (void*)(this_arg & (~1));
10626 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10627 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10628 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10632 JNIEXPORT jbyteArray 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) {
10633 LDKHolderCommitmentTransaction this_arg_conv;
10634 this_arg_conv.inner = (void*)(this_arg & (~1));
10635 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10636 unsigned char funding_key_arr[32];
10637 DO_ASSERT((*_env)->GetArrayLength (_env, funding_key) == 32);
10638 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10639 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10640 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
10641 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10642 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis).compact_form);
10646 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) {
10647 LDKHolderCommitmentTransaction this_arg_conv;
10648 this_arg_conv.inner = (void*)(this_arg & (~1));
10649 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10650 unsigned char htlc_base_key_arr[32];
10651 DO_ASSERT((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
10652 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10653 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10654 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10655 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10660 LDKHolderCommitmentTransaction obj_conv;
10661 obj_conv.inner = (void*)(obj & (~1));
10662 obj_conv.is_owned = (obj & 1) || (obj == 0);
10663 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10664 *ret = HolderCommitmentTransaction_write(&obj_conv);
10668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
10669 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10670 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
10671 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10675 LDKInitFeatures this_ptr_conv;
10676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10678 return InitFeatures_free(this_ptr_conv);
10681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10682 LDKNodeFeatures this_ptr_conv;
10683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10685 return NodeFeatures_free(this_ptr_conv);
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10689 LDKChannelFeatures this_ptr_conv;
10690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10692 return ChannelFeatures_free(this_ptr_conv);
10695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10696 LDKRouteHop this_ptr_conv;
10697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10699 return RouteHop_free(this_ptr_conv);
10702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10703 LDKRouteHop orig_conv;
10704 orig_conv.inner = (void*)(orig & (~1));
10705 orig_conv.is_owned = (orig & 1) || (orig == 0);
10706 LDKRouteHop ret = RouteHop_clone(&orig_conv);
10707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10710 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10711 LDKRouteHop this_ptr_conv;
10712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10714 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10715 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
10719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10720 LDKRouteHop this_ptr_conv;
10721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10723 LDKPublicKey val_ref;
10724 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10725 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10726 return RouteHop_set_pubkey(&this_ptr_conv, val_ref);
10729 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10730 LDKRouteHop 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 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
10734 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10738 LDKRouteHop this_ptr_conv;
10739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10741 LDKNodeFeatures val_conv;
10742 val_conv.inner = (void*)(val & (~1));
10743 val_conv.is_owned = (val & 1) || (val == 0);
10744 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
10747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10748 LDKRouteHop this_ptr_conv;
10749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10751 return RouteHop_get_short_channel_id(&this_ptr_conv);
10754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10755 LDKRouteHop this_ptr_conv;
10756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10758 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
10761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10762 LDKRouteHop this_ptr_conv;
10763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10765 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
10766 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10770 LDKRouteHop this_ptr_conv;
10771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10773 LDKChannelFeatures val_conv;
10774 val_conv.inner = (void*)(val & (~1));
10775 val_conv.is_owned = (val & 1) || (val == 0);
10776 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10780 LDKRouteHop this_ptr_conv;
10781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10783 return RouteHop_get_fee_msat(&this_ptr_conv);
10786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10787 LDKRouteHop this_ptr_conv;
10788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10790 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10793 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10794 LDKRouteHop this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10797 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10801 LDKRouteHop this_ptr_conv;
10802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10804 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10807 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) {
10808 LDKPublicKey pubkey_arg_ref;
10809 DO_ASSERT((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
10810 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
10811 LDKNodeFeatures node_features_arg_conv;
10812 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10813 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10814 LDKChannelFeatures channel_features_arg_conv;
10815 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10816 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10817 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);
10818 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10822 LDKRoute this_ptr_conv;
10823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10825 return Route_free(this_ptr_conv);
10828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10829 LDKRoute orig_conv;
10830 orig_conv.inner = (void*)(orig & (~1));
10831 orig_conv.is_owned = (orig & 1) || (orig == 0);
10832 LDKRoute ret = Route_clone(&orig_conv);
10833 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10837 LDKRoute this_ptr_conv;
10838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10840 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10842 return Route_set_paths(&this_ptr_conv, val_conv);
10845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10846 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10847 FREE((void*)paths_arg);
10848 LDKRoute ret = Route_new(paths_arg_conv);
10849 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10854 obj_conv.inner = (void*)(obj & (~1));
10855 obj_conv.is_owned = (obj & 1) || (obj == 0);
10856 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10857 *ret = Route_write(&obj_conv);
10861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10862 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10863 LDKRoute ret = Route_read(ser_conv);
10864 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10868 LDKRouteHint this_ptr_conv;
10869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10871 return RouteHint_free(this_ptr_conv);
10874 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10875 LDKRouteHint this_ptr_conv;
10876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10878 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10879 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
10883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10884 LDKRouteHint this_ptr_conv;
10885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10887 LDKPublicKey val_ref;
10888 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
10889 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10890 return RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
10893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10894 LDKRouteHint this_ptr_conv;
10895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10897 return RouteHint_get_short_channel_id(&this_ptr_conv);
10900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10901 LDKRouteHint this_ptr_conv;
10902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10904 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10908 LDKRouteHint this_ptr_conv;
10909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10911 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10916 LDKRouteHint this_ptr_conv;
10917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10919 LDKRoutingFees val_conv;
10920 val_conv.inner = (void*)(val & (~1));
10921 val_conv.is_owned = (val & 1) || (val == 0);
10922 if (val_conv.inner != NULL)
10923 val_conv = RoutingFees_clone(&val_conv);
10924 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10927 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10928 LDKRouteHint this_ptr_conv;
10929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10931 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10935 LDKRouteHint this_ptr_conv;
10936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10938 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10942 LDKRouteHint this_ptr_conv;
10943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10945 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10949 LDKRouteHint this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10952 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10955 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) {
10956 LDKPublicKey src_node_id_arg_ref;
10957 DO_ASSERT((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
10958 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
10959 LDKRoutingFees fees_arg_conv;
10960 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10961 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10962 if (fees_arg_conv.inner != NULL)
10963 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
10964 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10968 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) {
10969 LDKPublicKey our_node_id_ref;
10970 DO_ASSERT((*_env)->GetArrayLength (_env, our_node_id) == 33);
10971 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
10972 LDKNetworkGraph network_conv;
10973 network_conv.inner = (void*)(network & (~1));
10974 network_conv.is_owned = (network & 1) || (network == 0);
10975 LDKPublicKey target_ref;
10976 DO_ASSERT((*_env)->GetArrayLength (_env, target) == 33);
10977 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
10978 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10979 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10980 FREE((void*)last_hops);
10981 LDKLogger logger_conv = *(LDKLogger*)logger;
10982 if (logger_conv.free == LDKLogger_JCalls_free) {
10983 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10984 LDKLogger_JCalls_clone(logger_conv.this_arg);
10986 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10987 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10992 LDKNetworkGraph this_ptr_conv;
10993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10995 return NetworkGraph_free(this_ptr_conv);
10998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10999 LDKLockedNetworkGraph this_ptr_conv;
11000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11002 return LockedNetworkGraph_free(this_ptr_conv);
11005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11006 LDKNetGraphMsgHandler this_ptr_conv;
11007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11009 return NetGraphMsgHandler_free(this_ptr_conv);
11012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
11013 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11014 LDKLogger logger_conv = *(LDKLogger*)logger;
11015 if (logger_conv.free == LDKLogger_JCalls_free) {
11016 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11017 LDKLogger_JCalls_clone(logger_conv.this_arg);
11019 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
11020 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
11024 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11025 LDKLogger logger_conv = *(LDKLogger*)logger;
11026 if (logger_conv.free == LDKLogger_JCalls_free) {
11027 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11028 LDKLogger_JCalls_clone(logger_conv.this_arg);
11030 LDKNetworkGraph network_graph_conv;
11031 network_graph_conv.inner = (void*)(network_graph & (~1));
11032 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
11033 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
11034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11038 LDKNetGraphMsgHandler this_arg_conv;
11039 this_arg_conv.inner = (void*)(this_arg & (~1));
11040 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11041 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
11042 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11046 LDKLockedNetworkGraph this_arg_conv;
11047 this_arg_conv.inner = (void*)(this_arg & (~1));
11048 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11049 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
11050 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
11054 LDKNetGraphMsgHandler this_arg_conv;
11055 this_arg_conv.inner = (void*)(this_arg & (~1));
11056 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11057 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11058 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11063 LDKDirectionalChannelInfo this_ptr_conv;
11064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11066 return DirectionalChannelInfo_free(this_ptr_conv);
11069 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11070 LDKDirectionalChannelInfo this_ptr_conv;
11071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11073 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
11076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11077 LDKDirectionalChannelInfo this_ptr_conv;
11078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11080 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
11083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
11084 LDKDirectionalChannelInfo this_ptr_conv;
11085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11087 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
11090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11091 LDKDirectionalChannelInfo this_ptr_conv;
11092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11094 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
11097 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11098 LDKDirectionalChannelInfo this_ptr_conv;
11099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11101 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
11104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11105 LDKDirectionalChannelInfo this_ptr_conv;
11106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11108 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
11111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11112 LDKDirectionalChannelInfo this_ptr_conv;
11113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11115 return DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
11118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11119 LDKDirectionalChannelInfo this_ptr_conv;
11120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11122 return DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
11125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11126 LDKDirectionalChannelInfo this_ptr_conv;
11127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11129 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
11130 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11134 LDKDirectionalChannelInfo this_ptr_conv;
11135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11137 LDKChannelUpdate val_conv;
11138 val_conv.inner = (void*)(val & (~1));
11139 val_conv.is_owned = (val & 1) || (val == 0);
11140 if (val_conv.inner != NULL)
11141 val_conv = ChannelUpdate_clone(&val_conv);
11142 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
11145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11146 LDKDirectionalChannelInfo obj_conv;
11147 obj_conv.inner = (void*)(obj & (~1));
11148 obj_conv.is_owned = (obj & 1) || (obj == 0);
11149 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11150 *ret = DirectionalChannelInfo_write(&obj_conv);
11154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11155 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11156 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
11157 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11161 LDKChannelInfo this_ptr_conv;
11162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11164 return ChannelInfo_free(this_ptr_conv);
11167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11168 LDKChannelInfo this_ptr_conv;
11169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11171 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
11172 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11176 LDKChannelInfo this_ptr_conv;
11177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11179 LDKChannelFeatures val_conv;
11180 val_conv.inner = (void*)(val & (~1));
11181 val_conv.is_owned = (val & 1) || (val == 0);
11182 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
11185 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11186 LDKChannelInfo this_ptr_conv;
11187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11189 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11190 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
11194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11195 LDKChannelInfo this_ptr_conv;
11196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11198 LDKPublicKey val_ref;
11199 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
11200 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11201 return ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
11204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11205 LDKChannelInfo this_ptr_conv;
11206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11208 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
11209 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11213 LDKChannelInfo this_ptr_conv;
11214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11216 LDKDirectionalChannelInfo val_conv;
11217 val_conv.inner = (void*)(val & (~1));
11218 val_conv.is_owned = (val & 1) || (val == 0);
11219 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11222 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11223 LDKChannelInfo this_ptr_conv;
11224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11225 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11226 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11227 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11232 LDKChannelInfo this_ptr_conv;
11233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11235 LDKPublicKey val_ref;
11236 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 33);
11237 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11238 return ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11242 LDKChannelInfo this_ptr_conv;
11243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11245 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11246 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11250 LDKChannelInfo this_ptr_conv;
11251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11253 LDKDirectionalChannelInfo val_conv;
11254 val_conv.inner = (void*)(val & (~1));
11255 val_conv.is_owned = (val & 1) || (val == 0);
11256 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11260 LDKChannelInfo this_ptr_conv;
11261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11263 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11264 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11268 LDKChannelInfo this_ptr_conv;
11269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11271 LDKChannelAnnouncement val_conv;
11272 val_conv.inner = (void*)(val & (~1));
11273 val_conv.is_owned = (val & 1) || (val == 0);
11274 if (val_conv.inner != NULL)
11275 val_conv = ChannelAnnouncement_clone(&val_conv);
11276 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11280 LDKChannelInfo obj_conv;
11281 obj_conv.inner = (void*)(obj & (~1));
11282 obj_conv.is_owned = (obj & 1) || (obj == 0);
11283 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11284 *ret = ChannelInfo_write(&obj_conv);
11288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11289 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11290 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
11291 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11295 LDKRoutingFees this_ptr_conv;
11296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11298 return RoutingFees_free(this_ptr_conv);
11301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11302 LDKRoutingFees orig_conv;
11303 orig_conv.inner = (void*)(orig & (~1));
11304 orig_conv.is_owned = (orig & 1) || (orig == 0);
11305 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11306 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11309 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11310 LDKRoutingFees this_ptr_conv;
11311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11313 return RoutingFees_get_base_msat(&this_ptr_conv);
11316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11317 LDKRoutingFees this_ptr_conv;
11318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11320 return RoutingFees_set_base_msat(&this_ptr_conv, val);
11323 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11324 LDKRoutingFees this_ptr_conv;
11325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11327 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
11330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11331 LDKRoutingFees this_ptr_conv;
11332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11334 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11338 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11339 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
11343 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11344 LDKRoutingFees ret = RoutingFees_read(ser_conv);
11345 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11349 LDKRoutingFees obj_conv;
11350 obj_conv.inner = (void*)(obj & (~1));
11351 obj_conv.is_owned = (obj & 1) || (obj == 0);
11352 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11353 *ret = RoutingFees_write(&obj_conv);
11357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11358 LDKNodeAnnouncementInfo this_ptr_conv;
11359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11361 return NodeAnnouncementInfo_free(this_ptr_conv);
11364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11365 LDKNodeAnnouncementInfo this_ptr_conv;
11366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11368 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11369 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11373 LDKNodeAnnouncementInfo this_ptr_conv;
11374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11375 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11376 LDKNodeFeatures val_conv;
11377 val_conv.inner = (void*)(val & (~1));
11378 val_conv.is_owned = (val & 1) || (val == 0);
11379 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11382 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11383 LDKNodeAnnouncementInfo this_ptr_conv;
11384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11386 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11390 LDKNodeAnnouncementInfo this_ptr_conv;
11391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11393 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11396 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11397 LDKNodeAnnouncementInfo this_ptr_conv;
11398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11399 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11400 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11401 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11406 LDKNodeAnnouncementInfo this_ptr_conv;
11407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11409 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
11411 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
11414 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11415 LDKNodeAnnouncementInfo this_ptr_conv;
11416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11418 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11419 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11424 LDKNodeAnnouncementInfo this_ptr_conv;
11425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11427 LDKThirtyTwoBytes val_ref;
11428 DO_ASSERT((*_env)->GetArrayLength (_env, val) == 32);
11429 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11430 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11434 LDKNodeAnnouncementInfo this_ptr_conv;
11435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11437 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11439 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11443 LDKNodeAnnouncementInfo this_ptr_conv;
11444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11446 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11447 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11451 LDKNodeAnnouncementInfo this_ptr_conv;
11452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11454 LDKNodeAnnouncement val_conv;
11455 val_conv.inner = (void*)(val & (~1));
11456 val_conv.is_owned = (val & 1) || (val == 0);
11457 if (val_conv.inner != NULL)
11458 val_conv = NodeAnnouncement_clone(&val_conv);
11459 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11462 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) {
11463 LDKNodeFeatures features_arg_conv;
11464 features_arg_conv.inner = (void*)(features_arg & (~1));
11465 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11466 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
11467 FREE((void*)rgb_arg);
11468 LDKThirtyTwoBytes alias_arg_ref;
11469 DO_ASSERT((*_env)->GetArrayLength (_env, alias_arg) == 32);
11470 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11471 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11472 FREE((void*)addresses_arg);
11473 LDKNodeAnnouncement announcement_message_arg_conv;
11474 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11475 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11476 if (announcement_message_arg_conv.inner != NULL)
11477 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11478 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11479 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11483 LDKNodeAnnouncementInfo obj_conv;
11484 obj_conv.inner = (void*)(obj & (~1));
11485 obj_conv.is_owned = (obj & 1) || (obj == 0);
11486 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11487 *ret = NodeAnnouncementInfo_write(&obj_conv);
11491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11492 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11493 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
11494 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11498 LDKNodeInfo this_ptr_conv;
11499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11501 return NodeInfo_free(this_ptr_conv);
11504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11505 LDKNodeInfo this_ptr_conv;
11506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11508 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11510 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
11513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11514 LDKNodeInfo this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11517 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11518 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11522 LDKNodeInfo this_ptr_conv;
11523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11525 LDKRoutingFees val_conv;
11526 val_conv.inner = (void*)(val & (~1));
11527 val_conv.is_owned = (val & 1) || (val == 0);
11528 if (val_conv.inner != NULL)
11529 val_conv = RoutingFees_clone(&val_conv);
11530 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
11533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
11534 LDKNodeInfo this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11537 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
11538 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11542 LDKNodeInfo this_ptr_conv;
11543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11545 LDKNodeAnnouncementInfo val_conv;
11546 val_conv.inner = (void*)(val & (~1));
11547 val_conv.is_owned = (val & 1) || (val == 0);
11548 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
11551 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) {
11552 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
11553 FREE((void*)channels_arg);
11554 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
11555 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
11556 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
11557 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
11558 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
11559 LDKNodeAnnouncementInfo announcement_info_arg_conv;
11560 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
11561 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
11562 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
11563 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11567 LDKNodeInfo obj_conv;
11568 obj_conv.inner = (void*)(obj & (~1));
11569 obj_conv.is_owned = (obj & 1) || (obj == 0);
11570 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11571 *ret = NodeInfo_write(&obj_conv);
11575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11576 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11577 LDKNodeInfo ret = NodeInfo_read(ser_conv);
11578 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
11582 LDKNetworkGraph obj_conv;
11583 obj_conv.inner = (void*)(obj & (~1));
11584 obj_conv.is_owned = (obj & 1) || (obj == 0);
11585 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11586 *ret = NetworkGraph_write(&obj_conv);
11590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
11591 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11592 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
11593 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
11597 LDKNetworkGraph ret = NetworkGraph_new();
11598 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11601 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) {
11602 LDKNetworkGraph this_arg_conv;
11603 this_arg_conv.inner = (void*)(this_arg & (~1));
11604 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11605 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);