1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Running a leak check across all the allocations and frees of the JDK is a mess,
10 // so instead we implement our own naive leak checker here, relying on the -wrap
11 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
12 // and free'd in Rust or C across the generated bindings shared library.
16 static mtx_t allocation_mtx;
18 void __attribute__((constructor)) init_mtx() {
19 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
23 typedef struct allocation {
24 struct allocation* next;
26 const char* struct_name;
30 static allocation* allocation_ll = NULL;
32 void* __real_malloc(size_t len);
33 void* __real_calloc(size_t nmemb, size_t len);
34 static void new_allocation(void* res, const char* struct_name) {
35 allocation* new_alloc = __real_malloc(sizeof(allocation));
37 new_alloc->struct_name = struct_name;
38 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
39 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
40 new_alloc->next = allocation_ll;
41 allocation_ll = new_alloc;
42 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
44 static void* MALLOC(size_t len, const char* struct_name) {
45 void* res = __real_malloc(len);
46 new_allocation(res, struct_name);
49 void __real_free(void* ptr);
50 static void alloc_freed(void* ptr) {
52 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
53 allocation* it = allocation_ll;
54 while (it->ptr != ptr) { p = it; it = it->next; }
55 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
56 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
57 DO_ASSERT(it->ptr == ptr);
60 static void FREE(void* ptr) {
65 void* __wrap_malloc(size_t len) {
66 void* res = __real_malloc(len);
67 new_allocation(res, "malloc call");
70 void* __wrap_calloc(size_t nmemb, size_t len) {
71 void* res = __real_calloc(nmemb, len);
72 new_allocation(res, "calloc call");
75 void __wrap_free(void* ptr) {
80 void* __real_realloc(void* ptr, size_t newlen);
81 void* __wrap_realloc(void* ptr, size_t len) {
83 void* res = __real_realloc(ptr, len);
84 new_allocation(res, "realloc call");
87 void __wrap_reallocarray(void* ptr, size_t new_sz) {
88 // Rust doesn't seem to use reallocarray currently
92 void __attribute__((destructor)) check_leaks() {
93 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
94 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
95 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
96 fprintf(stderr, "\n\n");
98 DO_ASSERT(allocation_ll == NULL);
101 static jmethodID ordinal_meth = NULL;
102 static jmethodID slicedef_meth = NULL;
103 static jclass slicedef_cls = NULL;
104 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
105 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
106 DO_ASSERT(ordinal_meth != NULL);
107 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
108 DO_ASSERT(slicedef_meth != NULL);
109 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
110 DO_ASSERT(slicedef_cls != NULL);
113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
114 return *((bool*)ptr);
116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
117 return *((long*)ptr);
119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
122 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
123 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
124 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
127 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
128 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
129 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
130 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
133 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
134 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
135 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
136 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
137 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
140 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
141 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
142 txdata->datalen = (*env)->GetArrayLength(env, bytes);
143 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
144 txdata->data_is_owned = true;
145 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
149 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
150 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
151 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
152 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
153 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
154 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
155 return (long)vec->datalen;
157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
158 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
159 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
160 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
161 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
162 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
163 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
169 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
170 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
171 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
172 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {
175 LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
178 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
179 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
180 case 0: return LDKAccessError_UnknownChain;
181 case 1: return LDKAccessError_UnknownTx;
185 static jclass LDKAccessError_class = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
187 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
189 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
190 DO_ASSERT(LDKAccessError_class != NULL);
191 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
192 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownChain != NULL);
193 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
194 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownTx != NULL);
196 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
198 case LDKAccessError_UnknownChain:
199 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
200 case LDKAccessError_UnknownTx:
201 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
206 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
207 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
208 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
209 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
213 static jclass LDKChannelMonitorUpdateErr_class = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
215 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
216 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
217 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
218 DO_ASSERT(LDKChannelMonitorUpdateErr_class != NULL);
219 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
220 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
221 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
222 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
224 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
226 case LDKChannelMonitorUpdateErr_TemporaryFailure:
227 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
228 case LDKChannelMonitorUpdateErr_PermanentFailure:
229 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
234 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
235 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
236 case 0: return LDKConfirmationTarget_Background;
237 case 1: return LDKConfirmationTarget_Normal;
238 case 2: return LDKConfirmationTarget_HighPriority;
242 static jclass LDKConfirmationTarget_class = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
245 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
247 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
248 DO_ASSERT(LDKConfirmationTarget_class != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
251 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
252 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
253 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
254 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
256 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
258 case LDKConfirmationTarget_Background:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
260 case LDKConfirmationTarget_Normal:
261 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
262 case LDKConfirmationTarget_HighPriority:
263 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
268 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
269 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
270 case 0: return LDKLevel_Off;
271 case 1: return LDKLevel_Error;
272 case 2: return LDKLevel_Warn;
273 case 3: return LDKLevel_Info;
274 case 4: return LDKLevel_Debug;
275 case 5: return LDKLevel_Trace;
279 static jclass LDKLevel_class = NULL;
280 static jfieldID LDKLevel_LDKLevel_Off = NULL;
281 static jfieldID LDKLevel_LDKLevel_Error = NULL;
282 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
283 static jfieldID LDKLevel_LDKLevel_Info = NULL;
284 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
285 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
287 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
288 DO_ASSERT(LDKLevel_class != NULL);
289 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
290 DO_ASSERT(LDKLevel_LDKLevel_Off != NULL);
291 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
292 DO_ASSERT(LDKLevel_LDKLevel_Error != NULL);
293 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
294 DO_ASSERT(LDKLevel_LDKLevel_Warn != NULL);
295 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
296 DO_ASSERT(LDKLevel_LDKLevel_Info != NULL);
297 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
298 DO_ASSERT(LDKLevel_LDKLevel_Debug != NULL);
299 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
300 DO_ASSERT(LDKLevel_LDKLevel_Trace != NULL);
302 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
313 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
315 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
320 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
321 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
322 case 0: return LDKNetwork_Bitcoin;
323 case 1: return LDKNetwork_Testnet;
324 case 2: return LDKNetwork_Regtest;
328 static jclass LDKNetwork_class = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
331 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
333 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
334 DO_ASSERT(LDKNetwork_class != NULL);
335 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
336 DO_ASSERT(LDKNetwork_LDKNetwork_Bitcoin != NULL);
337 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
338 DO_ASSERT(LDKNetwork_LDKNetwork_Testnet != NULL);
339 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
340 DO_ASSERT(LDKNetwork_LDKNetwork_Regtest != NULL);
342 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
344 case LDKNetwork_Bitcoin:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
346 case LDKNetwork_Testnet:
347 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
348 case LDKNetwork_Regtest:
349 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
355 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
356 case 0: return LDKSecp256k1Error_IncorrectSignature;
357 case 1: return LDKSecp256k1Error_InvalidMessage;
358 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359 case 3: return LDKSecp256k1Error_InvalidSignature;
360 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
362 case 6: return LDKSecp256k1Error_InvalidTweak;
363 case 7: return LDKSecp256k1Error_NotEnoughMemory;
364 case 8: return LDKSecp256k1Error_CallbackPanicked;
368 static jclass LDKSecp256k1Error_class = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
377 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
379 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
380 DO_ASSERT(LDKSecp256k1Error_class != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
400 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
402 case LDKSecp256k1Error_IncorrectSignature:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
404 case LDKSecp256k1Error_InvalidMessage:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
406 case LDKSecp256k1Error_InvalidPublicKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
408 case LDKSecp256k1Error_InvalidSignature:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
410 case LDKSecp256k1Error_InvalidSecretKey:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
412 case LDKSecp256k1Error_InvalidRecoveryId:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
414 case LDKSecp256k1Error_InvalidTweak:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
416 case LDKSecp256k1Error_NotEnoughMemory:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
418 case LDKSecp256k1Error_CallbackPanicked:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
425 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
429 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
430 ret->datalen = (*env)->GetArrayLength(env, elems);
431 if (ret->datalen == 0) {
434 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
435 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
436 for (size_t i = 0; i < ret->datalen; i++) {
437 ret->data[i] = java_elems[i];
439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
444 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
446 LDKTransaction b_conv = *(LDKTransaction*)b;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
452 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
455 if (((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok) {
456 return (long)((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->contents.result;
458 return (long)((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->contents.err;
461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
462 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
465 if (((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok) {
466 return (long)((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->contents.result;
468 return (long)((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->contents.err;
471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
472 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
474 a_conv.inner = (void*)(a & (~1));
475 a_conv.is_owned = (a & 1) || (a == 0);
477 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
482 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
483 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
484 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
487 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
488 ret->datalen = (*env)->GetArrayLength(env, elems);
489 if (ret->datalen == 0) {
492 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
493 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
494 for (size_t i = 0; i < ret->datalen; i++) {
495 jlong arr_elem = java_elems[i];
496 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
497 FREE((void*)arr_elem);
498 ret->data[i] = arr_elem_conv;
500 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
505 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
506 LDKThirtyTwoBytes a_ref;
507 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
509 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
515 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
520 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
521 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
522 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
525 LDKCVecTempl_Signature *ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
526 ret->datalen = (*env)->GetArrayLength(env, elems);
527 if (ret->datalen == 0) {
530 ret->data = MALLOC(sizeof(LDKSignature) * ret->datalen, "LDKCVecTempl_Signature Data");
531 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
532 for (size_t i = 0; i < ret->datalen; i++) {
533 jlong arr_elem = java_elems[i];
534 LDKSignature arr_elem_conv = *(LDKSignature*)arr_elem;
535 FREE((void*)arr_elem);
536 ret->data[i] = arr_elem_conv;
538 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
543 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
544 LDKSignature a_conv = *(LDKSignature*)a;
547 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
553 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
556 if (((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok) {
557 return (long)((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->contents.result;
559 return (long)((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->contents.err;
562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
563 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
566 if (((LDKCResult_SignatureNoneZ*)arg)->result_ok) {
567 return (long)((LDKCResult_SignatureNoneZ*)arg)->contents.result;
569 return (long)((LDKCResult_SignatureNoneZ*)arg)->contents.err;
572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
573 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
576 if (((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok) {
577 return (long)((LDKCResult_CVec_SignatureZNoneZ*)arg)->contents.result;
579 return (long)((LDKCResult_CVec_SignatureZNoneZ*)arg)->contents.err;
582 static jclass LDKAPIError_APIMisuseError_class = NULL;
583 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
584 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
585 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
586 static jclass LDKAPIError_RouteError_class = NULL;
587 static jmethodID LDKAPIError_RouteError_meth = NULL;
588 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
589 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
590 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
591 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
593 LDKAPIError_APIMisuseError_class =
594 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
595 DO_ASSERT(LDKAPIError_APIMisuseError_class != NULL);
596 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
597 DO_ASSERT(LDKAPIError_APIMisuseError_meth != NULL);
598 LDKAPIError_FeeRateTooHigh_class =
599 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
600 DO_ASSERT(LDKAPIError_FeeRateTooHigh_class != NULL);
601 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
602 DO_ASSERT(LDKAPIError_FeeRateTooHigh_meth != NULL);
603 LDKAPIError_RouteError_class =
604 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
605 DO_ASSERT(LDKAPIError_RouteError_class != NULL);
606 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
607 DO_ASSERT(LDKAPIError_RouteError_meth != NULL);
608 LDKAPIError_ChannelUnavailable_class =
609 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
610 DO_ASSERT(LDKAPIError_ChannelUnavailable_class != NULL);
611 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
612 DO_ASSERT(LDKAPIError_ChannelUnavailable_meth != NULL);
613 LDKAPIError_MonitorUpdateFailed_class =
614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
615 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_class != NULL);
616 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
617 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_meth != NULL);
619 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
620 LDKAPIError *obj = (LDKAPIError*)ptr;
622 case LDKAPIError_APIMisuseError: {
623 long err_ref = (long)&obj->api_misuse_error.err;
624 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
626 case LDKAPIError_FeeRateTooHigh: {
627 long err_ref = (long)&obj->fee_rate_too_high.err;
628 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
630 case LDKAPIError_RouteError: {
631 long err_ref = (long)&obj->route_error.err;
632 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
634 case LDKAPIError_ChannelUnavailable: {
635 long err_ref = (long)&obj->channel_unavailable.err;
636 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
638 case LDKAPIError_MonitorUpdateFailed: {
639 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
645 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
648 if (((LDKCResult_NoneAPIErrorZ*)arg)->result_ok) {
649 return (long)((LDKCResult_NoneAPIErrorZ*)arg)->contents.result;
651 return (long)((LDKCResult_NoneAPIErrorZ*)arg)->contents.err;
654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
655 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
658 if (((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok) {
659 return (long)((LDKCResult_NonePaymentSendFailureZ*)arg)->contents.result;
661 return (long)((LDKCResult_NonePaymentSendFailureZ*)arg)->contents.err;
664 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) {
665 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
666 LDKChannelAnnouncement a_conv;
667 a_conv.inner = (void*)(a & (~1));
668 a_conv.is_owned = (a & 1) || (a == 0);
670 LDKChannelUpdate b_conv;
671 b_conv.inner = (void*)(b & (~1));
672 b_conv.is_owned = (b & 1) || (b == 0);
674 LDKChannelUpdate c_conv;
675 c_conv.inner = (void*)(c & (~1));
676 c_conv.is_owned = (c & 1) || (c == 0);
680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
681 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
684 if (((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok) {
685 return (long)((LDKCResult_NonePeerHandleErrorZ*)arg)->contents.result;
687 return (long)((LDKCResult_NonePeerHandleErrorZ*)arg)->contents.err;
690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
691 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
692 LDKHTLCOutputInCommitment a_conv;
693 a_conv.inner = (void*)(a & (~1));
694 a_conv.is_owned = (a & 1) || (a == 0);
696 LDKSignature b_conv = *(LDKSignature*)b;
701 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
702 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
703 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
704 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
705 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
706 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
708 LDKSpendableOutputDescriptor_StaticOutput_class =
709 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
710 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
711 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
712 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
713 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
714 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
715 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
716 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(JJSJJJ)V");
717 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
718 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
719 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
720 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
721 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
722 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
724 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
725 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
727 case LDKSpendableOutputDescriptor_StaticOutput: {
728 LDKOutPoint outpoint_var = obj->static_output.outpoint;
729 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
730 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
732 if (outpoint_var.is_owned) {
733 outpoint_ref = (long)outpoint_var.inner | 1;
735 outpoint_ref = (long)&outpoint_var;
737 long output_ref = (long)&obj->static_output.output;
738 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
740 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
741 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
742 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
743 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
745 if (outpoint_var.is_owned) {
746 outpoint_ref = (long)outpoint_var.inner | 1;
748 outpoint_ref = (long)&outpoint_var;
750 long per_commitment_point_ref = (long)&obj->dynamic_output_p2wsh.per_commitment_point;
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 long revocation_pubkey_ref = (long)&obj->dynamic_output_p2wsh.revocation_pubkey;
754 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_ref, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_ref);
756 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
757 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
758 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
759 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
761 if (outpoint_var.is_owned) {
762 outpoint_ref = (long)outpoint_var.inner | 1;
764 outpoint_ref = (long)&outpoint_var;
766 long output_ref = (long)&obj->static_output_counterparty_payment.output;
767 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
768 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
773 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
774 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
775 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
778 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
779 ret->datalen = (*env)->GetArrayLength(env, elems);
780 if (ret->datalen == 0) {
783 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
784 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
785 for (size_t i = 0; i < ret->datalen; i++) {
786 jlong arr_elem = java_elems[i];
787 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
788 FREE((void*)arr_elem);
789 ret->data[i] = arr_elem_conv;
791 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
795 static jclass LDKEvent_FundingGenerationReady_class = NULL;
796 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
797 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
798 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
799 static jclass LDKEvent_PaymentReceived_class = NULL;
800 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
801 static jclass LDKEvent_PaymentSent_class = NULL;
802 static jmethodID LDKEvent_PaymentSent_meth = NULL;
803 static jclass LDKEvent_PaymentFailed_class = NULL;
804 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
805 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
806 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
807 static jclass LDKEvent_SpendableOutputs_class = NULL;
808 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
810 LDKEvent_FundingGenerationReady_class =
811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
812 DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL);
813 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
814 DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL);
815 LDKEvent_FundingBroadcastSafe_class =
816 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
817 DO_ASSERT(LDKEvent_FundingBroadcastSafe_class != NULL);
818 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
819 DO_ASSERT(LDKEvent_FundingBroadcastSafe_meth != NULL);
820 LDKEvent_PaymentReceived_class =
821 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
822 DO_ASSERT(LDKEvent_PaymentReceived_class != NULL);
823 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
824 DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL);
825 LDKEvent_PaymentSent_class =
826 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
827 DO_ASSERT(LDKEvent_PaymentSent_class != NULL);
828 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
829 DO_ASSERT(LDKEvent_PaymentSent_meth != NULL);
830 LDKEvent_PaymentFailed_class =
831 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
832 DO_ASSERT(LDKEvent_PaymentFailed_class != NULL);
833 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
834 DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL);
835 LDKEvent_PendingHTLCsForwardable_class =
836 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
837 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_class != NULL);
838 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
839 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_meth != NULL);
840 LDKEvent_SpendableOutputs_class =
841 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
842 DO_ASSERT(LDKEvent_SpendableOutputs_class != NULL);
843 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
844 DO_ASSERT(LDKEvent_SpendableOutputs_meth != NULL);
846 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
847 LDKEvent *obj = (LDKEvent*)ptr;
849 case LDKEvent_FundingGenerationReady: {
850 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
851 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
852 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
853 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);
855 case LDKEvent_FundingBroadcastSafe: {
856 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
857 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
858 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
859 long funding_txo_ref;
860 if (funding_txo_var.is_owned) {
861 funding_txo_ref = (long)funding_txo_var.inner | 1;
863 funding_txo_ref = (long)&funding_txo_var;
865 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
867 case LDKEvent_PaymentReceived: {
868 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
869 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
870 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
871 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
872 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
874 case LDKEvent_PaymentSent: {
875 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
876 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
877 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
879 case LDKEvent_PaymentFailed: {
880 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
881 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
882 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
884 case LDKEvent_PendingHTLCsForwardable: {
885 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
887 case LDKEvent_SpendableOutputs: {
888 long outputs_ref = (long)&obj->spendable_outputs.outputs;
889 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
894 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
895 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
896 static jclass LDKErrorAction_IgnoreError_class = NULL;
897 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
898 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
899 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
901 LDKErrorAction_DisconnectPeer_class =
902 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
903 DO_ASSERT(LDKErrorAction_DisconnectPeer_class != NULL);
904 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
905 DO_ASSERT(LDKErrorAction_DisconnectPeer_meth != NULL);
906 LDKErrorAction_IgnoreError_class =
907 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
908 DO_ASSERT(LDKErrorAction_IgnoreError_class != NULL);
909 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
910 DO_ASSERT(LDKErrorAction_IgnoreError_meth != NULL);
911 LDKErrorAction_SendErrorMessage_class =
912 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
913 DO_ASSERT(LDKErrorAction_SendErrorMessage_class != NULL);
914 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
915 DO_ASSERT(LDKErrorAction_SendErrorMessage_meth != NULL);
917 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
918 LDKErrorAction *obj = (LDKErrorAction*)ptr;
920 case LDKErrorAction_DisconnectPeer: {
921 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
922 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
923 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
925 if (msg_var.is_owned) {
926 msg_ref = (long)msg_var.inner | 1;
928 msg_ref = (long)&msg_var;
930 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
932 case LDKErrorAction_IgnoreError: {
933 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
935 case LDKErrorAction_SendErrorMessage: {
936 LDKErrorMessage msg_var = obj->send_error_message.msg;
937 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 if (msg_var.is_owned) {
941 msg_ref = (long)msg_var.inner | 1;
943 msg_ref = (long)&msg_var;
945 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
950 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
951 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
952 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
953 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
954 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
955 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
957 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
958 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
959 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
960 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
961 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
962 LDKHTLCFailChannelUpdate_ChannelClosed_class =
963 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
964 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
965 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
966 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
967 LDKHTLCFailChannelUpdate_NodeFailure_class =
968 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
969 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
970 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "(JZ)V");
971 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
973 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
974 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
976 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
977 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
978 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
979 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
981 if (msg_var.is_owned) {
982 msg_ref = (long)msg_var.inner | 1;
984 msg_ref = (long)&msg_var;
986 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
988 case LDKHTLCFailChannelUpdate_ChannelClosed: {
989 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
991 case LDKHTLCFailChannelUpdate_NodeFailure: {
992 long node_id_ref = (long)&obj->node_failure.node_id;
993 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_ref, obj->node_failure.is_permanent);
998 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
999 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1000 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1001 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1002 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1003 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1004 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1005 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1006 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1007 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1008 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1009 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1010 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1011 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1012 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1013 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1014 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1015 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1016 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1017 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1018 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1019 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1020 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1021 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1022 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1023 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1024 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1025 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1026 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1027 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1028 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1029 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1031 LDKMessageSendEvent_SendAcceptChannel_class =
1032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1033 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1034 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "(JJ)V");
1035 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1036 LDKMessageSendEvent_SendOpenChannel_class =
1037 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1038 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1039 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "(JJ)V");
1040 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1041 LDKMessageSendEvent_SendFundingCreated_class =
1042 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1043 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1044 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "(JJ)V");
1045 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1046 LDKMessageSendEvent_SendFundingSigned_class =
1047 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1048 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1049 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "(JJ)V");
1050 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1051 LDKMessageSendEvent_SendFundingLocked_class =
1052 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1053 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1054 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "(JJ)V");
1055 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1056 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1057 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1058 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1059 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "(JJ)V");
1060 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1061 LDKMessageSendEvent_UpdateHTLCs_class =
1062 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1063 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1064 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "(JJ)V");
1065 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1066 LDKMessageSendEvent_SendRevokeAndACK_class =
1067 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1068 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1069 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "(JJ)V");
1070 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1071 LDKMessageSendEvent_SendClosingSigned_class =
1072 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1073 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1074 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "(JJ)V");
1075 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1076 LDKMessageSendEvent_SendShutdown_class =
1077 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1078 DO_ASSERT(LDKMessageSendEvent_SendShutdown_class != NULL);
1079 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "(JJ)V");
1080 DO_ASSERT(LDKMessageSendEvent_SendShutdown_meth != NULL);
1081 LDKMessageSendEvent_SendChannelReestablish_class =
1082 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1083 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1084 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "(JJ)V");
1085 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1086 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1087 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1088 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1089 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1090 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1091 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1092 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1093 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1094 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1095 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1096 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1097 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1098 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1099 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1100 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1101 LDKMessageSendEvent_HandleError_class =
1102 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1103 DO_ASSERT(LDKMessageSendEvent_HandleError_class != NULL);
1104 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "(JJ)V");
1105 DO_ASSERT(LDKMessageSendEvent_HandleError_meth != NULL);
1106 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1107 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1108 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1109 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1110 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1112 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1113 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1115 case LDKMessageSendEvent_SendAcceptChannel: {
1116 long node_id_ref = (long)&obj->send_accept_channel.node_id;
1117 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1118 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1119 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1121 if (msg_var.is_owned) {
1122 msg_ref = (long)msg_var.inner | 1;
1124 msg_ref = (long)&msg_var;
1126 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_ref, msg_ref);
1128 case LDKMessageSendEvent_SendOpenChannel: {
1129 long node_id_ref = (long)&obj->send_open_channel.node_id;
1130 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1131 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1132 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 if (msg_var.is_owned) {
1135 msg_ref = (long)msg_var.inner | 1;
1137 msg_ref = (long)&msg_var;
1139 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_ref, msg_ref);
1141 case LDKMessageSendEvent_SendFundingCreated: {
1142 long node_id_ref = (long)&obj->send_funding_created.node_id;
1143 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1144 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1145 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1147 if (msg_var.is_owned) {
1148 msg_ref = (long)msg_var.inner | 1;
1150 msg_ref = (long)&msg_var;
1152 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_ref, msg_ref);
1154 case LDKMessageSendEvent_SendFundingSigned: {
1155 long node_id_ref = (long)&obj->send_funding_signed.node_id;
1156 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1157 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1158 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1160 if (msg_var.is_owned) {
1161 msg_ref = (long)msg_var.inner | 1;
1163 msg_ref = (long)&msg_var;
1165 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_ref, msg_ref);
1167 case LDKMessageSendEvent_SendFundingLocked: {
1168 long node_id_ref = (long)&obj->send_funding_locked.node_id;
1169 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1170 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1171 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1173 if (msg_var.is_owned) {
1174 msg_ref = (long)msg_var.inner | 1;
1176 msg_ref = (long)&msg_var;
1178 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_ref, msg_ref);
1180 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1181 long node_id_ref = (long)&obj->send_announcement_signatures.node_id;
1182 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1183 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1184 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1186 if (msg_var.is_owned) {
1187 msg_ref = (long)msg_var.inner | 1;
1189 msg_ref = (long)&msg_var;
1191 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_ref, msg_ref);
1193 case LDKMessageSendEvent_UpdateHTLCs: {
1194 long node_id_ref = (long)&obj->update_htl_cs.node_id;
1195 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1196 DO_ASSERT((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1197 DO_ASSERT((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1199 if (updates_var.is_owned) {
1200 updates_ref = (long)updates_var.inner | 1;
1202 updates_ref = (long)&updates_var;
1204 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_ref, updates_ref);
1206 case LDKMessageSendEvent_SendRevokeAndACK: {
1207 long node_id_ref = (long)&obj->send_revoke_and_ack.node_id;
1208 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1209 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1210 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1212 if (msg_var.is_owned) {
1213 msg_ref = (long)msg_var.inner | 1;
1215 msg_ref = (long)&msg_var;
1217 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_ref, msg_ref);
1219 case LDKMessageSendEvent_SendClosingSigned: {
1220 long node_id_ref = (long)&obj->send_closing_signed.node_id;
1221 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1222 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 if (msg_var.is_owned) {
1226 msg_ref = (long)msg_var.inner | 1;
1228 msg_ref = (long)&msg_var;
1230 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_ref, msg_ref);
1232 case LDKMessageSendEvent_SendShutdown: {
1233 long node_id_ref = (long)&obj->send_shutdown.node_id;
1234 LDKShutdown msg_var = obj->send_shutdown.msg;
1235 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1236 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1238 if (msg_var.is_owned) {
1239 msg_ref = (long)msg_var.inner | 1;
1241 msg_ref = (long)&msg_var;
1243 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_ref, msg_ref);
1245 case LDKMessageSendEvent_SendChannelReestablish: {
1246 long node_id_ref = (long)&obj->send_channel_reestablish.node_id;
1247 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1248 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1249 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1251 if (msg_var.is_owned) {
1252 msg_ref = (long)msg_var.inner | 1;
1254 msg_ref = (long)&msg_var;
1256 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_ref, msg_ref);
1258 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1259 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1260 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1261 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 if (msg_var.is_owned) {
1264 msg_ref = (long)msg_var.inner | 1;
1266 msg_ref = (long)&msg_var;
1268 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1269 DO_ASSERT((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1270 DO_ASSERT((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1271 long update_msg_ref;
1272 if (update_msg_var.is_owned) {
1273 update_msg_ref = (long)update_msg_var.inner | 1;
1275 update_msg_ref = (long)&update_msg_var;
1277 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1279 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1280 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1281 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1282 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1284 if (msg_var.is_owned) {
1285 msg_ref = (long)msg_var.inner | 1;
1287 msg_ref = (long)&msg_var;
1289 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1291 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1292 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1293 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1294 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1296 if (msg_var.is_owned) {
1297 msg_ref = (long)msg_var.inner | 1;
1299 msg_ref = (long)&msg_var;
1301 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1303 case LDKMessageSendEvent_HandleError: {
1304 long node_id_ref = (long)&obj->handle_error.node_id;
1305 long action_ref = (long)&obj->handle_error.action;
1306 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_ref, action_ref);
1308 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1309 long update_ref = (long)&obj->payment_failure_network_update.update;
1310 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1315 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1316 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1317 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1320 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1321 ret->datalen = (*env)->GetArrayLength(env, elems);
1322 if (ret->datalen == 0) {
1325 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1326 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1327 for (size_t i = 0; i < ret->datalen; i++) {
1328 jlong arr_elem = java_elems[i];
1329 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1330 FREE((void*)arr_elem);
1331 ret->data[i] = arr_elem_conv;
1333 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1337 typedef struct LDKMessageSendEventsProvider_JCalls {
1338 atomic_size_t refcnt;
1341 jmethodID get_and_clear_pending_msg_events_meth;
1342 } LDKMessageSendEventsProvider_JCalls;
1343 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1344 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1346 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1347 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_msg_events_meth);
1348 LDKCVec_MessageSendEventZ res = *ret;
1352 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1353 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1354 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1356 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1357 (*env)->DeleteGlobalRef(env, j_calls->o);
1361 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1362 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1363 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1364 return (void*) this_arg;
1366 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1367 jclass c = (*env)->GetObjectClass(env, o);
1368 DO_ASSERT(c != NULL);
1369 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1370 atomic_init(&calls->refcnt, 1);
1371 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1372 calls->o = (*env)->NewGlobalRef(env, o);
1373 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1374 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1376 LDKMessageSendEventsProvider ret = {
1377 .this_arg = (void*) calls,
1378 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1379 .free = LDKMessageSendEventsProvider_JCalls_free,
1383 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1384 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1385 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1386 return (long)res_ptr;
1388 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1389 return ((LDKMessageSendEventsProvider_JCalls*)val)->o;
1391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) {
1392 LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg;
1393 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1394 *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg);
1398 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1399 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1400 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1403 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1404 ret->datalen = (*env)->GetArrayLength(env, elems);
1405 if (ret->datalen == 0) {
1408 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1409 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1410 for (size_t i = 0; i < ret->datalen; i++) {
1411 jlong arr_elem = java_elems[i];
1412 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1413 FREE((void*)arr_elem);
1414 ret->data[i] = arr_elem_conv;
1416 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1420 typedef struct LDKEventsProvider_JCalls {
1421 atomic_size_t refcnt;
1424 jmethodID get_and_clear_pending_events_meth;
1425 } LDKEventsProvider_JCalls;
1426 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1427 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1429 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1430 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_events_meth);
1431 LDKCVec_EventZ res = *ret;
1435 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1436 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1439 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1440 (*env)->DeleteGlobalRef(env, j_calls->o);
1444 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1445 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1446 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1447 return (void*) this_arg;
1449 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1450 jclass c = (*env)->GetObjectClass(env, o);
1451 DO_ASSERT(c != NULL);
1452 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1453 atomic_init(&calls->refcnt, 1);
1454 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1455 calls->o = (*env)->NewGlobalRef(env, o);
1456 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1457 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1459 LDKEventsProvider ret = {
1460 .this_arg = (void*) calls,
1461 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1462 .free = LDKEventsProvider_JCalls_free,
1466 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1467 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1468 *res_ptr = LDKEventsProvider_init(env, _a, o);
1469 return (long)res_ptr;
1471 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1472 return ((LDKEventsProvider_JCalls*)val)->o;
1474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) {
1475 LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg;
1476 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1477 *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg);
1481 typedef struct LDKLogger_JCalls {
1482 atomic_size_t refcnt;
1487 void log_jcall(const void* this_arg, const char *record) {
1488 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1491 jstring record_conv = (*env)->NewStringUTF(env, record);
1492 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->log_meth, record_conv);
1494 static void LDKLogger_JCalls_free(void* this_arg) {
1495 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1496 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1498 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1499 (*env)->DeleteGlobalRef(env, j_calls->o);
1503 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1504 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1505 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1506 return (void*) this_arg;
1508 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1509 jclass c = (*env)->GetObjectClass(env, o);
1510 DO_ASSERT(c != NULL);
1511 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1512 atomic_init(&calls->refcnt, 1);
1513 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1514 calls->o = (*env)->NewGlobalRef(env, o);
1515 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1516 DO_ASSERT(calls->log_meth != NULL);
1519 .this_arg = (void*) calls,
1521 .free = LDKLogger_JCalls_free,
1525 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1526 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1527 *res_ptr = LDKLogger_init(env, _a, o);
1528 return (long)res_ptr;
1530 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1531 return ((LDKLogger_JCalls*)val)->o;
1533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1534 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1537 if (((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok) {
1538 return (long)((LDKCResult_TxOutAccessErrorZ*)arg)->contents.result;
1540 return (long)((LDKCResult_TxOutAccessErrorZ*)arg)->contents.err;
1543 typedef struct LDKAccess_JCalls {
1544 atomic_size_t refcnt;
1547 jmethodID get_utxo_meth;
1549 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1550 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1552 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1553 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1554 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1555 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1556 LDKCResult_TxOutAccessErrorZ res = *ret;
1560 static void LDKAccess_JCalls_free(void* this_arg) {
1561 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1562 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1564 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1565 (*env)->DeleteGlobalRef(env, j_calls->o);
1569 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1570 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1571 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1572 return (void*) this_arg;
1574 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1575 jclass c = (*env)->GetObjectClass(env, o);
1576 DO_ASSERT(c != NULL);
1577 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1578 atomic_init(&calls->refcnt, 1);
1579 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1580 calls->o = (*env)->NewGlobalRef(env, o);
1581 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1582 DO_ASSERT(calls->get_utxo_meth != NULL);
1585 .this_arg = (void*) calls,
1586 .get_utxo = get_utxo_jcall,
1587 .free = LDKAccess_JCalls_free,
1591 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1592 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1593 *res_ptr = LDKAccess_init(env, _a, o);
1594 return (long)res_ptr;
1596 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1597 return ((LDKAccess_JCalls*)val)->o;
1599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong arg, jbyteArray genesis_hash, jlong short_channel_id) {
1600 LDKAccess* arg_conv = (LDKAccess*)arg;
1601 unsigned char genesis_hash_arr[32];
1602 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1603 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1604 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1605 *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1609 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1610 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1611 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1612 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1613 for (size_t i = 0; i < vec->datalen; i++) {
1614 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1615 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1617 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1621 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1622 ret->datalen = (*env)->GetArrayLength(env, elems);
1623 if (ret->datalen == 0) {
1626 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1627 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1628 for (size_t i = 0; i < ret->datalen; i++) {
1629 jlong arr_elem = java_elems[i];
1630 LDKHTLCOutputInCommitment arr_elem_conv;
1631 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1632 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1633 ret->data[i] = arr_elem_conv;
1635 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1639 typedef struct LDKChannelKeys_JCalls {
1640 atomic_size_t refcnt;
1643 jmethodID get_per_commitment_point_meth;
1644 jmethodID release_commitment_secret_meth;
1645 jmethodID key_derivation_params_meth;
1646 jmethodID sign_counterparty_commitment_meth;
1647 jmethodID sign_holder_commitment_meth;
1648 jmethodID sign_holder_commitment_htlc_transactions_meth;
1649 jmethodID sign_justice_transaction_meth;
1650 jmethodID sign_counterparty_htlc_transaction_meth;
1651 jmethodID sign_closing_transaction_meth;
1652 jmethodID sign_channel_announcement_meth;
1653 jmethodID on_accept_meth;
1654 } LDKChannelKeys_JCalls;
1655 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1656 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1658 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1659 LDKPublicKey* ret = (LDKPublicKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_per_commitment_point_meth, idx);
1660 LDKPublicKey res = *ret;
1664 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1665 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1667 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1668 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->release_commitment_secret_meth, idx);
1669 LDKThirtyTwoBytes ret;
1670 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1673 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1674 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1676 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1677 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->key_derivation_params_meth);
1678 LDKC2Tuple_u64u64Z res = *ret;
1682 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) {
1683 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1685 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1686 long commitment_tx_ref = (long)&commitment_tx;
1687 long htlcs_ref = (long)&htlcs;
1688 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
1689 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1693 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1694 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1696 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1697 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1698 LDKCResult_SignatureNoneZ res = *ret;
1702 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1703 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1705 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1706 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1707 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1711 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) {
1712 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1714 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1715 long justice_tx_ref = (long)&justice_tx;
1716 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1717 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1718 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1719 LDKCResult_SignatureNoneZ res = *ret;
1723 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) {
1724 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1726 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1727 long htlc_tx_ref = (long)&htlc_tx;
1728 long per_commitment_point_ref = (long)&per_commitment_point;
1729 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_ref, htlc);
1730 LDKCResult_SignatureNoneZ res = *ret;
1734 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1735 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1737 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1738 long closing_tx_ref = (long)&closing_tx;
1739 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1740 LDKCResult_SignatureNoneZ res = *ret;
1744 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1745 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1747 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1748 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_channel_announcement_meth, msg);
1749 LDKCResult_SignatureNoneZ res = *ret;
1753 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1754 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1756 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1757 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1759 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1760 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1761 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1763 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1764 (*env)->DeleteGlobalRef(env, j_calls->o);
1768 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1769 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1770 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1771 return (void*) this_arg;
1773 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1774 jclass c = (*env)->GetObjectClass(env, o);
1775 DO_ASSERT(c != NULL);
1776 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1777 atomic_init(&calls->refcnt, 1);
1778 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1779 calls->o = (*env)->NewGlobalRef(env, o);
1780 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)J");
1781 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1782 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1783 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1784 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1785 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1786 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1787 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1788 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1789 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1790 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1791 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1792 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1793 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1794 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJJJ)J");
1795 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1796 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1797 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1798 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1799 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1800 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1801 DO_ASSERT(calls->on_accept_meth != NULL);
1803 LDKChannelKeys ret = {
1804 .this_arg = (void*) calls,
1805 .get_per_commitment_point = get_per_commitment_point_jcall,
1806 .release_commitment_secret = release_commitment_secret_jcall,
1807 .key_derivation_params = key_derivation_params_jcall,
1808 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1809 .sign_holder_commitment = sign_holder_commitment_jcall,
1810 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1811 .sign_justice_transaction = sign_justice_transaction_jcall,
1812 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1813 .sign_closing_transaction = sign_closing_transaction_jcall,
1814 .sign_channel_announcement = sign_channel_announcement_jcall,
1815 .on_accept = on_accept_jcall,
1816 .clone = LDKChannelKeys_JCalls_clone,
1817 .free = LDKChannelKeys_JCalls_free,
1821 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1822 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1823 *res_ptr = LDKChannelKeys_init(env, _a, o);
1824 return (long)res_ptr;
1826 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1827 return ((LDKChannelKeys_JCalls*)val)->o;
1829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1830 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1831 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
1832 *ret = (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx);
1836 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1837 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1838 jbyteArray _arr = (*_env)->NewByteArray(_env, 32);
1839 (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data);
1843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) {
1844 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1845 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1846 *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg);
1850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1851 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1852 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1853 FREE((void*)commitment_tx);
1854 LDKPreCalculatedTxCreationKeys keys_conv;
1855 keys_conv.inner = (void*)(keys & (~1));
1856 keys_conv.is_owned = (keys & 1) || (keys == 0);
1857 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1859 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1860 *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1865 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1866 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1867 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1868 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1869 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1870 *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, &holder_commitment_tx_conv);
1874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1875 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1876 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1877 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1878 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1879 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1880 *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, &holder_commitment_tx_conv);
1884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1885 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1886 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1887 FREE((void*)justice_tx);
1888 unsigned char per_commitment_key_arr[32];
1889 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1890 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1891 LDKHTLCOutputInCommitment htlc_conv;
1892 htlc_conv.inner = (void*)(htlc & (~1));
1893 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1894 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1895 *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong htlc_tx, jlong input, jlong amount, jlong per_commitment_point, jlong htlc) {
1900 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1901 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1902 FREE((void*)htlc_tx);
1903 LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
1904 FREE((void*)per_commitment_point);
1905 LDKHTLCOutputInCommitment htlc_conv;
1906 htlc_conv.inner = (void*)(htlc & (~1));
1907 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1908 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1909 *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_conv, &htlc_conv);
1913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) {
1914 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1915 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1916 FREE((void*)closing_tx);
1917 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1918 *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv);
1922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
1923 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1924 LDKUnsignedChannelAnnouncement msg_conv;
1925 msg_conv.inner = (void*)(msg & (~1));
1926 msg_conv.is_owned = (msg & 1) || (msg == 0);
1927 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1928 *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, &msg_conv);
1932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
1933 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1934 LDKChannelPublicKeys channel_points_conv;
1935 channel_points_conv.inner = (void*)(channel_points & (~1));
1936 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
1937 return (arg_conv->on_accept)(arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
1940 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1941 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
1942 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1943 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1944 for (size_t i = 0; i < vec->datalen; i++) {
1945 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1946 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1948 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1952 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
1953 ret->datalen = (*env)->GetArrayLength(env, elems);
1954 if (ret->datalen == 0) {
1957 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
1958 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1959 for (size_t i = 0; i < ret->datalen; i++) {
1960 jlong arr_elem = java_elems[i];
1961 LDKMonitorEvent arr_elem_conv;
1962 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1963 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1964 ret->data[i] = arr_elem_conv;
1966 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1970 typedef struct LDKWatch_JCalls {
1971 atomic_size_t refcnt;
1974 jmethodID watch_channel_meth;
1975 jmethodID update_channel_meth;
1976 jmethodID release_pending_monitor_events_meth;
1978 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
1979 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1981 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1982 LDKOutPoint funding_txo_var = funding_txo;
1983 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1984 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1985 long funding_txo_ref;
1986 if (funding_txo_var.is_owned) {
1987 funding_txo_ref = (long)funding_txo_var.inner | 1;
1989 funding_txo_ref = (long)&funding_txo_var;
1991 LDKChannelMonitor monitor_var = monitor;
1992 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1993 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1995 if (monitor_var.is_owned) {
1996 monitor_ref = (long)monitor_var.inner | 1;
1998 monitor_ref = (long)&monitor_var;
2000 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2001 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2005 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2006 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2008 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2009 LDKOutPoint funding_txo_var = funding_txo;
2010 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2011 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2012 long funding_txo_ref;
2013 if (funding_txo_var.is_owned) {
2014 funding_txo_ref = (long)funding_txo_var.inner | 1;
2016 funding_txo_ref = (long)&funding_txo_var;
2018 LDKChannelMonitorUpdate update_var = update;
2019 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2020 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2022 if (update_var.is_owned) {
2023 update_ref = (long)update_var.inner | 1;
2025 update_ref = (long)&update_var;
2027 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2028 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2032 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2033 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2035 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2036 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->release_pending_monitor_events_meth);
2037 LDKCVec_MonitorEventZ res = *ret;
2041 static void LDKWatch_JCalls_free(void* this_arg) {
2042 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2043 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2045 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2046 (*env)->DeleteGlobalRef(env, j_calls->o);
2050 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2051 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2052 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2053 return (void*) this_arg;
2055 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2056 jclass c = (*env)->GetObjectClass(env, o);
2057 DO_ASSERT(c != NULL);
2058 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2059 atomic_init(&calls->refcnt, 1);
2060 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2061 calls->o = (*env)->NewGlobalRef(env, o);
2062 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2063 DO_ASSERT(calls->watch_channel_meth != NULL);
2064 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2065 DO_ASSERT(calls->update_channel_meth != NULL);
2066 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2067 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2070 .this_arg = (void*) calls,
2071 .watch_channel = watch_channel_jcall,
2072 .update_channel = update_channel_jcall,
2073 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2074 .free = LDKWatch_JCalls_free,
2078 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2079 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2080 *res_ptr = LDKWatch_init(env, _a, o);
2081 return (long)res_ptr;
2083 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2084 return ((LDKWatch_JCalls*)val)->o;
2086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) {
2087 LDKWatch* arg_conv = (LDKWatch*)arg;
2088 LDKOutPoint funding_txo_conv;
2089 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2090 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2091 LDKChannelMonitor monitor_conv;
2092 monitor_conv.inner = (void*)(monitor & (~1));
2093 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2094 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2095 *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv);
2099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) {
2100 LDKWatch* arg_conv = (LDKWatch*)arg;
2101 LDKOutPoint funding_txo_conv;
2102 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2103 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2104 LDKChannelMonitorUpdate update_conv;
2105 update_conv.inner = (void*)(update & (~1));
2106 update_conv.is_owned = (update & 1) || (update == 0);
2107 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2108 *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv);
2112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) {
2113 LDKWatch* arg_conv = (LDKWatch*)arg;
2114 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2115 *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg);
2119 typedef struct LDKFilter_JCalls {
2120 atomic_size_t refcnt;
2123 jmethodID register_tx_meth;
2124 jmethodID register_output_meth;
2126 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2127 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2129 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2130 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2131 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2132 long script_pubkey_ref = (long)&script_pubkey;
2133 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2135 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2136 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2138 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2139 long script_pubkey_ref = (long)&script_pubkey;
2140 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2142 static void LDKFilter_JCalls_free(void* this_arg) {
2143 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2144 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2146 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2147 (*env)->DeleteGlobalRef(env, j_calls->o);
2151 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2152 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2153 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2154 return (void*) this_arg;
2156 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2157 jclass c = (*env)->GetObjectClass(env, o);
2158 DO_ASSERT(c != NULL);
2159 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2160 atomic_init(&calls->refcnt, 1);
2161 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2162 calls->o = (*env)->NewGlobalRef(env, o);
2163 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2164 DO_ASSERT(calls->register_tx_meth != NULL);
2165 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2166 DO_ASSERT(calls->register_output_meth != NULL);
2169 .this_arg = (void*) calls,
2170 .register_tx = register_tx_jcall,
2171 .register_output = register_output_jcall,
2172 .free = LDKFilter_JCalls_free,
2176 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2177 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2178 *res_ptr = LDKFilter_init(env, _a, o);
2179 return (long)res_ptr;
2181 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2182 return ((LDKFilter_JCalls*)val)->o;
2184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) {
2185 LDKFilter* arg_conv = (LDKFilter*)arg;
2186 unsigned char txid_arr[32];
2187 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2188 unsigned char (*txid_ref)[32] = &txid_arr;
2189 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2190 return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv);
2193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) {
2194 LDKFilter* arg_conv = (LDKFilter*)arg;
2195 LDKOutPoint outpoint_conv;
2196 outpoint_conv.inner = (void*)(outpoint & (~1));
2197 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2198 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2199 return (arg_conv->register_output)(arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2202 typedef struct LDKBroadcasterInterface_JCalls {
2203 atomic_size_t refcnt;
2206 jmethodID broadcast_transaction_meth;
2207 } LDKBroadcasterInterface_JCalls;
2208 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2209 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2211 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2212 long tx_ref = (long)&tx;
2213 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->broadcast_transaction_meth, tx_ref);
2215 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2216 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2217 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2219 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2220 (*env)->DeleteGlobalRef(env, j_calls->o);
2224 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2225 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2226 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2227 return (void*) this_arg;
2229 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2230 jclass c = (*env)->GetObjectClass(env, o);
2231 DO_ASSERT(c != NULL);
2232 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2233 atomic_init(&calls->refcnt, 1);
2234 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2235 calls->o = (*env)->NewGlobalRef(env, o);
2236 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2237 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2239 LDKBroadcasterInterface ret = {
2240 .this_arg = (void*) calls,
2241 .broadcast_transaction = broadcast_transaction_jcall,
2242 .free = LDKBroadcasterInterface_JCalls_free,
2246 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2247 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2248 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2249 return (long)res_ptr;
2251 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2252 return ((LDKBroadcasterInterface_JCalls*)val)->o;
2254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) {
2255 LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg;
2256 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2258 return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv);
2261 typedef struct LDKFeeEstimator_JCalls {
2262 atomic_size_t refcnt;
2265 jmethodID get_est_sat_per_1000_weight_meth;
2266 } LDKFeeEstimator_JCalls;
2267 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2268 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2270 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2271 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2272 return (*env)->CallIntMethod(env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2274 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2275 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2276 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2278 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2279 (*env)->DeleteGlobalRef(env, j_calls->o);
2283 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2284 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2285 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2286 return (void*) this_arg;
2288 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2289 jclass c = (*env)->GetObjectClass(env, o);
2290 DO_ASSERT(c != NULL);
2291 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2292 atomic_init(&calls->refcnt, 1);
2293 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2294 calls->o = (*env)->NewGlobalRef(env, o);
2295 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2296 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2298 LDKFeeEstimator ret = {
2299 .this_arg = (void*) calls,
2300 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2301 .free = LDKFeeEstimator_JCalls_free,
2305 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2306 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2307 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2308 return (long)res_ptr;
2310 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2311 return ((LDKFeeEstimator_JCalls*)val)->o;
2313 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong arg, jclass confirmation_target) {
2314 LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg;
2315 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2316 return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv);
2319 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2320 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2321 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2324 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2325 ret->datalen = (*env)->GetArrayLength(env, elems);
2326 if (ret->datalen == 0) {
2329 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2330 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2331 for (size_t i = 0; i < ret->datalen; i++) {
2332 jlong arr_elem = java_elems[i];
2333 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2334 FREE((void*)arr_elem);
2335 ret->data[i] = arr_elem_conv;
2337 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2341 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2342 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2343 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2346 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2347 ret->datalen = (*env)->GetArrayLength(env, elems);
2348 if (ret->datalen == 0) {
2351 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2352 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2353 for (size_t i = 0; i < ret->datalen; i++) {
2354 jlong arr_elem = java_elems[i];
2355 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2356 FREE((void*)arr_elem);
2357 ret->data[i] = arr_elem_conv;
2359 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2363 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2364 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2365 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2368 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2369 ret->datalen = (*env)->GetArrayLength(env, elems);
2370 if (ret->datalen == 0) {
2373 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2374 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2375 for (size_t i = 0; i < ret->datalen; i++) {
2376 jlong arr_elem = java_elems[i];
2377 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2378 FREE((void*)arr_elem);
2379 ret->data[i] = arr_elem_conv;
2381 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2385 typedef struct LDKKeysInterface_JCalls {
2386 atomic_size_t refcnt;
2389 jmethodID get_node_secret_meth;
2390 jmethodID get_destination_script_meth;
2391 jmethodID get_shutdown_pubkey_meth;
2392 jmethodID get_channel_keys_meth;
2393 jmethodID get_secure_random_bytes_meth;
2394 } LDKKeysInterface_JCalls;
2395 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2396 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2398 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2399 LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_node_secret_meth);
2400 LDKSecretKey res = *ret;
2404 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2405 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2407 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2408 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_destination_script_meth);
2409 LDKCVec_u8Z res = *ret;
2413 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2414 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2416 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2417 LDKPublicKey* ret = (LDKPublicKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_shutdown_pubkey_meth);
2418 LDKPublicKey res = *ret;
2422 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2423 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2425 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2426 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2427 LDKChannelKeys res = *ret;
2431 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2432 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2434 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2435 jbyteArray jret = (*env)->CallObjectMethod(env, j_calls->o, j_calls->get_secure_random_bytes_meth);
2436 LDKThirtyTwoBytes ret;
2437 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2440 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2441 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2442 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2444 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2445 (*env)->DeleteGlobalRef(env, j_calls->o);
2449 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2450 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2451 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2452 return (void*) this_arg;
2454 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2455 jclass c = (*env)->GetObjectClass(env, o);
2456 DO_ASSERT(c != NULL);
2457 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2458 atomic_init(&calls->refcnt, 1);
2459 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2460 calls->o = (*env)->NewGlobalRef(env, o);
2461 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
2462 DO_ASSERT(calls->get_node_secret_meth != NULL);
2463 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2464 DO_ASSERT(calls->get_destination_script_meth != NULL);
2465 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()J");
2466 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2467 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2468 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2469 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2470 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2472 LDKKeysInterface ret = {
2473 .this_arg = (void*) calls,
2474 .get_node_secret = get_node_secret_jcall,
2475 .get_destination_script = get_destination_script_jcall,
2476 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2477 .get_channel_keys = get_channel_keys_jcall,
2478 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2479 .free = LDKKeysInterface_JCalls_free,
2483 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2484 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2485 *res_ptr = LDKKeysInterface_init(env, _a, o);
2486 return (long)res_ptr;
2488 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2489 return ((LDKKeysInterface_JCalls*)val)->o;
2491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) {
2492 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2493 LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
2494 *ret = (arg_conv->get_node_secret)(arg_conv->this_arg);
2498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) {
2499 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2500 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2501 *ret = (arg_conv->get_destination_script)(arg_conv->this_arg);
2505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) {
2506 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2507 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
2508 *ret = (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg);
2512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong arg, jboolean inbound, jlong channel_value_satoshis) {
2513 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2514 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2515 *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis);
2519 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) {
2520 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2521 jbyteArray _arr = (*_env)->NewByteArray(_env, 32);
2522 (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data);
2526 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2527 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2528 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2529 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2530 for (size_t i = 0; i < vec->datalen; i++) {
2531 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2532 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2534 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2538 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2539 ret->datalen = (*env)->GetArrayLength(env, elems);
2540 if (ret->datalen == 0) {
2543 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2544 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2545 for (size_t i = 0; i < ret->datalen; i++) {
2546 jlong arr_elem = java_elems[i];
2547 LDKChannelDetails arr_elem_conv;
2548 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2549 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2550 ret->data[i] = arr_elem_conv;
2552 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2556 static jclass LDKNetAddress_IPv4_class = NULL;
2557 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2558 static jclass LDKNetAddress_IPv6_class = NULL;
2559 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2560 static jclass LDKNetAddress_OnionV2_class = NULL;
2561 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2562 static jclass LDKNetAddress_OnionV3_class = NULL;
2563 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2565 LDKNetAddress_IPv4_class =
2566 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2567 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2568 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2569 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2570 LDKNetAddress_IPv6_class =
2571 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2572 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2573 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2574 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2575 LDKNetAddress_OnionV2_class =
2576 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2577 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2578 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2579 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2580 LDKNetAddress_OnionV3_class =
2581 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2582 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2583 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2584 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2586 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2587 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2589 case LDKNetAddress_IPv4: {
2590 long addr_ref = (long)&obj->i_pv4.addr;
2591 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2593 case LDKNetAddress_IPv6: {
2594 long addr_ref = (long)&obj->i_pv6.addr;
2595 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2597 case LDKNetAddress_OnionV2: {
2598 long addr_ref = (long)&obj->onion_v2.addr;
2599 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2601 case LDKNetAddress_OnionV3: {
2602 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2603 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2604 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);
2609 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2610 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2611 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2614 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2615 ret->datalen = (*env)->GetArrayLength(env, elems);
2616 if (ret->datalen == 0) {
2619 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2620 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2621 for (size_t i = 0; i < ret->datalen; i++) {
2622 jlong arr_elem = java_elems[i];
2623 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2624 FREE((void*)arr_elem);
2625 ret->data[i] = arr_elem_conv;
2627 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2631 typedef struct LDKChannelMessageHandler_JCalls {
2632 atomic_size_t refcnt;
2635 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2636 jmethodID handle_open_channel_meth;
2637 jmethodID handle_accept_channel_meth;
2638 jmethodID handle_funding_created_meth;
2639 jmethodID handle_funding_signed_meth;
2640 jmethodID handle_funding_locked_meth;
2641 jmethodID handle_shutdown_meth;
2642 jmethodID handle_closing_signed_meth;
2643 jmethodID handle_update_add_htlc_meth;
2644 jmethodID handle_update_fulfill_htlc_meth;
2645 jmethodID handle_update_fail_htlc_meth;
2646 jmethodID handle_update_fail_malformed_htlc_meth;
2647 jmethodID handle_commitment_signed_meth;
2648 jmethodID handle_revoke_and_ack_meth;
2649 jmethodID handle_update_fee_meth;
2650 jmethodID handle_announcement_signatures_meth;
2651 jmethodID peer_disconnected_meth;
2652 jmethodID peer_connected_meth;
2653 jmethodID handle_channel_reestablish_meth;
2654 jmethodID handle_error_meth;
2655 } LDKChannelMessageHandler_JCalls;
2656 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2657 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2659 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2660 long their_node_id_ref = (long)&their_node_id;
2661 LDKInitFeatures their_features_var = their_features;
2662 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2663 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2664 long their_features_ref;
2665 if (their_features_var.is_owned) {
2666 their_features_ref = (long)their_features_var.inner | 1;
2668 their_features_ref = (long)&their_features_var;
2670 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_open_channel_meth, their_node_id_ref, their_features_ref, msg);
2672 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2673 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2675 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2676 long their_node_id_ref = (long)&their_node_id;
2677 LDKInitFeatures their_features_var = their_features;
2678 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2679 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2680 long their_features_ref;
2681 if (their_features_var.is_owned) {
2682 their_features_ref = (long)their_features_var.inner | 1;
2684 their_features_ref = (long)&their_features_var;
2686 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_accept_channel_meth, their_node_id_ref, their_features_ref, msg);
2688 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2689 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2691 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2692 long their_node_id_ref = (long)&their_node_id;
2693 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_created_meth, their_node_id_ref, msg);
2695 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2696 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2698 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2699 long their_node_id_ref = (long)&their_node_id;
2700 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_signed_meth, their_node_id_ref, msg);
2702 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2703 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2705 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2706 long their_node_id_ref = (long)&their_node_id;
2707 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_locked_meth, their_node_id_ref, msg);
2709 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2710 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2712 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2713 long their_node_id_ref = (long)&their_node_id;
2714 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_shutdown_meth, their_node_id_ref, msg);
2716 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2717 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2719 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2720 long their_node_id_ref = (long)&their_node_id;
2721 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_closing_signed_meth, their_node_id_ref, msg);
2723 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2724 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2726 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2727 long their_node_id_ref = (long)&their_node_id;
2728 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_add_htlc_meth, their_node_id_ref, msg);
2730 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2731 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2733 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2734 long their_node_id_ref = (long)&their_node_id;
2735 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fulfill_htlc_meth, their_node_id_ref, msg);
2737 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2738 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2741 long their_node_id_ref = (long)&their_node_id;
2742 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_htlc_meth, their_node_id_ref, msg);
2744 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2745 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2747 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2748 long their_node_id_ref = (long)&their_node_id;
2749 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_ref, msg);
2751 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2752 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2754 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2755 long their_node_id_ref = (long)&their_node_id;
2756 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_commitment_signed_meth, their_node_id_ref, msg);
2758 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2759 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2761 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2762 long their_node_id_ref = (long)&their_node_id;
2763 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_revoke_and_ack_meth, their_node_id_ref, msg);
2765 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2766 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2768 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2769 long their_node_id_ref = (long)&their_node_id;
2770 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fee_meth, their_node_id_ref, msg);
2772 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2773 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2775 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2776 long their_node_id_ref = (long)&their_node_id;
2777 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_announcement_signatures_meth, their_node_id_ref, msg);
2779 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2780 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2782 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2783 long their_node_id_ref = (long)&their_node_id;
2784 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_disconnected_meth, their_node_id_ref, no_connection_possible);
2786 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2787 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2789 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2790 long their_node_id_ref = (long)&their_node_id;
2791 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_connected_meth, their_node_id_ref, msg);
2793 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2794 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2796 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2797 long their_node_id_ref = (long)&their_node_id;
2798 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_channel_reestablish_meth, their_node_id_ref, msg);
2800 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2801 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2803 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2804 long their_node_id_ref = (long)&their_node_id;
2805 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_error_meth, their_node_id_ref, msg);
2807 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2808 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2809 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2811 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2812 (*env)->DeleteGlobalRef(env, j_calls->o);
2816 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2817 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2818 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2819 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2820 return (void*) this_arg;
2822 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2823 jclass c = (*env)->GetObjectClass(env, o);
2824 DO_ASSERT(c != NULL);
2825 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
2826 atomic_init(&calls->refcnt, 1);
2827 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2828 calls->o = (*env)->NewGlobalRef(env, o);
2829 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "(JJJ)V");
2830 DO_ASSERT(calls->handle_open_channel_meth != NULL);
2831 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "(JJJ)V");
2832 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
2833 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "(JJ)V");
2834 DO_ASSERT(calls->handle_funding_created_meth != NULL);
2835 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "(JJ)V");
2836 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
2837 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "(JJ)V");
2838 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
2839 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "(JJ)V");
2840 DO_ASSERT(calls->handle_shutdown_meth != NULL);
2841 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "(JJ)V");
2842 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
2843 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "(JJ)V");
2844 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
2845 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "(JJ)V");
2846 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
2847 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "(JJ)V");
2848 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
2849 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "(JJ)V");
2850 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
2851 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "(JJ)V");
2852 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
2853 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "(JJ)V");
2854 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
2855 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "(JJ)V");
2856 DO_ASSERT(calls->handle_update_fee_meth != NULL);
2857 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "(JJ)V");
2858 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
2859 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "(JZ)V");
2860 DO_ASSERT(calls->peer_disconnected_meth != NULL);
2861 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "(JJ)V");
2862 DO_ASSERT(calls->peer_connected_meth != NULL);
2863 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "(JJ)V");
2864 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
2865 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "(JJ)V");
2866 DO_ASSERT(calls->handle_error_meth != NULL);
2868 LDKChannelMessageHandler ret = {
2869 .this_arg = (void*) calls,
2870 .handle_open_channel = handle_open_channel_jcall,
2871 .handle_accept_channel = handle_accept_channel_jcall,
2872 .handle_funding_created = handle_funding_created_jcall,
2873 .handle_funding_signed = handle_funding_signed_jcall,
2874 .handle_funding_locked = handle_funding_locked_jcall,
2875 .handle_shutdown = handle_shutdown_jcall,
2876 .handle_closing_signed = handle_closing_signed_jcall,
2877 .handle_update_add_htlc = handle_update_add_htlc_jcall,
2878 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
2879 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
2880 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
2881 .handle_commitment_signed = handle_commitment_signed_jcall,
2882 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
2883 .handle_update_fee = handle_update_fee_jcall,
2884 .handle_announcement_signatures = handle_announcement_signatures_jcall,
2885 .peer_disconnected = peer_disconnected_jcall,
2886 .peer_connected = peer_connected_jcall,
2887 .handle_channel_reestablish = handle_channel_reestablish_jcall,
2888 .handle_error = handle_error_jcall,
2889 .free = LDKChannelMessageHandler_JCalls_free,
2890 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
2892 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
2895 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2896 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
2897 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
2898 return (long)res_ptr;
2900 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2901 return ((LDKChannelMessageHandler_JCalls*)val)->o;
2903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong their_features, jlong msg) {
2904 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2905 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2906 FREE((void*)their_node_id);
2907 LDKInitFeatures their_features_conv;
2908 their_features_conv.inner = (void*)(their_features & (~1));
2909 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2910 LDKOpenChannel msg_conv;
2911 msg_conv.inner = (void*)(msg & (~1));
2912 msg_conv.is_owned = (msg & 1) || (msg == 0);
2913 return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_conv, their_features_conv, &msg_conv);
2916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong their_features, jlong msg) {
2917 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2918 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2919 FREE((void*)their_node_id);
2920 LDKInitFeatures their_features_conv;
2921 their_features_conv.inner = (void*)(their_features & (~1));
2922 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
2923 LDKAcceptChannel msg_conv;
2924 msg_conv.inner = (void*)(msg & (~1));
2925 msg_conv.is_owned = (msg & 1) || (msg == 0);
2926 return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_conv, their_features_conv, &msg_conv);
2929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2930 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2931 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2932 FREE((void*)their_node_id);
2933 LDKFundingCreated msg_conv;
2934 msg_conv.inner = (void*)(msg & (~1));
2935 msg_conv.is_owned = (msg & 1) || (msg == 0);
2936 return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2940 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2941 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2942 FREE((void*)their_node_id);
2943 LDKFundingSigned msg_conv;
2944 msg_conv.inner = (void*)(msg & (~1));
2945 msg_conv.is_owned = (msg & 1) || (msg == 0);
2946 return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2950 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2951 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2952 FREE((void*)their_node_id);
2953 LDKFundingLocked msg_conv;
2954 msg_conv.inner = (void*)(msg & (~1));
2955 msg_conv.is_owned = (msg & 1) || (msg == 0);
2956 return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2960 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2961 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2962 FREE((void*)their_node_id);
2963 LDKShutdown msg_conv;
2964 msg_conv.inner = (void*)(msg & (~1));
2965 msg_conv.is_owned = (msg & 1) || (msg == 0);
2966 return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2970 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2971 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2972 FREE((void*)their_node_id);
2973 LDKClosingSigned msg_conv;
2974 msg_conv.inner = (void*)(msg & (~1));
2975 msg_conv.is_owned = (msg & 1) || (msg == 0);
2976 return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2980 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2981 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2982 FREE((void*)their_node_id);
2983 LDKUpdateAddHTLC msg_conv;
2984 msg_conv.inner = (void*)(msg & (~1));
2985 msg_conv.is_owned = (msg & 1) || (msg == 0);
2986 return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2990 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2991 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2992 FREE((void*)their_node_id);
2993 LDKUpdateFulfillHTLC msg_conv;
2994 msg_conv.inner = (void*)(msg & (~1));
2995 msg_conv.is_owned = (msg & 1) || (msg == 0);
2996 return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
2999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3000 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3001 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3002 FREE((void*)their_node_id);
3003 LDKUpdateFailHTLC msg_conv;
3004 msg_conv.inner = (void*)(msg & (~1));
3005 msg_conv.is_owned = (msg & 1) || (msg == 0);
3006 return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3010 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3011 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3012 FREE((void*)their_node_id);
3013 LDKUpdateFailMalformedHTLC msg_conv;
3014 msg_conv.inner = (void*)(msg & (~1));
3015 msg_conv.is_owned = (msg & 1) || (msg == 0);
3016 return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3020 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3021 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3022 FREE((void*)their_node_id);
3023 LDKCommitmentSigned msg_conv;
3024 msg_conv.inner = (void*)(msg & (~1));
3025 msg_conv.is_owned = (msg & 1) || (msg == 0);
3026 return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3030 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3031 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3032 FREE((void*)their_node_id);
3033 LDKRevokeAndACK msg_conv;
3034 msg_conv.inner = (void*)(msg & (~1));
3035 msg_conv.is_owned = (msg & 1) || (msg == 0);
3036 return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3040 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3041 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3042 FREE((void*)their_node_id);
3043 LDKUpdateFee msg_conv;
3044 msg_conv.inner = (void*)(msg & (~1));
3045 msg_conv.is_owned = (msg & 1) || (msg == 0);
3046 return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3050 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3051 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3052 FREE((void*)their_node_id);
3053 LDKAnnouncementSignatures msg_conv;
3054 msg_conv.inner = (void*)(msg & (~1));
3055 msg_conv.is_owned = (msg & 1) || (msg == 0);
3056 return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jboolean no_connection_possible) {
3060 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3061 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3062 FREE((void*)their_node_id);
3063 return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_conv, no_connection_possible);
3066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3067 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3068 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3069 FREE((void*)their_node_id);
3071 msg_conv.inner = (void*)(msg & (~1));
3072 msg_conv.is_owned = (msg & 1) || (msg == 0);
3073 return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3077 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3078 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3079 FREE((void*)their_node_id);
3080 LDKChannelReestablish msg_conv;
3081 msg_conv.inner = (void*)(msg & (~1));
3082 msg_conv.is_owned = (msg & 1) || (msg == 0);
3083 return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
3087 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3088 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
3089 FREE((void*)their_node_id);
3090 LDKErrorMessage msg_conv;
3091 msg_conv.inner = (void*)(msg & (~1));
3092 msg_conv.is_owned = (msg & 1) || (msg == 0);
3093 return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_conv, &msg_conv);
3096 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3097 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3098 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3099 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3100 for (size_t i = 0; i < vec->datalen; i++) {
3101 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3102 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3104 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3108 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3109 ret->datalen = (*env)->GetArrayLength(env, elems);
3110 if (ret->datalen == 0) {
3113 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3114 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3115 for (size_t i = 0; i < ret->datalen; i++) {
3116 jlong arr_elem = java_elems[i];
3117 LDKChannelMonitor arr_elem_conv;
3118 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3119 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3120 ret->data[i] = arr_elem_conv;
3122 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3126 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3127 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3128 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3131 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3132 ret->datalen = (*env)->GetArrayLength(env, elems);
3133 if (ret->datalen == 0) {
3136 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3137 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3138 for (size_t i = 0; i < ret->datalen; i++) {
3139 ret->data[i] = java_elems[i];
3141 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3145 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3146 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3147 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3148 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3149 for (size_t i = 0; i < vec->datalen; i++) {
3150 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3151 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3153 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3157 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3158 ret->datalen = (*env)->GetArrayLength(env, elems);
3159 if (ret->datalen == 0) {
3162 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3163 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3164 for (size_t i = 0; i < ret->datalen; i++) {
3165 jlong arr_elem = java_elems[i];
3166 LDKUpdateAddHTLC arr_elem_conv;
3167 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3168 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3169 ret->data[i] = arr_elem_conv;
3171 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3175 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3176 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3177 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3178 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3179 for (size_t i = 0; i < vec->datalen; i++) {
3180 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3181 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3183 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3187 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3188 ret->datalen = (*env)->GetArrayLength(env, elems);
3189 if (ret->datalen == 0) {
3192 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3193 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3194 for (size_t i = 0; i < ret->datalen; i++) {
3195 jlong arr_elem = java_elems[i];
3196 LDKUpdateFulfillHTLC arr_elem_conv;
3197 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3198 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3199 ret->data[i] = arr_elem_conv;
3201 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3205 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3206 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3207 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3208 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3209 for (size_t i = 0; i < vec->datalen; i++) {
3210 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3211 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3213 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3217 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3218 ret->datalen = (*env)->GetArrayLength(env, elems);
3219 if (ret->datalen == 0) {
3222 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3223 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3224 for (size_t i = 0; i < ret->datalen; i++) {
3225 jlong arr_elem = java_elems[i];
3226 LDKUpdateFailHTLC arr_elem_conv;
3227 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3228 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3229 ret->data[i] = arr_elem_conv;
3231 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3235 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3236 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3237 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3238 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3239 for (size_t i = 0; i < vec->datalen; i++) {
3240 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3241 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3243 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3247 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3248 ret->datalen = (*env)->GetArrayLength(env, elems);
3249 if (ret->datalen == 0) {
3252 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3253 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3254 for (size_t i = 0; i < ret->datalen; i++) {
3255 jlong arr_elem = java_elems[i];
3256 LDKUpdateFailMalformedHTLC arr_elem_conv;
3257 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3258 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3259 ret->data[i] = arr_elem_conv;
3261 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3265 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3266 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3269 if (((LDKCResult_boolLightningErrorZ*)arg)->result_ok) {
3270 return (long)((LDKCResult_boolLightningErrorZ*)arg)->contents.result;
3272 return (long)((LDKCResult_boolLightningErrorZ*)arg)->contents.err;
3275 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3276 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3277 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3280 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3281 ret->datalen = (*env)->GetArrayLength(env, elems);
3282 if (ret->datalen == 0) {
3285 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3286 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3287 for (size_t i = 0; i < ret->datalen; i++) {
3288 jlong arr_elem = java_elems[i];
3289 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3290 FREE((void*)arr_elem);
3291 ret->data[i] = arr_elem_conv;
3293 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3297 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3298 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3299 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3300 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3301 for (size_t i = 0; i < vec->datalen; i++) {
3302 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3303 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3305 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3309 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3310 ret->datalen = (*env)->GetArrayLength(env, elems);
3311 if (ret->datalen == 0) {
3314 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3315 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3316 for (size_t i = 0; i < ret->datalen; i++) {
3317 jlong arr_elem = java_elems[i];
3318 LDKNodeAnnouncement arr_elem_conv;
3319 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3320 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3321 ret->data[i] = arr_elem_conv;
3323 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3327 typedef struct LDKRoutingMessageHandler_JCalls {
3328 atomic_size_t refcnt;
3331 jmethodID handle_node_announcement_meth;
3332 jmethodID handle_channel_announcement_meth;
3333 jmethodID handle_channel_update_meth;
3334 jmethodID handle_htlc_fail_channel_update_meth;
3335 jmethodID get_next_channel_announcements_meth;
3336 jmethodID get_next_node_announcements_meth;
3337 jmethodID should_request_full_sync_meth;
3338 } LDKRoutingMessageHandler_JCalls;
3339 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3340 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3342 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3343 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_node_announcement_meth, msg);
3344 LDKCResult_boolLightningErrorZ res = *ret;
3348 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3349 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3351 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3352 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_announcement_meth, msg);
3353 LDKCResult_boolLightningErrorZ res = *ret;
3357 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3358 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3360 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3361 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_update_meth, msg);
3362 LDKCResult_boolLightningErrorZ res = *ret;
3366 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3367 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3369 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3370 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_htlc_fail_channel_update_meth, update);
3372 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3373 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3376 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3377 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3381 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3382 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3384 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3385 long starting_point_ref = (long)&starting_point;
3386 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_node_announcements_meth, starting_point_ref, batch_amount);
3387 LDKCVec_NodeAnnouncementZ res = *ret;
3391 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3392 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3394 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3395 long node_id_ref = (long)&node_id;
3396 return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->should_request_full_sync_meth, node_id_ref);
3398 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3399 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3400 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3402 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3403 (*env)->DeleteGlobalRef(env, j_calls->o);
3407 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3408 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3409 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3410 return (void*) this_arg;
3412 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3413 jclass c = (*env)->GetObjectClass(env, o);
3414 DO_ASSERT(c != NULL);
3415 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3416 atomic_init(&calls->refcnt, 1);
3417 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3418 calls->o = (*env)->NewGlobalRef(env, o);
3419 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3420 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3421 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3422 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3423 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3424 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3425 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3426 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3427 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3428 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3429 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "(JB)J");
3430 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3431 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "(J)Z");
3432 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3434 LDKRoutingMessageHandler ret = {
3435 .this_arg = (void*) calls,
3436 .handle_node_announcement = handle_node_announcement_jcall,
3437 .handle_channel_announcement = handle_channel_announcement_jcall,
3438 .handle_channel_update = handle_channel_update_jcall,
3439 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3440 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3441 .get_next_node_announcements = get_next_node_announcements_jcall,
3442 .should_request_full_sync = should_request_full_sync_jcall,
3443 .free = LDKRoutingMessageHandler_JCalls_free,
3447 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3448 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3449 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3450 return (long)res_ptr;
3452 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3453 return ((LDKRoutingMessageHandler_JCalls*)val)->o;
3455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3456 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3457 LDKNodeAnnouncement msg_conv;
3458 msg_conv.inner = (void*)(msg & (~1));
3459 msg_conv.is_owned = (msg & 1) || (msg == 0);
3460 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3461 *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, &msg_conv);
3465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3466 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3467 LDKChannelAnnouncement msg_conv;
3468 msg_conv.inner = (void*)(msg & (~1));
3469 msg_conv.is_owned = (msg & 1) || (msg == 0);
3470 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3471 *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, &msg_conv);
3475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3476 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3477 LDKChannelUpdate msg_conv;
3478 msg_conv.inner = (void*)(msg & (~1));
3479 msg_conv.is_owned = (msg & 1) || (msg == 0);
3480 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3481 *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, &msg_conv);
3485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) {
3486 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3487 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3488 return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv);
3491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) {
3492 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3493 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3494 *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount);
3498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) {
3499 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3500 LDKPublicKey starting_point_conv = *(LDKPublicKey*)starting_point;
3501 FREE((void*)starting_point);
3502 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3503 *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_conv, batch_amount);
3507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jlong node_id) {
3508 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3509 LDKPublicKey node_id_conv = *(LDKPublicKey*)node_id;
3510 FREE((void*)node_id);
3511 return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_conv);
3514 typedef struct LDKSocketDescriptor_JCalls {
3515 atomic_size_t refcnt;
3518 jmethodID send_data_meth;
3519 jmethodID disconnect_socket_meth;
3521 jmethodID hash_meth;
3522 } LDKSocketDescriptor_JCalls;
3523 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3524 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3526 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3527 long data_ref = (long)&data;
3528 return (*env)->CallLongMethod(env, j_calls->o, j_calls->send_data_meth, data_ref, resume_read);
3530 void disconnect_socket_jcall(void* this_arg) {
3531 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3533 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3534 return (*env)->CallVoidMethod(env, j_calls->o, j_calls->disconnect_socket_meth);
3536 bool eq_jcall(const void* this_arg, const void *other_arg) {
3537 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3539 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3540 return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->eq_meth, other_arg);
3542 uint64_t hash_jcall(const void* this_arg) {
3543 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3545 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3546 return (*env)->CallLongMethod(env, j_calls->o, j_calls->hash_meth);
3548 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3549 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3550 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3552 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3553 (*env)->DeleteGlobalRef(env, j_calls->o);
3557 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3558 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3559 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3560 return (void*) this_arg;
3562 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3563 jclass c = (*env)->GetObjectClass(env, o);
3564 DO_ASSERT(c != NULL);
3565 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3566 atomic_init(&calls->refcnt, 1);
3567 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3568 calls->o = (*env)->NewGlobalRef(env, o);
3569 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3570 DO_ASSERT(calls->send_data_meth != NULL);
3571 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3572 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3573 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3574 DO_ASSERT(calls->eq_meth != NULL);
3575 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3576 DO_ASSERT(calls->hash_meth != NULL);
3578 LDKSocketDescriptor ret = {
3579 .this_arg = (void*) calls,
3580 .send_data = send_data_jcall,
3581 .disconnect_socket = disconnect_socket_jcall,
3584 .clone = LDKSocketDescriptor_JCalls_clone,
3585 .free = LDKSocketDescriptor_JCalls_free,
3589 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3590 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3591 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3592 return (long)res_ptr;
3594 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3595 return ((LDKSocketDescriptor_JCalls*)val)->o;
3597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) {
3598 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3599 LDKu8slice data_conv = *(LDKu8slice*)data;
3600 return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read);
3603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) {
3604 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3605 return (arg_conv->disconnect_socket)(arg_conv->this_arg);
3608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) {
3609 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3610 return (arg_conv->hash)(arg_conv->this_arg);
3613 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3614 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3615 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1new(JNIEnv *env, jclass _b, jlongArray elems){
3618 LDKCVecTempl_PublicKey *ret = MALLOC(sizeof(LDKCVecTempl_PublicKey), "LDKCVecTempl_PublicKey");
3619 ret->datalen = (*env)->GetArrayLength(env, elems);
3620 if (ret->datalen == 0) {
3623 ret->data = MALLOC(sizeof(LDKPublicKey) * ret->datalen, "LDKCVecTempl_PublicKey Data");
3624 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3625 for (size_t i = 0; i < ret->datalen; i++) {
3626 jlong arr_elem = java_elems[i];
3627 LDKPublicKey arr_elem_conv = *(LDKPublicKey*)arr_elem;
3628 FREE((void*)arr_elem);
3629 ret->data[i] = arr_elem_conv;
3631 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3636 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3639 if (((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok) {
3640 return (long)((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->contents.result;
3642 return (long)((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->contents.err;
3645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3646 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3648 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3649 if (((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok) {
3650 return (long)((LDKCResult_boolPeerHandleErrorZ*)arg)->contents.result;
3652 return (long)((LDKCResult_boolPeerHandleErrorZ*)arg)->contents.err;
3655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3656 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3659 if (((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok) {
3660 return (long)((LDKCResult_SecretKeySecpErrorZ*)arg)->contents.result;
3662 return (long)((LDKCResult_SecretKeySecpErrorZ*)arg)->contents.err;
3665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3666 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3669 if (((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok) {
3670 return (long)((LDKCResult_PublicKeySecpErrorZ*)arg)->contents.result;
3672 return (long)((LDKCResult_PublicKeySecpErrorZ*)arg)->contents.err;
3675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3676 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3679 if (((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok) {
3680 return (long)((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->contents.result;
3682 return (long)((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->contents.err;
3685 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3686 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3687 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3690 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3691 ret->datalen = (*env)->GetArrayLength(env, elems);
3692 if (ret->datalen == 0) {
3695 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3696 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3697 for (size_t i = 0; i < ret->datalen; i++) {
3698 jlong arr_elem = java_elems[i];
3699 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3700 FREE((void*)arr_elem);
3701 ret->data[i] = arr_elem_conv;
3703 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3707 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3708 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3709 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3710 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3711 for (size_t i = 0; i < vec->datalen; i++) {
3712 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3713 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3715 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3719 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3720 ret->datalen = (*env)->GetArrayLength(env, elems);
3721 if (ret->datalen == 0) {
3724 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3725 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3726 for (size_t i = 0; i < ret->datalen; i++) {
3727 jlong arr_elem = java_elems[i];
3728 LDKRouteHop arr_elem_conv;
3729 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3730 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3731 ret->data[i] = arr_elem_conv;
3733 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3737 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3738 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3739 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3742 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3743 ret->datalen = (*env)->GetArrayLength(env, elems);
3744 if (ret->datalen == 0) {
3747 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3748 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3749 for (size_t i = 0; i < ret->datalen; i++) {
3750 jlong arr_elem = java_elems[i];
3751 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3752 FREE((void*)arr_elem);
3753 ret->data[i] = arr_elem_conv;
3755 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3760 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3763 if (((LDKCResult_RouteLightningErrorZ*)arg)->result_ok) {
3764 return (long)((LDKCResult_RouteLightningErrorZ*)arg)->contents.result;
3766 return (long)((LDKCResult_RouteLightningErrorZ*)arg)->contents.err;
3769 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3770 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3771 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3772 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3773 for (size_t i = 0; i < vec->datalen; i++) {
3774 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3775 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3777 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3781 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3782 ret->datalen = (*env)->GetArrayLength(env, elems);
3783 if (ret->datalen == 0) {
3786 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
3787 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3788 for (size_t i = 0; i < ret->datalen; i++) {
3789 jlong arr_elem = java_elems[i];
3790 LDKRouteHint arr_elem_conv;
3791 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3792 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3793 ret->data[i] = arr_elem_conv;
3795 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3800 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
3802 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
3805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3806 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
3808 return C2Tuple_OutPointScriptZ_free(arg_conv);
3811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3812 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
3814 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
3817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3818 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
3820 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
3823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
3824 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
3826 return C2Tuple_u64u64Z_free(arg_conv);
3829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3830 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
3832 return C2Tuple_usizeTransactionZ_free(arg_conv);
3835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3836 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
3838 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
3841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3842 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
3844 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
3847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3848 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
3850 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3851 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
3855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3856 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
3858 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
3861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3862 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
3864 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
3865 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
3869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3870 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
3872 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
3873 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
3877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3878 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3880 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
3883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3884 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
3886 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
3887 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
3891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3892 LDKAPIError arg_conv = *(LDKAPIError*)arg;
3894 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3895 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
3899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3900 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
3902 return CResult_NoneAPIErrorZ_free(arg_conv);
3905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
3906 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
3908 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3909 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
3913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3914 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
3916 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
3919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3920 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
3922 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3923 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
3927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3928 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
3930 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
3933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3934 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
3936 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
3937 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
3941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3942 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
3944 return CResult_NonePaymentSendFailureZ_free(arg_conv);
3947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3948 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
3950 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
3951 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
3955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3956 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
3958 return CResult_NonePeerHandleErrorZ_free(arg_conv);
3961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
3962 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
3964 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
3965 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
3969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3970 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
3972 return CResult_PublicKeySecpErrorZ_free(arg_conv);
3975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3976 LDKPublicKey arg_conv = *(LDKPublicKey*)arg;
3978 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
3979 *ret = CResult_PublicKeySecpErrorZ_ok(arg_conv);
3983 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
3984 LDKLightningError arg_conv = *(LDKLightningError*)arg;
3986 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
3987 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
3991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3992 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
3994 return CResult_RouteLightningErrorZ_free(arg_conv);
3997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
3998 LDKRoute arg_conv = *(LDKRoute*)arg;
4000 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4001 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4006 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4008 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4009 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4014 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4016 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4020 LDKSecretKey arg_conv = *(LDKSecretKey*)arg;
4022 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4023 *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv);
4027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4028 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4030 return CResult_SignatureNoneZ_free(arg_conv);
4033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4034 LDKSignature arg_conv = *(LDKSignature*)arg;
4036 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4037 *ret = CResult_SignatureNoneZ_ok(arg_conv);
4041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4042 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4044 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4045 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4050 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4052 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4056 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4058 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4059 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4064 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4066 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4067 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4072 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4074 return CResult_TxOutAccessErrorZ_free(arg_conv);
4077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4078 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4080 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4081 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4085 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4086 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4088 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4089 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4094 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4096 return CResult_boolLightningErrorZ_free(arg_conv);
4099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4100 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4101 *ret = CResult_boolLightningErrorZ_ok(arg);
4105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4106 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4108 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4109 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4114 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4116 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4120 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4121 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4126 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4128 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4132 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4134 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4138 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4140 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4144 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4146 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4150 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4152 return CVec_CVec_RouteHopZZ_free(arg_conv);
4155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4156 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4158 return CVec_ChannelDetailsZ_free(arg_conv);
4161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4162 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4164 return CVec_ChannelMonitorZ_free(arg_conv);
4167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4168 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4170 return CVec_EventZ_free(arg_conv);
4173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4174 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4176 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4180 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4182 return CVec_MessageSendEventZ_free(arg_conv);
4185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4186 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4188 return CVec_MonitorEventZ_free(arg_conv);
4191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4192 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4194 return CVec_NetAddressZ_free(arg_conv);
4197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4198 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4200 return CVec_NodeAnnouncementZ_free(arg_conv);
4203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4204 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4206 return CVec_PublicKeyZ_free(arg_conv);
4209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4210 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4212 return CVec_RouteHintZ_free(arg_conv);
4215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4216 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4218 return CVec_RouteHopZ_free(arg_conv);
4221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4222 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4224 return CVec_SignatureZ_free(arg_conv);
4227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4228 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4230 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4234 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4236 return CVec_TransactionZ_free(arg_conv);
4239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4240 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4242 return CVec_TxOutZ_free(arg_conv);
4245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4246 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4248 return CVec_UpdateAddHTLCZ_free(arg_conv);
4251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4252 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4254 return CVec_UpdateFailHTLCZ_free(arg_conv);
4257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4258 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4260 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4264 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4266 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4270 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4272 return CVec_u64Z_free(arg_conv);
4275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4276 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4278 return CVec_u8Z_free(arg_conv);
4281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4282 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4284 return Transaction_free(_res_conv);
4287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4288 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4290 return TxOut_free(_res_conv);
4293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4294 LDKTransaction b_conv = *(LDKTransaction*)b;
4296 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4297 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4302 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4303 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4308 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4309 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4315 a_conv.inner = (void*)(a & (~1));
4316 a_conv.is_owned = (a & 1) || (a == 0);
4317 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4319 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4320 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4325 LDKThirtyTwoBytes a_ref;
4326 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4327 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4329 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4330 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4335 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4336 *ret = C2Tuple_u64u64Z_new(a, b);
4340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4341 LDKSignature a_conv = *(LDKSignature*)a;
4343 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4345 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4346 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
4350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4351 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4352 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4357 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4358 *ret = CResult_SignatureNoneZ_err();
4362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4363 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4364 *ret = CResult_CVec_SignatureZNoneZ_err();
4368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4369 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4370 *ret = CResult_NoneAPIErrorZ_ok();
4374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4375 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4376 *ret = CResult_NonePaymentSendFailureZ_ok();
4380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4381 LDKChannelAnnouncement a_conv;
4382 a_conv.inner = (void*)(a & (~1));
4383 a_conv.is_owned = (a & 1) || (a == 0);
4384 LDKChannelUpdate b_conv;
4385 b_conv.inner = (void*)(b & (~1));
4386 b_conv.is_owned = (b & 1) || (b == 0);
4387 LDKChannelUpdate c_conv;
4388 c_conv.inner = (void*)(c & (~1));
4389 c_conv.is_owned = (c & 1) || (c == 0);
4390 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4391 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4396 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4397 *ret = CResult_NonePeerHandleErrorZ_ok();
4401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4402 LDKHTLCOutputInCommitment a_conv;
4403 a_conv.inner = (void*)(a & (~1));
4404 a_conv.is_owned = (a & 1) || (a == 0);
4405 LDKSignature b_conv = *(LDKSignature*)b;
4407 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4408 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
4412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4413 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4414 FREE((void*)this_ptr);
4415 return Event_free(this_ptr_conv);
4418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4419 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4420 FREE((void*)this_ptr);
4421 return MessageSendEvent_free(this_ptr_conv);
4424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4425 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4426 FREE((void*)this_ptr);
4427 return MessageSendEventsProvider_free(this_ptr_conv);
4430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4431 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4432 FREE((void*)this_ptr);
4433 return EventsProvider_free(this_ptr_conv);
4436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4437 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4438 FREE((void*)this_ptr);
4439 return APIError_free(this_ptr_conv);
4442 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4443 jclass ret = LDKLevel_to_java(_env, Level_max());
4447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4448 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4449 FREE((void*)this_ptr);
4450 return Logger_free(this_ptr_conv);
4453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4454 LDKChannelHandshakeConfig this_ptr_conv;
4455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4457 return ChannelHandshakeConfig_free(this_ptr_conv);
4460 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4461 LDKChannelHandshakeConfig this_ptr_conv;
4462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4464 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4468 LDKChannelHandshakeConfig this_ptr_conv;
4469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4471 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4474 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4475 LDKChannelHandshakeConfig this_ptr_conv;
4476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4478 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4482 LDKChannelHandshakeConfig this_ptr_conv;
4483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4485 return ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4489 LDKChannelHandshakeConfig this_ptr_conv;
4490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4492 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4496 LDKChannelHandshakeConfig this_ptr_conv;
4497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4499 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4502 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) {
4503 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4504 DO_ASSERT(ret.is_owned);
4505 return ((long)ret.inner) | 1;
4508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4509 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4510 DO_ASSERT(ret.is_owned);
4511 return ((long)ret.inner) | 1;
4514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4515 LDKChannelHandshakeLimits this_ptr_conv;
4516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4518 return ChannelHandshakeLimits_free(this_ptr_conv);
4521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4522 LDKChannelHandshakeLimits this_ptr_conv;
4523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4525 return ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4529 LDKChannelHandshakeLimits this_ptr_conv;
4530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4532 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4536 LDKChannelHandshakeLimits this_ptr_conv;
4537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4538 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4539 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4543 LDKChannelHandshakeLimits this_ptr_conv;
4544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4546 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4550 LDKChannelHandshakeLimits this_ptr_conv;
4551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4553 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4556 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) {
4557 LDKChannelHandshakeLimits this_ptr_conv;
4558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4560 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4564 LDKChannelHandshakeLimits this_ptr_conv;
4565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4567 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4571 LDKChannelHandshakeLimits this_ptr_conv;
4572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4574 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4577 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4578 LDKChannelHandshakeLimits this_ptr_conv;
4579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4581 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4585 LDKChannelHandshakeLimits this_ptr_conv;
4586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4588 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4592 LDKChannelHandshakeLimits this_ptr_conv;
4593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4595 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4599 LDKChannelHandshakeLimits this_ptr_conv;
4600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4602 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4606 LDKChannelHandshakeLimits this_ptr_conv;
4607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4609 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4613 LDKChannelHandshakeLimits this_ptr_conv;
4614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4616 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4619 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4620 LDKChannelHandshakeLimits this_ptr_conv;
4621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4623 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4627 LDKChannelHandshakeLimits this_ptr_conv;
4628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4630 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4634 LDKChannelHandshakeLimits this_ptr_conv;
4635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4637 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4641 LDKChannelHandshakeLimits this_ptr_conv;
4642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4644 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4647 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4648 LDKChannelHandshakeLimits this_ptr_conv;
4649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4651 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4655 LDKChannelHandshakeLimits this_ptr_conv;
4656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4658 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4661 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) {
4662 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);
4663 DO_ASSERT(ret.is_owned);
4664 return ((long)ret.inner) | 1;
4667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4668 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4669 DO_ASSERT(ret.is_owned);
4670 return ((long)ret.inner) | 1;
4673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4674 LDKChannelConfig this_ptr_conv;
4675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4677 return ChannelConfig_free(this_ptr_conv);
4680 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4681 LDKChannelConfig this_ptr_conv;
4682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4684 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4688 LDKChannelConfig this_ptr_conv;
4689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4691 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4695 LDKChannelConfig this_ptr_conv;
4696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4698 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4702 LDKChannelConfig this_ptr_conv;
4703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4705 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4709 LDKChannelConfig this_ptr_conv;
4710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4712 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4716 LDKChannelConfig this_ptr_conv;
4717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4719 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4722 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) {
4723 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4724 DO_ASSERT(ret.is_owned);
4725 return ((long)ret.inner) | 1;
4728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4729 LDKChannelConfig ret = ChannelConfig_default();
4730 DO_ASSERT(ret.is_owned);
4731 return ((long)ret.inner) | 1;
4734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4735 LDKChannelConfig obj_conv;
4736 obj_conv.inner = (void*)(obj & (~1));
4737 obj_conv.is_owned = (obj & 1) || (obj == 0);
4738 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4739 *ret = ChannelConfig_write(&obj_conv);
4743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4744 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4745 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4746 DO_ASSERT(ret.is_owned);
4747 return ((long)ret.inner) | 1;
4750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4751 LDKUserConfig this_ptr_conv;
4752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4754 return UserConfig_free(this_ptr_conv);
4757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4758 LDKUserConfig this_ptr_conv;
4759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4761 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
4762 DO_ASSERT(ret.is_owned);
4763 return ((long)ret.inner) | 1;
4766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4767 LDKUserConfig this_ptr_conv;
4768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4770 LDKChannelHandshakeConfig val_conv;
4771 val_conv.inner = (void*)(val & (~1));
4772 val_conv.is_owned = (val & 1) || (val == 0);
4773 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
4776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
4777 LDKUserConfig this_ptr_conv;
4778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4780 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
4781 DO_ASSERT(ret.is_owned);
4782 return ((long)ret.inner) | 1;
4785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4786 LDKUserConfig this_ptr_conv;
4787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4789 LDKChannelHandshakeLimits val_conv;
4790 val_conv.inner = (void*)(val & (~1));
4791 val_conv.is_owned = (val & 1) || (val == 0);
4792 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
4795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
4796 LDKUserConfig 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 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
4800 DO_ASSERT(ret.is_owned);
4801 return ((long)ret.inner) | 1;
4804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4805 LDKUserConfig this_ptr_conv;
4806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4808 LDKChannelConfig val_conv;
4809 val_conv.inner = (void*)(val & (~1));
4810 val_conv.is_owned = (val & 1) || (val == 0);
4811 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
4814 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) {
4815 LDKChannelHandshakeConfig own_channel_config_arg_conv;
4816 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
4817 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
4818 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
4819 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
4820 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
4821 LDKChannelConfig channel_options_arg_conv;
4822 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
4823 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
4824 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
4825 DO_ASSERT(ret.is_owned);
4826 return ((long)ret.inner) | 1;
4829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
4830 LDKUserConfig ret = UserConfig_default();
4831 DO_ASSERT(ret.is_owned);
4832 return ((long)ret.inner) | 1;
4835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4836 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
4837 FREE((void*)this_ptr);
4838 return Access_free(this_ptr_conv);
4841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4842 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
4843 FREE((void*)this_ptr);
4844 return Watch_free(this_ptr_conv);
4847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4848 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
4849 FREE((void*)this_ptr);
4850 return Filter_free(this_ptr_conv);
4853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4854 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
4855 FREE((void*)this_ptr);
4856 return BroadcasterInterface_free(this_ptr_conv);
4859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4860 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
4861 FREE((void*)this_ptr);
4862 return FeeEstimator_free(this_ptr_conv);
4865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4866 LDKChainMonitor 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 ChainMonitor_free(this_ptr_conv);
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
4873 LDKChainMonitor this_arg_conv;
4874 this_arg_conv.inner = (void*)(this_arg & (~1));
4875 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4876 unsigned char header_arr[80];
4877 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4878 unsigned char (*header_ref)[80] = &header_arr;
4879 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
4880 FREE((void*)txdata);
4881 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
4884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
4885 LDKChainMonitor this_arg_conv;
4886 this_arg_conv.inner = (void*)(this_arg & (~1));
4887 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4888 unsigned char header_arr[80];
4889 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4890 unsigned char (*header_ref)[80] = &header_arr;
4891 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
4894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
4895 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
4896 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
4897 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
4898 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4899 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
4901 LDKLogger logger_conv = *(LDKLogger*)logger;
4902 if (logger_conv.free == LDKLogger_JCalls_free) {
4903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4904 LDKLogger_JCalls_clone(logger_conv.this_arg);
4906 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
4907 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
4908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4909 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
4911 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
4912 DO_ASSERT(ret.is_owned);
4913 return ((long)ret.inner) | 1;
4916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
4917 LDKChainMonitor this_arg_conv;
4918 this_arg_conv.inner = (void*)(this_arg & (~1));
4919 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4920 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
4921 *ret = ChainMonitor_as_Watch(&this_arg_conv);
4925 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
4926 LDKChainMonitor this_arg_conv;
4927 this_arg_conv.inner = (void*)(this_arg & (~1));
4928 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
4929 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4930 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
4934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4935 LDKChannelMonitorUpdate this_ptr_conv;
4936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4938 return ChannelMonitorUpdate_free(this_ptr_conv);
4941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4942 LDKChannelMonitorUpdate this_ptr_conv;
4943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4945 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
4948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4949 LDKChannelMonitorUpdate this_ptr_conv;
4950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4952 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
4955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
4956 LDKChannelMonitorUpdate obj_conv;
4957 obj_conv.inner = (void*)(obj & (~1));
4958 obj_conv.is_owned = (obj & 1) || (obj == 0);
4959 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4960 *ret = ChannelMonitorUpdate_write(&obj_conv);
4964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
4965 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4966 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
4967 DO_ASSERT(ret.is_owned);
4968 return ((long)ret.inner) | 1;
4971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4972 LDKMonitorUpdateError this_ptr_conv;
4973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4975 return MonitorUpdateError_free(this_ptr_conv);
4978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4979 LDKMonitorEvent this_ptr_conv;
4980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4982 return MonitorEvent_free(this_ptr_conv);
4985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4986 LDKHTLCUpdate this_ptr_conv;
4987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4989 return HTLCUpdate_free(this_ptr_conv);
4992 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
4993 LDKHTLCUpdate obj_conv;
4994 obj_conv.inner = (void*)(obj & (~1));
4995 obj_conv.is_owned = (obj & 1) || (obj == 0);
4996 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4997 *ret = HTLCUpdate_write(&obj_conv);
5001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5002 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5003 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5004 DO_ASSERT(ret.is_owned);
5005 return ((long)ret.inner) | 1;
5008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5009 LDKChannelMonitor this_ptr_conv;
5010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5012 return ChannelMonitor_free(this_ptr_conv);
5015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5016 LDKChannelMonitor this_arg_conv;
5017 this_arg_conv.inner = (void*)(this_arg & (~1));
5018 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5019 LDKChannelMonitorUpdate updates_conv;
5020 updates_conv.inner = (void*)(updates & (~1));
5021 updates_conv.is_owned = (updates & 1) || (updates == 0);
5022 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5023 LDKLogger* logger_conv = (LDKLogger*)logger;
5024 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5025 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5030 LDKChannelMonitor this_arg_conv;
5031 this_arg_conv.inner = (void*)(this_arg & (~1));
5032 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5033 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5037 LDKChannelMonitor this_arg_conv;
5038 this_arg_conv.inner = (void*)(this_arg & (~1));
5039 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5040 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5041 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5046 LDKChannelMonitor this_arg_conv;
5047 this_arg_conv.inner = (void*)(this_arg & (~1));
5048 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5049 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5050 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5055 LDKChannelMonitor this_arg_conv;
5056 this_arg_conv.inner = (void*)(this_arg & (~1));
5057 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5058 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5059 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5064 LDKChannelMonitor this_arg_conv;
5065 this_arg_conv.inner = (void*)(this_arg & (~1));
5066 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5067 LDKLogger* logger_conv = (LDKLogger*)logger;
5068 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5069 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5073 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) {
5074 LDKChannelMonitor this_arg_conv;
5075 this_arg_conv.inner = (void*)(this_arg & (~1));
5076 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5077 unsigned char header_arr[80];
5078 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5079 unsigned char (*header_ref)[80] = &header_arr;
5080 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5081 FREE((void*)txdata);
5082 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5083 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5084 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5085 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5087 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5088 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5089 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5090 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5092 LDKLogger logger_conv = *(LDKLogger*)logger;
5093 if (logger_conv.free == LDKLogger_JCalls_free) {
5094 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5095 LDKLogger_JCalls_clone(logger_conv.this_arg);
5097 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5098 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5102 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) {
5103 LDKChannelMonitor this_arg_conv;
5104 this_arg_conv.inner = (void*)(this_arg & (~1));
5105 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5106 unsigned char header_arr[80];
5107 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5108 unsigned char (*header_ref)[80] = &header_arr;
5109 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5110 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5111 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5112 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5114 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5115 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5116 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5117 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5119 LDKLogger logger_conv = *(LDKLogger*)logger;
5120 if (logger_conv.free == LDKLogger_JCalls_free) {
5121 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5122 LDKLogger_JCalls_clone(logger_conv.this_arg);
5124 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5128 LDKOutPoint this_ptr_conv;
5129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5131 return OutPoint_free(this_ptr_conv);
5134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5135 LDKOutPoint this_ptr_conv;
5136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5138 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5139 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5144 LDKOutPoint this_ptr_conv;
5145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5147 LDKThirtyTwoBytes val_ref;
5148 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5149 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5152 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5153 LDKOutPoint this_ptr_conv;
5154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5156 return OutPoint_get_index(&this_ptr_conv);
5159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5160 LDKOutPoint this_ptr_conv;
5161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5163 return OutPoint_set_index(&this_ptr_conv, val);
5166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5167 LDKThirtyTwoBytes txid_arg_ref;
5168 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5169 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5170 DO_ASSERT(ret.is_owned);
5171 return ((long)ret.inner) | 1;
5174 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5175 LDKOutPoint this_arg_conv;
5176 this_arg_conv.inner = (void*)(this_arg & (~1));
5177 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5178 jbyteArray _arr = (*_env)->NewByteArray(_env, 32);
5179 (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5184 LDKOutPoint obj_conv;
5185 obj_conv.inner = (void*)(obj & (~1));
5186 obj_conv.is_owned = (obj & 1) || (obj == 0);
5187 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5188 *ret = OutPoint_write(&obj_conv);
5192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5193 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5194 LDKOutPoint ret = OutPoint_read(ser_conv);
5195 DO_ASSERT(ret.is_owned);
5196 return ((long)ret.inner) | 1;
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5200 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5201 FREE((void*)this_ptr);
5202 return SpendableOutputDescriptor_free(this_ptr_conv);
5205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5206 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5207 FREE((void*)this_ptr);
5208 return ChannelKeys_free(this_ptr_conv);
5211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5212 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5213 FREE((void*)this_ptr);
5214 return KeysInterface_free(this_ptr_conv);
5217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5218 LDKInMemoryChannelKeys this_ptr_conv;
5219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5221 return InMemoryChannelKeys_free(this_ptr_conv);
5224 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5225 LDKInMemoryChannelKeys this_ptr_conv;
5226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5228 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5229 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5234 LDKInMemoryChannelKeys this_ptr_conv;
5235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5237 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5239 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_conv);
5242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5243 LDKInMemoryChannelKeys this_ptr_conv;
5244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5246 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5247 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5252 LDKInMemoryChannelKeys this_ptr_conv;
5253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5255 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5257 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_conv);
5260 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5261 LDKInMemoryChannelKeys this_ptr_conv;
5262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5264 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5265 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5270 LDKInMemoryChannelKeys this_ptr_conv;
5271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5273 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5275 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_conv);
5278 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5279 LDKInMemoryChannelKeys this_ptr_conv;
5280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5282 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5283 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5288 LDKInMemoryChannelKeys this_ptr_conv;
5289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5291 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5293 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_conv);
5296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5297 LDKInMemoryChannelKeys this_ptr_conv;
5298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5300 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5301 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5306 LDKInMemoryChannelKeys this_ptr_conv;
5307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5309 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5311 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_conv);
5314 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5315 LDKInMemoryChannelKeys this_ptr_conv;
5316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5318 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5319 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5324 LDKInMemoryChannelKeys this_ptr_conv;
5325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5327 LDKThirtyTwoBytes val_ref;
5328 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5329 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
5333 LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
5334 FREE((void*)funding_key);
5335 LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
5336 FREE((void*)revocation_base_key);
5337 LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
5338 FREE((void*)payment_key);
5339 LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
5340 FREE((void*)delayed_payment_base_key);
5341 LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
5342 FREE((void*)htlc_base_key);
5343 LDKThirtyTwoBytes commitment_seed_ref;
5344 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5345 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5346 FREE((void*)key_derivation_params);
5347 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
5348 DO_ASSERT(ret.is_owned);
5349 return ((long)ret.inner) | 1;
5352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5353 LDKInMemoryChannelKeys this_arg_conv;
5354 this_arg_conv.inner = (void*)(this_arg & (~1));
5355 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5356 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5357 DO_ASSERT(ret.is_owned);
5358 return ((long)ret.inner) | 1;
5361 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5362 LDKInMemoryChannelKeys this_arg_conv;
5363 this_arg_conv.inner = (void*)(this_arg & (~1));
5364 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5365 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5368 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5369 LDKInMemoryChannelKeys this_arg_conv;
5370 this_arg_conv.inner = (void*)(this_arg & (~1));
5371 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5372 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5376 LDKInMemoryChannelKeys this_arg_conv;
5377 this_arg_conv.inner = (void*)(this_arg & (~1));
5378 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5379 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5380 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5385 LDKInMemoryChannelKeys obj_conv;
5386 obj_conv.inner = (void*)(obj & (~1));
5387 obj_conv.is_owned = (obj & 1) || (obj == 0);
5388 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5389 *ret = InMemoryChannelKeys_write(&obj_conv);
5393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5394 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5395 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5396 DO_ASSERT(ret.is_owned);
5397 return ((long)ret.inner) | 1;
5400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5401 LDKKeysManager this_ptr_conv;
5402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5404 return KeysManager_free(this_ptr_conv);
5407 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) {
5408 unsigned char seed_arr[32];
5409 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5410 unsigned char (*seed_ref)[32] = &seed_arr;
5411 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5412 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5413 DO_ASSERT(ret.is_owned);
5414 return ((long)ret.inner) | 1;
5417 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) {
5418 LDKKeysManager this_arg_conv;
5419 this_arg_conv.inner = (void*)(this_arg & (~1));
5420 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5421 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5422 DO_ASSERT(ret.is_owned);
5423 return ((long)ret.inner) | 1;
5426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5427 LDKKeysManager this_arg_conv;
5428 this_arg_conv.inner = (void*)(this_arg & (~1));
5429 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5430 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5431 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5436 LDKChannelManager this_ptr_conv;
5437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5439 return ChannelManager_free(this_ptr_conv);
5442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5443 LDKChannelDetails this_ptr_conv;
5444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5446 return ChannelDetails_free(this_ptr_conv);
5449 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5450 LDKChannelDetails this_ptr_conv;
5451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5453 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5454 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5459 LDKChannelDetails this_ptr_conv;
5460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5462 LDKThirtyTwoBytes val_ref;
5463 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5464 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5468 LDKChannelDetails this_ptr_conv;
5469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5471 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5472 *ret = ChannelDetails_get_remote_network_id(&this_ptr_conv);
5476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5477 LDKChannelDetails this_ptr_conv;
5478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5480 LDKPublicKey val_conv = *(LDKPublicKey*)val;
5482 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_conv);
5485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5486 LDKChannelDetails this_ptr_conv;
5487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5489 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5490 DO_ASSERT(ret.is_owned);
5491 return ((long)ret.inner) | 1;
5494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5495 LDKChannelDetails this_ptr_conv;
5496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5498 LDKInitFeatures val_conv;
5499 val_conv.inner = (void*)(val & (~1));
5500 val_conv.is_owned = (val & 1) || (val == 0);
5501 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5505 LDKChannelDetails this_ptr_conv;
5506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5508 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5512 LDKChannelDetails this_ptr_conv;
5513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5515 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5519 LDKChannelDetails this_ptr_conv;
5520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5522 return ChannelDetails_get_user_id(&this_ptr_conv);
5525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5526 LDKChannelDetails this_ptr_conv;
5527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5529 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5533 LDKChannelDetails 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 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5540 LDKChannelDetails this_ptr_conv;
5541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5543 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5547 LDKChannelDetails this_ptr_conv;
5548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5550 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5554 LDKChannelDetails this_ptr_conv;
5555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5557 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5561 LDKChannelDetails this_ptr_conv;
5562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5564 return ChannelDetails_get_is_live(&this_ptr_conv);
5567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5568 LDKChannelDetails this_ptr_conv;
5569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5571 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5575 LDKPaymentSendFailure this_ptr_conv;
5576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5578 return PaymentSendFailure_free(this_ptr_conv);
5581 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) {
5582 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5583 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5584 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5585 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5586 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5588 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5589 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5590 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5591 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5593 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5594 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5595 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5596 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5598 LDKLogger logger_conv = *(LDKLogger*)logger;
5599 if (logger_conv.free == LDKLogger_JCalls_free) {
5600 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5601 LDKLogger_JCalls_clone(logger_conv.this_arg);
5603 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5604 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5605 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5606 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5608 LDKUserConfig config_conv;
5609 config_conv.inner = (void*)(config & (~1));
5610 config_conv.is_owned = (config & 1) || (config == 0);
5611 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);
5612 DO_ASSERT(ret.is_owned);
5613 return ((long)ret.inner) | 1;
5616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
5617 LDKChannelManager this_arg_conv;
5618 this_arg_conv.inner = (void*)(this_arg & (~1));
5619 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5620 LDKPublicKey their_network_key_conv = *(LDKPublicKey*)their_network_key;
5621 FREE((void*)their_network_key);
5622 LDKUserConfig override_config_conv;
5623 override_config_conv.inner = (void*)(override_config & (~1));
5624 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5625 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5626 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_conv, channel_value_satoshis, push_msat, user_id, override_config_conv);
5630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5631 LDKChannelManager this_arg_conv;
5632 this_arg_conv.inner = (void*)(this_arg & (~1));
5633 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5634 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5635 *ret = ChannelManager_list_channels(&this_arg_conv);
5639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5640 LDKChannelManager this_arg_conv;
5641 this_arg_conv.inner = (void*)(this_arg & (~1));
5642 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5643 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5644 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5648 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5649 LDKChannelManager this_arg_conv;
5650 this_arg_conv.inner = (void*)(this_arg & (~1));
5651 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5652 unsigned char channel_id_arr[32];
5653 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5654 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5655 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5656 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5661 LDKChannelManager this_arg_conv;
5662 this_arg_conv.inner = (void*)(this_arg & (~1));
5663 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5664 unsigned char channel_id_arr[32];
5665 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5666 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5667 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5671 LDKChannelManager 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 ChannelManager_force_close_all_channels(&this_arg_conv);
5677 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) {
5678 LDKChannelManager 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 LDKRoute route_conv;
5682 route_conv.inner = (void*)(route & (~1));
5683 route_conv.is_owned = (route & 1) || (route == 0);
5684 LDKThirtyTwoBytes payment_hash_ref;
5685 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
5686 LDKThirtyTwoBytes payment_secret_ref;
5687 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5688 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5689 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
5693 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) {
5694 LDKChannelManager this_arg_conv;
5695 this_arg_conv.inner = (void*)(this_arg & (~1));
5696 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5697 unsigned char temporary_channel_id_arr[32];
5698 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
5699 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
5700 LDKOutPoint funding_txo_conv;
5701 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5702 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5703 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
5706 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) {
5707 LDKChannelManager this_arg_conv;
5708 this_arg_conv.inner = (void*)(this_arg & (~1));
5709 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5710 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
5712 LDKThirtyTwoBytes alias_ref;
5713 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
5714 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
5715 FREE((void*)addresses);
5716 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
5719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
5720 LDKChannelManager this_arg_conv;
5721 this_arg_conv.inner = (void*)(this_arg & (~1));
5722 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5723 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
5726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
5727 LDKChannelManager this_arg_conv;
5728 this_arg_conv.inner = (void*)(this_arg & (~1));
5729 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5730 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
5733 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) {
5734 LDKChannelManager 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 unsigned char payment_hash_arr[32];
5738 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
5739 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
5740 LDKThirtyTwoBytes payment_secret_ref;
5741 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5742 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
5745 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) {
5746 LDKChannelManager this_arg_conv;
5747 this_arg_conv.inner = (void*)(this_arg & (~1));
5748 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5749 LDKThirtyTwoBytes payment_preimage_ref;
5750 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
5751 LDKThirtyTwoBytes payment_secret_ref;
5752 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5753 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
5756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5757 LDKChannelManager this_arg_conv;
5758 this_arg_conv.inner = (void*)(this_arg & (~1));
5759 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5760 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5761 *ret = ChannelManager_get_our_node_id(&this_arg_conv);
5765 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) {
5766 LDKChannelManager this_arg_conv;
5767 this_arg_conv.inner = (void*)(this_arg & (~1));
5768 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5769 LDKOutPoint funding_txo_conv;
5770 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5771 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5772 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
5775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5776 LDKChannelManager this_arg_conv;
5777 this_arg_conv.inner = (void*)(this_arg & (~1));
5778 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5779 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
5780 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
5784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5785 LDKChannelManager this_arg_conv;
5786 this_arg_conv.inner = (void*)(this_arg & (~1));
5787 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5788 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5789 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
5793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5794 LDKChannelManager this_arg_conv;
5795 this_arg_conv.inner = (void*)(this_arg & (~1));
5796 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5797 unsigned char header_arr[80];
5798 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5799 unsigned char (*header_ref)[80] = &header_arr;
5800 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5801 FREE((void*)txdata);
5802 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
5806 LDKChannelManager this_arg_conv;
5807 this_arg_conv.inner = (void*)(this_arg & (~1));
5808 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5809 unsigned char header_arr[80];
5810 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5811 unsigned char (*header_ref)[80] = &header_arr;
5812 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
5815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
5816 LDKChannelManager this_arg_conv;
5817 this_arg_conv.inner = (void*)(this_arg & (~1));
5818 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5819 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
5820 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
5824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5825 LDKChannelManagerReadArgs this_ptr_conv;
5826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5828 return ChannelManagerReadArgs_free(this_ptr_conv);
5831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
5832 LDKChannelManagerReadArgs this_ptr_conv;
5833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5835 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
5839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5840 LDKChannelManagerReadArgs this_ptr_conv;
5841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5843 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
5844 if (val_conv.free == LDKKeysInterface_JCalls_free) {
5845 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5846 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
5848 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
5851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
5852 LDKChannelManagerReadArgs this_ptr_conv;
5853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5855 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
5859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5860 LDKChannelManagerReadArgs this_ptr_conv;
5861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5863 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
5864 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
5865 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5866 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
5868 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
5871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
5872 LDKChannelManagerReadArgs this_ptr_conv;
5873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5875 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
5879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5880 LDKChannelManagerReadArgs this_ptr_conv;
5881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5883 LDKWatch val_conv = *(LDKWatch*)val;
5884 if (val_conv.free == LDKWatch_JCalls_free) {
5885 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5886 LDKWatch_JCalls_clone(val_conv.this_arg);
5888 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
5891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
5892 LDKChannelManagerReadArgs this_ptr_conv;
5893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5895 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
5899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5900 LDKChannelManagerReadArgs this_ptr_conv;
5901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5903 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
5904 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
5905 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5906 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
5908 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
5911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
5912 LDKChannelManagerReadArgs this_ptr_conv;
5913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5915 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
5919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5920 LDKChannelManagerReadArgs this_ptr_conv;
5921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5923 LDKLogger val_conv = *(LDKLogger*)val;
5924 if (val_conv.free == LDKLogger_JCalls_free) {
5925 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5926 LDKLogger_JCalls_clone(val_conv.this_arg);
5928 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
5931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5932 LDKChannelManagerReadArgs this_ptr_conv;
5933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5935 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
5936 DO_ASSERT(ret.is_owned);
5937 return ((long)ret.inner) | 1;
5940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5941 LDKChannelManagerReadArgs this_ptr_conv;
5942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5944 LDKUserConfig val_conv;
5945 val_conv.inner = (void*)(val & (~1));
5946 val_conv.is_owned = (val & 1) || (val == 0);
5947 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
5950 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) {
5951 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5952 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5953 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5954 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5956 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5957 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5959 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5961 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5962 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5963 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5964 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5966 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5967 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5969 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5971 LDKLogger logger_conv = *(LDKLogger*)logger;
5972 if (logger_conv.free == LDKLogger_JCalls_free) {
5973 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5974 LDKLogger_JCalls_clone(logger_conv.this_arg);
5976 LDKUserConfig default_config_conv;
5977 default_config_conv.inner = (void*)(default_config & (~1));
5978 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
5979 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
5980 FREE((void*)channel_monitors);
5981 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
5982 DO_ASSERT(ret.is_owned);
5983 return ((long)ret.inner) | 1;
5986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5987 LDKDecodeError this_ptr_conv;
5988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5990 return DecodeError_free(this_ptr_conv);
5993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5994 LDKInit this_ptr_conv;
5995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5997 return Init_free(this_ptr_conv);
6000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6001 LDKErrorMessage this_ptr_conv;
6002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6004 return ErrorMessage_free(this_ptr_conv);
6007 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6008 LDKErrorMessage this_ptr_conv;
6009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6011 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6012 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6017 LDKErrorMessage this_ptr_conv;
6018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6020 LDKThirtyTwoBytes val_ref;
6021 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6022 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6026 LDKErrorMessage this_ptr_conv;
6027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6029 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6030 *ret = ErrorMessage_get_data(&this_ptr_conv);
6034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6035 LDKErrorMessage this_ptr_conv;
6036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6038 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6040 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6044 LDKThirtyTwoBytes channel_id_arg_ref;
6045 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6046 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6047 FREE((void*)data_arg);
6048 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6049 DO_ASSERT(ret.is_owned);
6050 return ((long)ret.inner) | 1;
6053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6054 LDKPing this_ptr_conv;
6055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6057 return Ping_free(this_ptr_conv);
6060 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6061 LDKPing this_ptr_conv;
6062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6064 return Ping_get_ponglen(&this_ptr_conv);
6067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6068 LDKPing this_ptr_conv;
6069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6071 return Ping_set_ponglen(&this_ptr_conv, val);
6074 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6075 LDKPing this_ptr_conv;
6076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6078 return Ping_get_byteslen(&this_ptr_conv);
6081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6082 LDKPing this_ptr_conv;
6083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6085 return Ping_set_byteslen(&this_ptr_conv, val);
6088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6089 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6090 DO_ASSERT(ret.is_owned);
6091 return ((long)ret.inner) | 1;
6094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6095 LDKPong this_ptr_conv;
6096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6098 return Pong_free(this_ptr_conv);
6101 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6102 LDKPong this_ptr_conv;
6103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6105 return Pong_get_byteslen(&this_ptr_conv);
6108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6109 LDKPong this_ptr_conv;
6110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6112 return Pong_set_byteslen(&this_ptr_conv, val);
6115 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6116 LDKPong ret = Pong_new(byteslen_arg);
6117 DO_ASSERT(ret.is_owned);
6118 return ((long)ret.inner) | 1;
6121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6122 LDKOpenChannel this_ptr_conv;
6123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6125 return OpenChannel_free(this_ptr_conv);
6128 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6129 LDKOpenChannel this_ptr_conv;
6130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6132 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6133 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6138 LDKOpenChannel this_ptr_conv;
6139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6141 LDKThirtyTwoBytes val_ref;
6142 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6143 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6146 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6147 LDKOpenChannel this_ptr_conv;
6148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6150 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6151 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6156 LDKOpenChannel this_ptr_conv;
6157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6159 LDKThirtyTwoBytes val_ref;
6160 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6161 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6165 LDKOpenChannel this_ptr_conv;
6166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6168 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6172 LDKOpenChannel this_ptr_conv;
6173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6175 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6179 LDKOpenChannel this_ptr_conv;
6180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6182 return OpenChannel_get_push_msat(&this_ptr_conv);
6185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6186 LDKOpenChannel 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 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6193 LDKOpenChannel this_ptr_conv;
6194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6196 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6200 LDKOpenChannel this_ptr_conv;
6201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6203 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6207 LDKOpenChannel this_ptr_conv;
6208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6210 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6213 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) {
6214 LDKOpenChannel this_ptr_conv;
6215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6217 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6221 LDKOpenChannel this_ptr_conv;
6222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6224 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6228 LDKOpenChannel this_ptr_conv;
6229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6231 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6235 LDKOpenChannel this_ptr_conv;
6236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6238 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6242 LDKOpenChannel this_ptr_conv;
6243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6245 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6248 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6249 LDKOpenChannel this_ptr_conv;
6250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6252 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6256 LDKOpenChannel this_ptr_conv;
6257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6259 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6262 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6263 LDKOpenChannel this_ptr_conv;
6264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6266 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6270 LDKOpenChannel this_ptr_conv;
6271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6273 return OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6276 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6277 LDKOpenChannel this_ptr_conv;
6278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6280 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6284 LDKOpenChannel this_ptr_conv;
6285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6287 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6291 LDKOpenChannel this_ptr_conv;
6292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6294 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6295 *ret = OpenChannel_get_funding_pubkey(&this_ptr_conv);
6299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6300 LDKOpenChannel this_ptr_conv;
6301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6303 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6305 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_conv);
6308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6309 LDKOpenChannel this_ptr_conv;
6310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6312 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6313 *ret = OpenChannel_get_revocation_basepoint(&this_ptr_conv);
6317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6318 LDKOpenChannel this_ptr_conv;
6319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6321 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6323 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_conv);
6326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6327 LDKOpenChannel this_ptr_conv;
6328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6330 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6331 *ret = OpenChannel_get_payment_point(&this_ptr_conv);
6335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6336 LDKOpenChannel this_ptr_conv;
6337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6339 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6341 return OpenChannel_set_payment_point(&this_ptr_conv, val_conv);
6344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6345 LDKOpenChannel this_ptr_conv;
6346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6348 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6349 *ret = OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv);
6353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6354 LDKOpenChannel this_ptr_conv;
6355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6357 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6359 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
6362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6363 LDKOpenChannel 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 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6367 *ret = OpenChannel_get_htlc_basepoint(&this_ptr_conv);
6371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6372 LDKOpenChannel 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 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6377 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_conv);
6380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6381 LDKOpenChannel this_ptr_conv;
6382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6384 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6385 *ret = OpenChannel_get_first_per_commitment_point(&this_ptr_conv);
6389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6390 LDKOpenChannel this_ptr_conv;
6391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6393 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6395 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_conv);
6398 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6399 LDKOpenChannel this_ptr_conv;
6400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6402 return OpenChannel_get_channel_flags(&this_ptr_conv);
6405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6406 LDKOpenChannel this_ptr_conv;
6407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6409 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6413 LDKAcceptChannel this_ptr_conv;
6414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6416 return AcceptChannel_free(this_ptr_conv);
6419 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6420 LDKAcceptChannel this_ptr_conv;
6421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6423 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6424 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6429 LDKAcceptChannel this_ptr_conv;
6430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6432 LDKThirtyTwoBytes val_ref;
6433 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6434 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6438 LDKAcceptChannel 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 AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6445 LDKAcceptChannel 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 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6452 LDKAcceptChannel this_ptr_conv;
6453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6455 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6458 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) {
6459 LDKAcceptChannel this_ptr_conv;
6460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6462 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6466 LDKAcceptChannel this_ptr_conv;
6467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6469 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6473 LDKAcceptChannel this_ptr_conv;
6474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6476 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6480 LDKAcceptChannel this_ptr_conv;
6481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6483 return AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6487 LDKAcceptChannel this_ptr_conv;
6488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6490 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6493 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6494 LDKAcceptChannel this_ptr_conv;
6495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6497 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6501 LDKAcceptChannel this_ptr_conv;
6502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6504 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6507 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6508 LDKAcceptChannel this_ptr_conv;
6509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6511 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6515 LDKAcceptChannel this_ptr_conv;
6516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6518 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6521 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6522 LDKAcceptChannel this_ptr_conv;
6523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6525 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6529 LDKAcceptChannel this_ptr_conv;
6530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6532 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6536 LDKAcceptChannel this_ptr_conv;
6537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6538 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6539 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6540 *ret = AcceptChannel_get_funding_pubkey(&this_ptr_conv);
6544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6545 LDKAcceptChannel 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 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6550 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_conv);
6553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6554 LDKAcceptChannel this_ptr_conv;
6555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6557 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6558 *ret = AcceptChannel_get_revocation_basepoint(&this_ptr_conv);
6562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6563 LDKAcceptChannel this_ptr_conv;
6564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6566 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6568 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_conv);
6571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6572 LDKAcceptChannel this_ptr_conv;
6573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6575 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6576 *ret = AcceptChannel_get_payment_point(&this_ptr_conv);
6580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6581 LDKAcceptChannel this_ptr_conv;
6582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6584 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6586 return AcceptChannel_set_payment_point(&this_ptr_conv, val_conv);
6589 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6590 LDKAcceptChannel this_ptr_conv;
6591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6593 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6594 *ret = AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv);
6598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6599 LDKAcceptChannel this_ptr_conv;
6600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6602 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6604 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
6607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6608 LDKAcceptChannel 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 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6612 *ret = AcceptChannel_get_htlc_basepoint(&this_ptr_conv);
6616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6617 LDKAcceptChannel this_ptr_conv;
6618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6620 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6622 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_conv);
6625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6626 LDKAcceptChannel this_ptr_conv;
6627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6629 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6630 *ret = AcceptChannel_get_first_per_commitment_point(&this_ptr_conv);
6634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6635 LDKAcceptChannel this_ptr_conv;
6636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6638 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6640 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_conv);
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6644 LDKFundingCreated this_ptr_conv;
6645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6647 return FundingCreated_free(this_ptr_conv);
6650 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6651 LDKFundingCreated this_ptr_conv;
6652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6654 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6655 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
6659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6660 LDKFundingCreated this_ptr_conv;
6661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6663 LDKThirtyTwoBytes val_ref;
6664 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6665 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
6668 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6669 LDKFundingCreated this_ptr_conv;
6670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6672 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6673 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
6677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6678 LDKFundingCreated this_ptr_conv;
6679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6681 LDKThirtyTwoBytes val_ref;
6682 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6683 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
6686 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6687 LDKFundingCreated this_ptr_conv;
6688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6690 return FundingCreated_get_funding_output_index(&this_ptr_conv);
6693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6694 LDKFundingCreated this_ptr_conv;
6695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6697 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
6700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6701 LDKFundingCreated this_ptr_conv;
6702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6704 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6705 *ret = FundingCreated_get_signature(&this_ptr_conv);
6709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6710 LDKFundingCreated this_ptr_conv;
6711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6713 LDKSignature val_conv = *(LDKSignature*)val;
6715 return FundingCreated_set_signature(&this_ptr_conv, val_conv);
6718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jbyteArray temporary_channel_id_arg, jbyteArray funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) {
6719 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
6720 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
6721 LDKThirtyTwoBytes funding_txid_arg_ref;
6722 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
6723 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6724 FREE((void*)signature_arg);
6725 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv);
6726 DO_ASSERT(ret.is_owned);
6727 return ((long)ret.inner) | 1;
6730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6731 LDKFundingSigned 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 return FundingSigned_free(this_ptr_conv);
6737 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6738 LDKFundingSigned this_ptr_conv;
6739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6741 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6742 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
6746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6747 LDKFundingSigned this_ptr_conv;
6748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6750 LDKThirtyTwoBytes val_ref;
6751 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6752 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
6755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6756 LDKFundingSigned this_ptr_conv;
6757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6759 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6760 *ret = FundingSigned_get_signature(&this_ptr_conv);
6764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6765 LDKFundingSigned this_ptr_conv;
6766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6768 LDKSignature val_conv = *(LDKSignature*)val;
6770 return FundingSigned_set_signature(&this_ptr_conv, val_conv);
6773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) {
6774 LDKThirtyTwoBytes channel_id_arg_ref;
6775 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6776 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6777 FREE((void*)signature_arg);
6778 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv);
6779 DO_ASSERT(ret.is_owned);
6780 return ((long)ret.inner) | 1;
6783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6784 LDKFundingLocked this_ptr_conv;
6785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6787 return FundingLocked_free(this_ptr_conv);
6790 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6791 LDKFundingLocked this_ptr_conv;
6792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6794 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6795 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
6799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6800 LDKFundingLocked this_ptr_conv;
6801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6803 LDKThirtyTwoBytes val_ref;
6804 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6805 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
6808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6809 LDKFundingLocked this_ptr_conv;
6810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6812 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6813 *ret = FundingLocked_get_next_per_commitment_point(&this_ptr_conv);
6817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6818 LDKFundingLocked this_ptr_conv;
6819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6821 LDKPublicKey val_conv = *(LDKPublicKey*)val;
6823 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_conv);
6826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong next_per_commitment_point_arg) {
6827 LDKThirtyTwoBytes channel_id_arg_ref;
6828 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6829 LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
6830 FREE((void*)next_per_commitment_point_arg);
6831 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_conv);
6832 DO_ASSERT(ret.is_owned);
6833 return ((long)ret.inner) | 1;
6836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6837 LDKShutdown this_ptr_conv;
6838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6840 return Shutdown_free(this_ptr_conv);
6843 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6844 LDKShutdown this_ptr_conv;
6845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6847 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6848 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
6852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6853 LDKShutdown this_ptr_conv;
6854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6856 LDKThirtyTwoBytes val_ref;
6857 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6858 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
6861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6862 LDKShutdown this_ptr_conv;
6863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6865 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
6866 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
6870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6871 LDKShutdown this_ptr_conv;
6872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6874 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6876 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
6879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
6880 LDKThirtyTwoBytes channel_id_arg_ref;
6881 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6882 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
6883 FREE((void*)scriptpubkey_arg);
6884 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
6885 DO_ASSERT(ret.is_owned);
6886 return ((long)ret.inner) | 1;
6889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6890 LDKClosingSigned this_ptr_conv;
6891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6893 return ClosingSigned_free(this_ptr_conv);
6896 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6897 LDKClosingSigned this_ptr_conv;
6898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6900 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6901 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
6905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6906 LDKClosingSigned this_ptr_conv;
6907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6909 LDKThirtyTwoBytes val_ref;
6910 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6911 return ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
6914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6915 LDKClosingSigned 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 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
6921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6922 LDKClosingSigned this_ptr_conv;
6923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6925 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
6928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6929 LDKClosingSigned this_ptr_conv;
6930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6932 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6933 *ret = ClosingSigned_get_signature(&this_ptr_conv);
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6938 LDKClosingSigned this_ptr_conv;
6939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6941 LDKSignature val_conv = *(LDKSignature*)val;
6943 return ClosingSigned_set_signature(&this_ptr_conv, val_conv);
6946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) {
6947 LDKThirtyTwoBytes channel_id_arg_ref;
6948 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6949 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6950 FREE((void*)signature_arg);
6951 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv);
6952 DO_ASSERT(ret.is_owned);
6953 return ((long)ret.inner) | 1;
6956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6957 LDKUpdateAddHTLC this_ptr_conv;
6958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6960 return UpdateAddHTLC_free(this_ptr_conv);
6963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6964 LDKUpdateAddHTLC this_ptr_conv;
6965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6967 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6968 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
6972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6973 LDKUpdateAddHTLC this_ptr_conv;
6974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6976 LDKThirtyTwoBytes val_ref;
6977 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6978 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
6981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6982 LDKUpdateAddHTLC this_ptr_conv;
6983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6985 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
6988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6989 LDKUpdateAddHTLC this_ptr_conv;
6990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6992 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
6995 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6996 LDKUpdateAddHTLC this_ptr_conv;
6997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6999 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7003 LDKUpdateAddHTLC this_ptr_conv;
7004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7006 return UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7009 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7010 LDKUpdateAddHTLC 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7014 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7019 LDKUpdateAddHTLC this_ptr_conv;
7020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7022 LDKThirtyTwoBytes val_ref;
7023 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7024 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7027 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7028 LDKUpdateAddHTLC this_ptr_conv;
7029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7031 return UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7035 LDKUpdateAddHTLC this_ptr_conv;
7036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7038 return UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7042 LDKUpdateFulfillHTLC this_ptr_conv;
7043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7045 return UpdateFulfillHTLC_free(this_ptr_conv);
7048 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7049 LDKUpdateFulfillHTLC this_ptr_conv;
7050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7052 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7053 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7058 LDKUpdateFulfillHTLC this_ptr_conv;
7059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7061 LDKThirtyTwoBytes val_ref;
7062 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7063 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7067 LDKUpdateFulfillHTLC this_ptr_conv;
7068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7070 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7074 LDKUpdateFulfillHTLC this_ptr_conv;
7075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7077 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7080 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7081 LDKUpdateFulfillHTLC this_ptr_conv;
7082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7084 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7085 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7090 LDKUpdateFulfillHTLC this_ptr_conv;
7091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7093 LDKThirtyTwoBytes val_ref;
7094 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7095 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7098 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) {
7099 LDKThirtyTwoBytes channel_id_arg_ref;
7100 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7101 LDKThirtyTwoBytes payment_preimage_arg_ref;
7102 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7103 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7104 DO_ASSERT(ret.is_owned);
7105 return ((long)ret.inner) | 1;
7108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7109 LDKUpdateFailHTLC this_ptr_conv;
7110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7112 return UpdateFailHTLC_free(this_ptr_conv);
7115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7116 LDKUpdateFailHTLC this_ptr_conv;
7117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7119 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7120 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7125 LDKUpdateFailHTLC this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7128 LDKThirtyTwoBytes val_ref;
7129 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7130 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7133 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7134 LDKUpdateFailHTLC this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7141 LDKUpdateFailHTLC this_ptr_conv;
7142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7144 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7148 LDKUpdateFailMalformedHTLC this_ptr_conv;
7149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7151 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7155 LDKUpdateFailMalformedHTLC this_ptr_conv;
7156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7158 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7159 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7164 LDKUpdateFailMalformedHTLC this_ptr_conv;
7165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7167 LDKThirtyTwoBytes val_ref;
7168 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7169 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7173 LDKUpdateFailMalformedHTLC this_ptr_conv;
7174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7176 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7180 LDKUpdateFailMalformedHTLC this_ptr_conv;
7181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7183 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7186 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7187 LDKUpdateFailMalformedHTLC this_ptr_conv;
7188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7190 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7194 LDKUpdateFailMalformedHTLC this_ptr_conv;
7195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7197 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7201 LDKCommitmentSigned this_ptr_conv;
7202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7204 return CommitmentSigned_free(this_ptr_conv);
7207 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7208 LDKCommitmentSigned this_ptr_conv;
7209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7211 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7212 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7217 LDKCommitmentSigned this_ptr_conv;
7218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7220 LDKThirtyTwoBytes val_ref;
7221 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7222 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7225 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7226 LDKCommitmentSigned this_ptr_conv;
7227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7229 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7230 *ret = CommitmentSigned_get_signature(&this_ptr_conv);
7234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7235 LDKCommitmentSigned this_ptr_conv;
7236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7238 LDKSignature val_conv = *(LDKSignature*)val;
7240 return CommitmentSigned_set_signature(&this_ptr_conv, val_conv);
7243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7244 LDKCommitmentSigned this_ptr_conv;
7245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7247 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7249 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) {
7253 LDKThirtyTwoBytes channel_id_arg_ref;
7254 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7255 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7256 FREE((void*)signature_arg);
7257 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7258 FREE((void*)htlc_signatures_arg);
7259 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv);
7260 DO_ASSERT(ret.is_owned);
7261 return ((long)ret.inner) | 1;
7264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7265 LDKRevokeAndACK this_ptr_conv;
7266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7268 return RevokeAndACK_free(this_ptr_conv);
7271 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7272 LDKRevokeAndACK 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7276 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7281 LDKRevokeAndACK 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 LDKThirtyTwoBytes val_ref;
7285 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7286 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7289 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7290 LDKRevokeAndACK this_ptr_conv;
7291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7293 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7294 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7299 LDKRevokeAndACK this_ptr_conv;
7300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7302 LDKThirtyTwoBytes val_ref;
7303 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7304 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7308 LDKRevokeAndACK this_ptr_conv;
7309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7311 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7312 *ret = RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv);
7316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7317 LDKRevokeAndACK this_ptr_conv;
7318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7320 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7322 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_conv);
7325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray per_commitment_secret_arg, jlong next_per_commitment_point_arg) {
7326 LDKThirtyTwoBytes channel_id_arg_ref;
7327 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7328 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7329 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7330 LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
7331 FREE((void*)next_per_commitment_point_arg);
7332 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_conv);
7333 DO_ASSERT(ret.is_owned);
7334 return ((long)ret.inner) | 1;
7337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7338 LDKUpdateFee this_ptr_conv;
7339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7341 return UpdateFee_free(this_ptr_conv);
7344 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7345 LDKUpdateFee this_ptr_conv;
7346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7348 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7349 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7354 LDKUpdateFee this_ptr_conv;
7355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7357 LDKThirtyTwoBytes val_ref;
7358 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7359 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7362 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7363 LDKUpdateFee this_ptr_conv;
7364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7366 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7370 LDKUpdateFee this_ptr_conv;
7371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7373 return UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7377 LDKThirtyTwoBytes channel_id_arg_ref;
7378 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7379 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7380 DO_ASSERT(ret.is_owned);
7381 return ((long)ret.inner) | 1;
7384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7385 LDKDataLossProtect this_ptr_conv;
7386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7388 return DataLossProtect_free(this_ptr_conv);
7391 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7392 LDKDataLossProtect this_ptr_conv;
7393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7395 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7396 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7401 LDKDataLossProtect this_ptr_conv;
7402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7404 LDKThirtyTwoBytes val_ref;
7405 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7406 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7410 LDKDataLossProtect this_ptr_conv;
7411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7413 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7414 *ret = DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv);
7418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7419 LDKDataLossProtect 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 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7424 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_conv);
7427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jbyteArray your_last_per_commitment_secret_arg, jlong my_current_per_commitment_point_arg) {
7428 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7429 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7430 LDKPublicKey my_current_per_commitment_point_arg_conv = *(LDKPublicKey*)my_current_per_commitment_point_arg;
7431 FREE((void*)my_current_per_commitment_point_arg);
7432 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_conv);
7433 DO_ASSERT(ret.is_owned);
7434 return ((long)ret.inner) | 1;
7437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7438 LDKChannelReestablish this_ptr_conv;
7439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7441 return ChannelReestablish_free(this_ptr_conv);
7444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7445 LDKChannelReestablish this_ptr_conv;
7446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7448 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7449 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7454 LDKChannelReestablish this_ptr_conv;
7455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7457 LDKThirtyTwoBytes val_ref;
7458 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7459 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7463 LDKChannelReestablish this_ptr_conv;
7464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7466 return ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7470 LDKChannelReestablish this_ptr_conv;
7471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7473 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7477 LDKChannelReestablish this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7480 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7484 LDKChannelReestablish this_ptr_conv;
7485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7487 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
7490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7491 LDKAnnouncementSignatures this_ptr_conv;
7492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7494 return AnnouncementSignatures_free(this_ptr_conv);
7497 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7498 LDKAnnouncementSignatures this_ptr_conv;
7499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7501 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7502 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
7506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7507 LDKAnnouncementSignatures 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 LDKThirtyTwoBytes val_ref;
7511 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7512 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
7515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7516 LDKAnnouncementSignatures this_ptr_conv;
7517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7519 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
7522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7523 LDKAnnouncementSignatures this_ptr_conv;
7524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7526 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
7529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7530 LDKAnnouncementSignatures 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7534 *ret = AnnouncementSignatures_get_node_signature(&this_ptr_conv);
7538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7539 LDKAnnouncementSignatures this_ptr_conv;
7540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7542 LDKSignature val_conv = *(LDKSignature*)val;
7544 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_conv);
7547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7548 LDKAnnouncementSignatures this_ptr_conv;
7549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7551 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7552 *ret = AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv);
7556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7557 LDKAnnouncementSignatures this_ptr_conv;
7558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7560 LDKSignature val_conv = *(LDKSignature*)val;
7562 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_conv);
7565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) {
7566 LDKThirtyTwoBytes channel_id_arg_ref;
7567 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7568 LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
7569 FREE((void*)node_signature_arg);
7570 LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
7571 FREE((void*)bitcoin_signature_arg);
7572 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
7573 DO_ASSERT(ret.is_owned);
7574 return ((long)ret.inner) | 1;
7577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7578 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
7579 FREE((void*)this_ptr);
7580 return NetAddress_free(this_ptr_conv);
7583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7584 LDKUnsignedNodeAnnouncement this_ptr_conv;
7585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7587 return UnsignedNodeAnnouncement_free(this_ptr_conv);
7590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7591 LDKUnsignedNodeAnnouncement this_ptr_conv;
7592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7594 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
7595 DO_ASSERT(ret.is_owned);
7596 return ((long)ret.inner) | 1;
7599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7600 LDKUnsignedNodeAnnouncement this_ptr_conv;
7601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7603 LDKNodeFeatures val_conv;
7604 val_conv.inner = (void*)(val & (~1));
7605 val_conv.is_owned = (val & 1) || (val == 0);
7606 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
7609 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
7610 LDKUnsignedNodeAnnouncement this_ptr_conv;
7611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7613 return UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
7616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7617 LDKUnsignedNodeAnnouncement this_ptr_conv;
7618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7620 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
7623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7624 LDKUnsignedNodeAnnouncement this_ptr_conv;
7625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7627 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7628 *ret = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
7632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7633 LDKUnsignedNodeAnnouncement 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 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7638 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
7641 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
7642 LDKUnsignedNodeAnnouncement this_ptr_conv;
7643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7644 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7645 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
7646 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
7650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7651 LDKUnsignedNodeAnnouncement this_ptr_conv;
7652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7654 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
7656 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
7659 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
7660 LDKUnsignedNodeAnnouncement this_ptr_conv;
7661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7663 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7664 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
7668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7669 LDKUnsignedNodeAnnouncement this_ptr_conv;
7670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7672 LDKThirtyTwoBytes val_ref;
7673 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7674 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
7677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7678 LDKUnsignedNodeAnnouncement this_ptr_conv;
7679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7681 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
7683 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
7686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7687 LDKNodeAnnouncement this_ptr_conv;
7688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7690 return NodeAnnouncement_free(this_ptr_conv);
7693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7694 LDKNodeAnnouncement this_ptr_conv;
7695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7697 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7698 *ret = NodeAnnouncement_get_signature(&this_ptr_conv);
7702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7703 LDKNodeAnnouncement this_ptr_conv;
7704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7706 LDKSignature val_conv = *(LDKSignature*)val;
7708 return NodeAnnouncement_set_signature(&this_ptr_conv, val_conv);
7711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
7712 LDKNodeAnnouncement this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
7716 DO_ASSERT(ret.is_owned);
7717 return ((long)ret.inner) | 1;
7720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7721 LDKNodeAnnouncement this_ptr_conv;
7722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7724 LDKUnsignedNodeAnnouncement val_conv;
7725 val_conv.inner = (void*)(val & (~1));
7726 val_conv.is_owned = (val & 1) || (val == 0);
7727 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
7730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
7731 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7732 FREE((void*)signature_arg);
7733 LDKUnsignedNodeAnnouncement contents_arg_conv;
7734 contents_arg_conv.inner = (void*)(contents_arg & (~1));
7735 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
7736 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
7737 DO_ASSERT(ret.is_owned);
7738 return ((long)ret.inner) | 1;
7741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7742 LDKUnsignedChannelAnnouncement this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7745 return UnsignedChannelAnnouncement_free(this_ptr_conv);
7748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7749 LDKUnsignedChannelAnnouncement this_ptr_conv;
7750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7752 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
7753 DO_ASSERT(ret.is_owned);
7754 return ((long)ret.inner) | 1;
7757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7758 LDKUnsignedChannelAnnouncement this_ptr_conv;
7759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7761 LDKChannelFeatures val_conv;
7762 val_conv.inner = (void*)(val & (~1));
7763 val_conv.is_owned = (val & 1) || (val == 0);
7764 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
7767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7768 LDKUnsignedChannelAnnouncement this_ptr_conv;
7769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7771 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7772 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
7776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7777 LDKUnsignedChannelAnnouncement this_ptr_conv;
7778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7780 LDKThirtyTwoBytes val_ref;
7781 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7782 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
7785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7786 LDKUnsignedChannelAnnouncement this_ptr_conv;
7787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7789 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
7792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7793 LDKUnsignedChannelAnnouncement this_ptr_conv;
7794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7796 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
7799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7800 LDKUnsignedChannelAnnouncement this_ptr_conv;
7801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7803 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7804 *ret = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
7808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7809 LDKUnsignedChannelAnnouncement this_ptr_conv;
7810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7812 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7814 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
7817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7818 LDKUnsignedChannelAnnouncement this_ptr_conv;
7819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7821 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7822 *ret = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
7826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7827 LDKUnsignedChannelAnnouncement this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7830 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7832 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
7835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7836 LDKUnsignedChannelAnnouncement this_ptr_conv;
7837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7839 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7840 *ret = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
7844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7845 LDKUnsignedChannelAnnouncement this_ptr_conv;
7846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7848 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7850 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
7853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7854 LDKUnsignedChannelAnnouncement this_ptr_conv;
7855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7857 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7858 *ret = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
7862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7863 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_conv = *(LDKPublicKey*)val;
7868 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
7871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7872 LDKChannelAnnouncement this_ptr_conv;
7873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7875 return ChannelAnnouncement_free(this_ptr_conv);
7878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7879 LDKChannelAnnouncement this_ptr_conv;
7880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7882 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7883 *ret = ChannelAnnouncement_get_node_signature_1(&this_ptr_conv);
7887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7888 LDKChannelAnnouncement this_ptr_conv;
7889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7891 LDKSignature val_conv = *(LDKSignature*)val;
7893 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_conv);
7896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7897 LDKChannelAnnouncement this_ptr_conv;
7898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7900 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7901 *ret = ChannelAnnouncement_get_node_signature_2(&this_ptr_conv);
7905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7906 LDKChannelAnnouncement this_ptr_conv;
7907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7909 LDKSignature val_conv = *(LDKSignature*)val;
7911 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_conv);
7914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
7915 LDKChannelAnnouncement this_ptr_conv;
7916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7918 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7919 *ret = ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv);
7923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7924 LDKChannelAnnouncement this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 LDKSignature val_conv = *(LDKSignature*)val;
7929 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_conv);
7932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
7933 LDKChannelAnnouncement this_ptr_conv;
7934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7936 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7937 *ret = ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv);
7941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7942 LDKChannelAnnouncement this_ptr_conv;
7943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7945 LDKSignature val_conv = *(LDKSignature*)val;
7947 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_conv);
7950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
7951 LDKChannelAnnouncement this_ptr_conv;
7952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7954 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
7955 DO_ASSERT(ret.is_owned);
7956 return ((long)ret.inner) | 1;
7959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7960 LDKChannelAnnouncement this_ptr_conv;
7961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7963 LDKUnsignedChannelAnnouncement val_conv;
7964 val_conv.inner = (void*)(val & (~1));
7965 val_conv.is_owned = (val & 1) || (val == 0);
7966 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
7969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jlong node_signature_1_arg, jlong node_signature_2_arg, jlong bitcoin_signature_1_arg, jlong bitcoin_signature_2_arg, jlong contents_arg) {
7970 LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
7971 FREE((void*)node_signature_1_arg);
7972 LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
7973 FREE((void*)node_signature_2_arg);
7974 LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
7975 FREE((void*)bitcoin_signature_1_arg);
7976 LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
7977 FREE((void*)bitcoin_signature_2_arg);
7978 LDKUnsignedChannelAnnouncement contents_arg_conv;
7979 contents_arg_conv.inner = (void*)(contents_arg & (~1));
7980 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
7981 LDKChannelAnnouncement ret = ChannelAnnouncement_new(node_signature_1_arg_conv, node_signature_2_arg_conv, bitcoin_signature_1_arg_conv, bitcoin_signature_2_arg_conv, contents_arg_conv);
7982 DO_ASSERT(ret.is_owned);
7983 return ((long)ret.inner) | 1;
7986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7987 LDKUnsignedChannelUpdate this_ptr_conv;
7988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7990 return UnsignedChannelUpdate_free(this_ptr_conv);
7993 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7994 LDKUnsignedChannelUpdate this_ptr_conv;
7995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7997 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7998 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8003 LDKUnsignedChannelUpdate this_ptr_conv;
8004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8006 LDKThirtyTwoBytes val_ref;
8007 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8008 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8012 LDKUnsignedChannelUpdate this_ptr_conv;
8013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8015 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8019 LDKUnsignedChannelUpdate 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 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8025 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8026 LDKUnsignedChannelUpdate this_ptr_conv;
8027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8029 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8033 LDKUnsignedChannelUpdate this_ptr_conv;
8034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8036 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8039 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8040 LDKUnsignedChannelUpdate this_ptr_conv;
8041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8043 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8047 LDKUnsignedChannelUpdate this_ptr_conv;
8048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8050 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8053 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8054 LDKUnsignedChannelUpdate this_ptr_conv;
8055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8057 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8061 LDKUnsignedChannelUpdate 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 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8068 LDKUnsignedChannelUpdate this_ptr_conv;
8069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8071 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8075 LDKUnsignedChannelUpdate this_ptr_conv;
8076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8078 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8081 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8082 LDKUnsignedChannelUpdate this_ptr_conv;
8083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8085 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8089 LDKUnsignedChannelUpdate this_ptr_conv;
8090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8092 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8095 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8096 LDKUnsignedChannelUpdate this_ptr_conv;
8097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8099 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8103 LDKUnsignedChannelUpdate this_ptr_conv;
8104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8106 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8110 LDKChannelUpdate 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 ChannelUpdate_free(this_ptr_conv);
8116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8117 LDKChannelUpdate this_ptr_conv;
8118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8120 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8121 *ret = ChannelUpdate_get_signature(&this_ptr_conv);
8125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8126 LDKChannelUpdate this_ptr_conv;
8127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8129 LDKSignature val_conv = *(LDKSignature*)val;
8131 return ChannelUpdate_set_signature(&this_ptr_conv, val_conv);
8134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8135 LDKChannelUpdate this_ptr_conv;
8136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8138 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8139 DO_ASSERT(ret.is_owned);
8140 return ((long)ret.inner) | 1;
8143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8144 LDKChannelUpdate this_ptr_conv;
8145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8147 LDKUnsignedChannelUpdate val_conv;
8148 val_conv.inner = (void*)(val & (~1));
8149 val_conv.is_owned = (val & 1) || (val == 0);
8150 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8154 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8155 FREE((void*)signature_arg);
8156 LDKUnsignedChannelUpdate contents_arg_conv;
8157 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8158 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8159 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
8160 DO_ASSERT(ret.is_owned);
8161 return ((long)ret.inner) | 1;
8164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8165 LDKQueryChannelRange this_ptr_conv;
8166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8168 return QueryChannelRange_free(this_ptr_conv);
8171 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8172 LDKQueryChannelRange this_ptr_conv;
8173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8175 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8176 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8181 LDKQueryChannelRange this_ptr_conv;
8182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8184 LDKThirtyTwoBytes val_ref;
8185 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8186 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8189 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8190 LDKQueryChannelRange this_ptr_conv;
8191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8193 return QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8197 LDKQueryChannelRange this_ptr_conv;
8198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8199 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8200 return QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8203 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8204 LDKQueryChannelRange this_ptr_conv;
8205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8206 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8207 return QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8211 LDKQueryChannelRange this_ptr_conv;
8212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8214 return QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8217 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) {
8218 LDKThirtyTwoBytes chain_hash_arg_ref;
8219 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8220 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8221 DO_ASSERT(ret.is_owned);
8222 return ((long)ret.inner) | 1;
8225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8226 LDKReplyChannelRange this_ptr_conv;
8227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8229 return ReplyChannelRange_free(this_ptr_conv);
8232 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8233 LDKReplyChannelRange this_ptr_conv;
8234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8236 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8237 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8242 LDKReplyChannelRange this_ptr_conv;
8243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8245 LDKThirtyTwoBytes val_ref;
8246 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8247 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8250 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8251 LDKReplyChannelRange this_ptr_conv;
8252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8254 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8258 LDKReplyChannelRange this_ptr_conv;
8259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8261 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8264 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8265 LDKReplyChannelRange this_ptr_conv;
8266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8268 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8272 LDKReplyChannelRange this_ptr_conv;
8273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8275 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8279 LDKReplyChannelRange this_ptr_conv;
8280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8282 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8286 LDKReplyChannelRange this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8289 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8293 LDKReplyChannelRange this_ptr_conv;
8294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8296 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8298 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8301 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) {
8302 LDKThirtyTwoBytes chain_hash_arg_ref;
8303 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8304 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8305 FREE((void*)short_channel_ids_arg);
8306 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8307 DO_ASSERT(ret.is_owned);
8308 return ((long)ret.inner) | 1;
8311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8312 LDKQueryShortChannelIds 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 return QueryShortChannelIds_free(this_ptr_conv);
8318 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8319 LDKQueryShortChannelIds this_ptr_conv;
8320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8322 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8323 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8328 LDKQueryShortChannelIds this_ptr_conv;
8329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8331 LDKThirtyTwoBytes val_ref;
8332 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8333 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8337 LDKQueryShortChannelIds this_ptr_conv;
8338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8340 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8342 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8346 LDKThirtyTwoBytes chain_hash_arg_ref;
8347 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8348 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8349 FREE((void*)short_channel_ids_arg);
8350 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8351 DO_ASSERT(ret.is_owned);
8352 return ((long)ret.inner) | 1;
8355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8356 LDKReplyShortChannelIdsEnd this_ptr_conv;
8357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8359 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8362 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8363 LDKReplyShortChannelIdsEnd this_ptr_conv;
8364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8366 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8367 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
8371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8372 LDKReplyShortChannelIdsEnd this_ptr_conv;
8373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8375 LDKThirtyTwoBytes val_ref;
8376 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8377 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
8380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8381 LDKReplyShortChannelIdsEnd this_ptr_conv;
8382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8384 return ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
8387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8388 LDKReplyShortChannelIdsEnd this_ptr_conv;
8389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8391 return ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
8394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
8395 LDKThirtyTwoBytes chain_hash_arg_ref;
8396 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8397 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
8398 DO_ASSERT(ret.is_owned);
8399 return ((long)ret.inner) | 1;
8402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8403 LDKGossipTimestampFilter this_ptr_conv;
8404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8406 return GossipTimestampFilter_free(this_ptr_conv);
8409 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8410 LDKGossipTimestampFilter this_ptr_conv;
8411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8413 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8414 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
8418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8419 LDKGossipTimestampFilter this_ptr_conv;
8420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8422 LDKThirtyTwoBytes val_ref;
8423 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8424 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
8427 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8428 LDKGossipTimestampFilter this_ptr_conv;
8429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8431 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
8434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8435 LDKGossipTimestampFilter this_ptr_conv;
8436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8438 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
8441 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
8442 LDKGossipTimestampFilter this_ptr_conv;
8443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8445 return GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
8448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8449 LDKGossipTimestampFilter this_ptr_conv;
8450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8452 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
8455 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) {
8456 LDKThirtyTwoBytes chain_hash_arg_ref;
8457 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8458 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
8459 DO_ASSERT(ret.is_owned);
8460 return ((long)ret.inner) | 1;
8463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8464 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
8465 FREE((void*)this_ptr);
8466 return ErrorAction_free(this_ptr_conv);
8469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8470 LDKLightningError this_ptr_conv;
8471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8473 return LightningError_free(this_ptr_conv);
8476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
8477 LDKLightningError this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8480 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
8481 *ret = LightningError_get_err(&this_ptr_conv);
8485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8486 LDKLightningError this_ptr_conv;
8487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8489 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
8491 return LightningError_set_err(&this_ptr_conv, val_conv);
8494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
8495 LDKLightningError this_ptr_conv;
8496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8498 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
8499 *ret = LightningError_get_action(&this_ptr_conv);
8503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8504 LDKLightningError this_ptr_conv;
8505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8507 LDKErrorAction val_conv = *(LDKErrorAction*)val;
8509 return LightningError_set_action(&this_ptr_conv, val_conv);
8512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
8513 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
8514 FREE((void*)err_arg);
8515 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
8516 FREE((void*)action_arg);
8517 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
8518 DO_ASSERT(ret.is_owned);
8519 return ((long)ret.inner) | 1;
8522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8523 LDKCommitmentUpdate this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8526 return CommitmentUpdate_free(this_ptr_conv);
8529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8530 LDKCommitmentUpdate 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 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
8535 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
8538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8539 LDKCommitmentUpdate this_ptr_conv;
8540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8542 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
8544 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
8547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8548 LDKCommitmentUpdate this_ptr_conv;
8549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8551 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
8553 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
8556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8557 LDKCommitmentUpdate this_ptr_conv;
8558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8560 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
8562 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
8565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
8566 LDKCommitmentUpdate this_ptr_conv;
8567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8569 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
8570 DO_ASSERT(ret.is_owned);
8571 return ((long)ret.inner) | 1;
8574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8575 LDKCommitmentUpdate this_ptr_conv;
8576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8578 LDKUpdateFee val_conv;
8579 val_conv.inner = (void*)(val & (~1));
8580 val_conv.is_owned = (val & 1) || (val == 0);
8581 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
8584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
8585 LDKCommitmentUpdate this_ptr_conv;
8586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8588 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
8589 DO_ASSERT(ret.is_owned);
8590 return ((long)ret.inner) | 1;
8593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8594 LDKCommitmentUpdate this_ptr_conv;
8595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8597 LDKCommitmentSigned val_conv;
8598 val_conv.inner = (void*)(val & (~1));
8599 val_conv.is_owned = (val & 1) || (val == 0);
8600 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
8603 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) {
8604 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
8605 FREE((void*)update_add_htlcs_arg);
8606 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
8607 FREE((void*)update_fulfill_htlcs_arg);
8608 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
8609 FREE((void*)update_fail_htlcs_arg);
8610 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
8611 FREE((void*)update_fail_malformed_htlcs_arg);
8612 LDKUpdateFee update_fee_arg_conv;
8613 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
8614 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
8615 LDKCommitmentSigned commitment_signed_arg_conv;
8616 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
8617 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
8618 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);
8619 DO_ASSERT(ret.is_owned);
8620 return ((long)ret.inner) | 1;
8623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8624 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
8625 FREE((void*)this_ptr);
8626 return HTLCFailChannelUpdate_free(this_ptr_conv);
8629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8630 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
8631 FREE((void*)this_ptr);
8632 return ChannelMessageHandler_free(this_ptr_conv);
8635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8636 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
8637 FREE((void*)this_ptr);
8638 return RoutingMessageHandler_free(this_ptr_conv);
8641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8642 LDKAcceptChannel obj_conv;
8643 obj_conv.inner = (void*)(obj & (~1));
8644 obj_conv.is_owned = (obj & 1) || (obj == 0);
8645 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8646 *ret = AcceptChannel_write(&obj_conv);
8650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8651 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8652 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
8653 DO_ASSERT(ret.is_owned);
8654 return ((long)ret.inner) | 1;
8657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
8658 LDKAnnouncementSignatures obj_conv;
8659 obj_conv.inner = (void*)(obj & (~1));
8660 obj_conv.is_owned = (obj & 1) || (obj == 0);
8661 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8662 *ret = AnnouncementSignatures_write(&obj_conv);
8666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
8667 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8668 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
8669 DO_ASSERT(ret.is_owned);
8670 return ((long)ret.inner) | 1;
8673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
8674 LDKChannelReestablish obj_conv;
8675 obj_conv.inner = (void*)(obj & (~1));
8676 obj_conv.is_owned = (obj & 1) || (obj == 0);
8677 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8678 *ret = ChannelReestablish_write(&obj_conv);
8682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
8683 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8684 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
8685 DO_ASSERT(ret.is_owned);
8686 return ((long)ret.inner) | 1;
8689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8690 LDKClosingSigned obj_conv;
8691 obj_conv.inner = (void*)(obj & (~1));
8692 obj_conv.is_owned = (obj & 1) || (obj == 0);
8693 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8694 *ret = ClosingSigned_write(&obj_conv);
8698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8699 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8700 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
8701 DO_ASSERT(ret.is_owned);
8702 return ((long)ret.inner) | 1;
8705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8706 LDKCommitmentSigned obj_conv;
8707 obj_conv.inner = (void*)(obj & (~1));
8708 obj_conv.is_owned = (obj & 1) || (obj == 0);
8709 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8710 *ret = CommitmentSigned_write(&obj_conv);
8714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8715 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8716 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
8717 DO_ASSERT(ret.is_owned);
8718 return ((long)ret.inner) | 1;
8721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
8722 LDKFundingCreated obj_conv;
8723 obj_conv.inner = (void*)(obj & (~1));
8724 obj_conv.is_owned = (obj & 1) || (obj == 0);
8725 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8726 *ret = FundingCreated_write(&obj_conv);
8730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
8731 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8732 LDKFundingCreated ret = FundingCreated_read(ser_conv);
8733 DO_ASSERT(ret.is_owned);
8734 return ((long)ret.inner) | 1;
8737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
8738 LDKFundingSigned obj_conv;
8739 obj_conv.inner = (void*)(obj & (~1));
8740 obj_conv.is_owned = (obj & 1) || (obj == 0);
8741 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8742 *ret = FundingSigned_write(&obj_conv);
8746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
8747 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8748 LDKFundingSigned ret = FundingSigned_read(ser_conv);
8749 DO_ASSERT(ret.is_owned);
8750 return ((long)ret.inner) | 1;
8753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
8754 LDKFundingLocked obj_conv;
8755 obj_conv.inner = (void*)(obj & (~1));
8756 obj_conv.is_owned = (obj & 1) || (obj == 0);
8757 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8758 *ret = FundingLocked_write(&obj_conv);
8762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
8763 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8764 LDKFundingLocked ret = FundingLocked_read(ser_conv);
8765 DO_ASSERT(ret.is_owned);
8766 return ((long)ret.inner) | 1;
8769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
8771 obj_conv.inner = (void*)(obj & (~1));
8772 obj_conv.is_owned = (obj & 1) || (obj == 0);
8773 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8774 *ret = Init_write(&obj_conv);
8778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
8779 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8780 LDKInit ret = Init_read(ser_conv);
8781 DO_ASSERT(ret.is_owned);
8782 return ((long)ret.inner) | 1;
8785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
8786 LDKOpenChannel obj_conv;
8787 obj_conv.inner = (void*)(obj & (~1));
8788 obj_conv.is_owned = (obj & 1) || (obj == 0);
8789 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8790 *ret = OpenChannel_write(&obj_conv);
8794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
8795 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8796 LDKOpenChannel ret = OpenChannel_read(ser_conv);
8797 DO_ASSERT(ret.is_owned);
8798 return ((long)ret.inner) | 1;
8801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
8802 LDKRevokeAndACK obj_conv;
8803 obj_conv.inner = (void*)(obj & (~1));
8804 obj_conv.is_owned = (obj & 1) || (obj == 0);
8805 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8806 *ret = RevokeAndACK_write(&obj_conv);
8810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
8811 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8812 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
8813 DO_ASSERT(ret.is_owned);
8814 return ((long)ret.inner) | 1;
8817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
8818 LDKShutdown obj_conv;
8819 obj_conv.inner = (void*)(obj & (~1));
8820 obj_conv.is_owned = (obj & 1) || (obj == 0);
8821 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8822 *ret = Shutdown_write(&obj_conv);
8826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
8827 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8828 LDKShutdown ret = Shutdown_read(ser_conv);
8829 DO_ASSERT(ret.is_owned);
8830 return ((long)ret.inner) | 1;
8833 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8834 LDKUpdateFailHTLC obj_conv;
8835 obj_conv.inner = (void*)(obj & (~1));
8836 obj_conv.is_owned = (obj & 1) || (obj == 0);
8837 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8838 *ret = UpdateFailHTLC_write(&obj_conv);
8842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8843 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8844 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
8845 DO_ASSERT(ret.is_owned);
8846 return ((long)ret.inner) | 1;
8849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8850 LDKUpdateFailMalformedHTLC obj_conv;
8851 obj_conv.inner = (void*)(obj & (~1));
8852 obj_conv.is_owned = (obj & 1) || (obj == 0);
8853 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8854 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
8858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8859 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8860 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
8861 DO_ASSERT(ret.is_owned);
8862 return ((long)ret.inner) | 1;
8865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
8866 LDKUpdateFee obj_conv;
8867 obj_conv.inner = (void*)(obj & (~1));
8868 obj_conv.is_owned = (obj & 1) || (obj == 0);
8869 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8870 *ret = UpdateFee_write(&obj_conv);
8874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
8875 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8876 LDKUpdateFee ret = UpdateFee_read(ser_conv);
8877 DO_ASSERT(ret.is_owned);
8878 return ((long)ret.inner) | 1;
8881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8882 LDKUpdateFulfillHTLC obj_conv;
8883 obj_conv.inner = (void*)(obj & (~1));
8884 obj_conv.is_owned = (obj & 1) || (obj == 0);
8885 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8886 *ret = UpdateFulfillHTLC_write(&obj_conv);
8890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8891 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8892 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
8893 DO_ASSERT(ret.is_owned);
8894 return ((long)ret.inner) | 1;
8897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
8898 LDKUpdateAddHTLC obj_conv;
8899 obj_conv.inner = (void*)(obj & (~1));
8900 obj_conv.is_owned = (obj & 1) || (obj == 0);
8901 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8902 *ret = UpdateAddHTLC_write(&obj_conv);
8906 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
8907 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8908 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
8909 DO_ASSERT(ret.is_owned);
8910 return ((long)ret.inner) | 1;
8913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
8915 obj_conv.inner = (void*)(obj & (~1));
8916 obj_conv.is_owned = (obj & 1) || (obj == 0);
8917 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8918 *ret = Ping_write(&obj_conv);
8922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
8923 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8924 LDKPing ret = Ping_read(ser_conv);
8925 DO_ASSERT(ret.is_owned);
8926 return ((long)ret.inner) | 1;
8929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
8931 obj_conv.inner = (void*)(obj & (~1));
8932 obj_conv.is_owned = (obj & 1) || (obj == 0);
8933 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8934 *ret = Pong_write(&obj_conv);
8938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
8939 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8940 LDKPong ret = Pong_read(ser_conv);
8941 DO_ASSERT(ret.is_owned);
8942 return ((long)ret.inner) | 1;
8945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8946 LDKUnsignedChannelAnnouncement obj_conv;
8947 obj_conv.inner = (void*)(obj & (~1));
8948 obj_conv.is_owned = (obj & 1) || (obj == 0);
8949 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8950 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
8954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
8955 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8956 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
8957 DO_ASSERT(ret.is_owned);
8958 return ((long)ret.inner) | 1;
8961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
8962 LDKChannelAnnouncement obj_conv;
8963 obj_conv.inner = (void*)(obj & (~1));
8964 obj_conv.is_owned = (obj & 1) || (obj == 0);
8965 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8966 *ret = ChannelAnnouncement_write(&obj_conv);
8970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
8971 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8972 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
8973 DO_ASSERT(ret.is_owned);
8974 return ((long)ret.inner) | 1;
8977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8978 LDKUnsignedChannelUpdate obj_conv;
8979 obj_conv.inner = (void*)(obj & (~1));
8980 obj_conv.is_owned = (obj & 1) || (obj == 0);
8981 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8982 *ret = UnsignedChannelUpdate_write(&obj_conv);
8986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
8987 LDKu8slice ser_conv = *(LDKu8slice*)ser;
8988 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
8989 DO_ASSERT(ret.is_owned);
8990 return ((long)ret.inner) | 1;
8993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8994 LDKChannelUpdate obj_conv;
8995 obj_conv.inner = (void*)(obj & (~1));
8996 obj_conv.is_owned = (obj & 1) || (obj == 0);
8997 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8998 *ret = ChannelUpdate_write(&obj_conv);
9002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9003 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9004 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
9005 DO_ASSERT(ret.is_owned);
9006 return ((long)ret.inner) | 1;
9009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9010 LDKErrorMessage obj_conv;
9011 obj_conv.inner = (void*)(obj & (~1));
9012 obj_conv.is_owned = (obj & 1) || (obj == 0);
9013 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9014 *ret = ErrorMessage_write(&obj_conv);
9018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
9019 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9020 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
9021 DO_ASSERT(ret.is_owned);
9022 return ((long)ret.inner) | 1;
9025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9026 LDKUnsignedNodeAnnouncement obj_conv;
9027 obj_conv.inner = (void*)(obj & (~1));
9028 obj_conv.is_owned = (obj & 1) || (obj == 0);
9029 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9030 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9035 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9036 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
9037 DO_ASSERT(ret.is_owned);
9038 return ((long)ret.inner) | 1;
9041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9042 LDKNodeAnnouncement obj_conv;
9043 obj_conv.inner = (void*)(obj & (~1));
9044 obj_conv.is_owned = (obj & 1) || (obj == 0);
9045 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9046 *ret = NodeAnnouncement_write(&obj_conv);
9050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9051 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9052 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9053 DO_ASSERT(ret.is_owned);
9054 return ((long)ret.inner) | 1;
9057 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9058 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9059 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9060 DO_ASSERT(ret.is_owned);
9061 return ((long)ret.inner) | 1;
9064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9065 LDKQueryShortChannelIds obj_conv;
9066 obj_conv.inner = (void*)(obj & (~1));
9067 obj_conv.is_owned = (obj & 1) || (obj == 0);
9068 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9069 *ret = QueryShortChannelIds_write(&obj_conv);
9073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9074 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9075 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9076 DO_ASSERT(ret.is_owned);
9077 return ((long)ret.inner) | 1;
9080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9081 LDKReplyShortChannelIdsEnd obj_conv;
9082 obj_conv.inner = (void*)(obj & (~1));
9083 obj_conv.is_owned = (obj & 1) || (obj == 0);
9084 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9085 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9090 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9091 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9092 DO_ASSERT(ret.is_owned);
9093 return ((long)ret.inner) | 1;
9096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9097 LDKQueryChannelRange obj_conv;
9098 obj_conv.inner = (void*)(obj & (~1));
9099 obj_conv.is_owned = (obj & 1) || (obj == 0);
9100 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9101 *ret = QueryChannelRange_write(&obj_conv);
9105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9106 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9107 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9108 DO_ASSERT(ret.is_owned);
9109 return ((long)ret.inner) | 1;
9112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9113 LDKReplyChannelRange obj_conv;
9114 obj_conv.inner = (void*)(obj & (~1));
9115 obj_conv.is_owned = (obj & 1) || (obj == 0);
9116 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9117 *ret = ReplyChannelRange_write(&obj_conv);
9121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9122 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9123 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9124 DO_ASSERT(ret.is_owned);
9125 return ((long)ret.inner) | 1;
9128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9129 LDKGossipTimestampFilter obj_conv;
9130 obj_conv.inner = (void*)(obj & (~1));
9131 obj_conv.is_owned = (obj & 1) || (obj == 0);
9132 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9133 *ret = GossipTimestampFilter_write(&obj_conv);
9137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9138 LDKMessageHandler 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 return MessageHandler_free(this_ptr_conv);
9144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9145 LDKMessageHandler this_ptr_conv;
9146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9148 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9153 LDKMessageHandler this_ptr_conv;
9154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9156 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9157 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9158 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9159 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9161 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9165 LDKMessageHandler 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 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9173 LDKMessageHandler this_ptr_conv;
9174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9176 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9177 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9179 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9181 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9185 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9186 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9187 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9188 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9190 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9191 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9192 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9193 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9195 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9196 DO_ASSERT(ret.is_owned);
9197 return ((long)ret.inner) | 1;
9200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9201 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9202 FREE((void*)this_ptr);
9203 return SocketDescriptor_free(this_ptr_conv);
9206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9207 LDKPeerHandleError 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 return PeerHandleError_free(this_ptr_conv);
9213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9214 LDKPeerHandleError this_ptr_conv;
9215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9217 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9221 LDKPeerHandleError this_ptr_conv;
9222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9224 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9228 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9229 DO_ASSERT(ret.is_owned);
9230 return ((long)ret.inner) | 1;
9233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9234 LDKPeerManager this_ptr_conv;
9235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9237 return PeerManager_free(this_ptr_conv);
9240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
9241 LDKMessageHandler message_handler_conv;
9242 message_handler_conv.inner = (void*)(message_handler & (~1));
9243 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9244 LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
9245 FREE((void*)our_node_secret);
9246 unsigned char ephemeral_random_data_arr[32];
9247 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9248 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9249 LDKLogger logger_conv = *(LDKLogger*)logger;
9250 if (logger_conv.free == LDKLogger_JCalls_free) {
9251 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9252 LDKLogger_JCalls_clone(logger_conv.this_arg);
9254 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
9255 DO_ASSERT(ret.is_owned);
9256 return ((long)ret.inner) | 1;
9259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9260 LDKPeerManager this_arg_conv;
9261 this_arg_conv.inner = (void*)(this_arg & (~1));
9262 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9263 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9264 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_node_id, jlong descriptor) {
9269 LDKPeerManager this_arg_conv;
9270 this_arg_conv.inner = (void*)(this_arg & (~1));
9271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9272 LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
9273 FREE((void*)their_node_id);
9274 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9275 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9276 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9277 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9279 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9280 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_conv, descriptor_conv);
9284 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9285 LDKPeerManager this_arg_conv;
9286 this_arg_conv.inner = (void*)(this_arg & (~1));
9287 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9288 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9289 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9291 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9293 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9294 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9299 LDKPeerManager this_arg_conv;
9300 this_arg_conv.inner = (void*)(this_arg & (~1));
9301 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9302 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9303 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9304 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9309 LDKPeerManager this_arg_conv;
9310 this_arg_conv.inner = (void*)(this_arg & (~1));
9311 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9312 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9313 LDKu8slice data_conv = *(LDKu8slice*)data;
9314 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9315 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9320 LDKPeerManager this_arg_conv;
9321 this_arg_conv.inner = (void*)(this_arg & (~1));
9322 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9323 return PeerManager_process_events(&this_arg_conv);
9326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9327 LDKPeerManager this_arg_conv;
9328 this_arg_conv.inner = (void*)(this_arg & (~1));
9329 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9330 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9331 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9335 LDKPeerManager this_arg_conv;
9336 this_arg_conv.inner = (void*)(this_arg & (~1));
9337 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9338 return PeerManager_timer_tick_occured(&this_arg_conv);
9341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9342 unsigned char commitment_seed_arr[32];
9343 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9344 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9345 jbyteArray _arr = (*_env)->NewByteArray(_env, 32);
9346 (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jbyteArray base_secret) {
9351 LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
9352 FREE((void*)per_commitment_point);
9353 unsigned char base_secret_arr[32];
9354 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9355 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9356 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9357 *ret = derive_private_key(per_commitment_point_conv, base_secret_ref);
9361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong base_point) {
9362 LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
9363 FREE((void*)per_commitment_point);
9364 LDKPublicKey base_point_conv = *(LDKPublicKey*)base_point;
9365 FREE((void*)base_point);
9366 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9367 *ret = derive_public_key(per_commitment_point_conv, base_point_conv);
9371 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) {
9372 unsigned char per_commitment_secret_arr[32];
9373 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
9374 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
9375 unsigned char countersignatory_revocation_base_secret_arr[32];
9376 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
9377 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
9378 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9379 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
9383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong countersignatory_revocation_base_point) {
9384 LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
9385 FREE((void*)per_commitment_point);
9386 LDKPublicKey countersignatory_revocation_base_point_conv = *(LDKPublicKey*)countersignatory_revocation_base_point;
9387 FREE((void*)countersignatory_revocation_base_point);
9388 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9389 *ret = derive_public_revocation_key(per_commitment_point_conv, countersignatory_revocation_base_point_conv);
9393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9394 LDKTxCreationKeys this_ptr_conv;
9395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9397 return TxCreationKeys_free(this_ptr_conv);
9400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9401 LDKTxCreationKeys this_ptr_conv;
9402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9404 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9405 *ret = TxCreationKeys_get_per_commitment_point(&this_ptr_conv);
9409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9410 LDKTxCreationKeys this_ptr_conv;
9411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9413 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9415 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_conv);
9418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9419 LDKTxCreationKeys this_ptr_conv;
9420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9422 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9423 *ret = TxCreationKeys_get_revocation_key(&this_ptr_conv);
9427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9428 LDKTxCreationKeys this_ptr_conv;
9429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9431 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9433 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
9436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9437 LDKTxCreationKeys this_ptr_conv;
9438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9440 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9441 *ret = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
9445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9446 LDKTxCreationKeys this_ptr_conv;
9447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9449 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9451 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
9454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9455 LDKTxCreationKeys this_ptr_conv;
9456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9458 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9459 *ret = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
9463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9464 LDKTxCreationKeys this_ptr_conv;
9465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9467 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9469 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
9472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9473 LDKTxCreationKeys this_ptr_conv;
9474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9476 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9477 *ret = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
9481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9482 LDKTxCreationKeys this_ptr_conv;
9483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9485 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9487 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
9490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point_arg, jlong revocation_key_arg, jlong broadcaster_htlc_key_arg, jlong countersignatory_htlc_key_arg, jlong broadcaster_delayed_payment_key_arg) {
9491 LDKPublicKey per_commitment_point_arg_conv = *(LDKPublicKey*)per_commitment_point_arg;
9492 FREE((void*)per_commitment_point_arg);
9493 LDKPublicKey revocation_key_arg_conv = *(LDKPublicKey*)revocation_key_arg;
9494 FREE((void*)revocation_key_arg);
9495 LDKPublicKey broadcaster_htlc_key_arg_conv = *(LDKPublicKey*)broadcaster_htlc_key_arg;
9496 FREE((void*)broadcaster_htlc_key_arg);
9497 LDKPublicKey countersignatory_htlc_key_arg_conv = *(LDKPublicKey*)countersignatory_htlc_key_arg;
9498 FREE((void*)countersignatory_htlc_key_arg);
9499 LDKPublicKey broadcaster_delayed_payment_key_arg_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key_arg;
9500 FREE((void*)broadcaster_delayed_payment_key_arg);
9501 LDKTxCreationKeys ret = TxCreationKeys_new(per_commitment_point_arg_conv, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
9502 DO_ASSERT(ret.is_owned);
9503 return ((long)ret.inner) | 1;
9506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9507 LDKTxCreationKeys 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 = TxCreationKeys_write(&obj_conv);
9515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9516 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9517 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
9518 DO_ASSERT(ret.is_owned);
9519 return ((long)ret.inner) | 1;
9522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9523 LDKPreCalculatedTxCreationKeys this_ptr_conv;
9524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9526 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
9529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
9530 LDKTxCreationKeys keys_conv;
9531 keys_conv.inner = (void*)(keys & (~1));
9532 keys_conv.is_owned = (keys & 1) || (keys == 0);
9533 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
9534 DO_ASSERT(ret.is_owned);
9535 return ((long)ret.inner) | 1;
9538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
9539 LDKPreCalculatedTxCreationKeys this_arg_conv;
9540 this_arg_conv.inner = (void*)(this_arg & (~1));
9541 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9542 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
9543 DO_ASSERT(ret.is_owned);
9544 return ((long)ret.inner) | 1;
9547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
9548 LDKPreCalculatedTxCreationKeys this_arg_conv;
9549 this_arg_conv.inner = (void*)(this_arg & (~1));
9550 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9551 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9552 *ret = PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv);
9556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9557 LDKChannelPublicKeys this_ptr_conv;
9558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9560 return ChannelPublicKeys_free(this_ptr_conv);
9563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
9564 LDKChannelPublicKeys this_ptr_conv;
9565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9567 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9568 *ret = ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv);
9572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9573 LDKChannelPublicKeys this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9576 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9578 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_conv);
9581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9582 LDKChannelPublicKeys this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9585 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9586 *ret = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
9590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9591 LDKChannelPublicKeys this_ptr_conv;
9592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9594 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9596 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
9599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9600 LDKChannelPublicKeys this_ptr_conv;
9601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9603 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9604 *ret = ChannelPublicKeys_get_payment_point(&this_ptr_conv);
9608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9609 LDKChannelPublicKeys this_ptr_conv;
9610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9612 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9614 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_conv);
9617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9618 LDKChannelPublicKeys this_ptr_conv;
9619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9621 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9622 *ret = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
9626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9627 LDKChannelPublicKeys this_ptr_conv;
9628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9630 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9632 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
9635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9636 LDKChannelPublicKeys this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9639 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
9640 *ret = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
9644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9645 LDKChannelPublicKeys this_ptr_conv;
9646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9648 LDKPublicKey val_conv = *(LDKPublicKey*)val;
9650 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
9653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jlong funding_pubkey_arg, jlong revocation_basepoint_arg, jlong payment_point_arg, jlong delayed_payment_basepoint_arg, jlong htlc_basepoint_arg) {
9654 LDKPublicKey funding_pubkey_arg_conv = *(LDKPublicKey*)funding_pubkey_arg;
9655 FREE((void*)funding_pubkey_arg);
9656 LDKPublicKey revocation_basepoint_arg_conv = *(LDKPublicKey*)revocation_basepoint_arg;
9657 FREE((void*)revocation_basepoint_arg);
9658 LDKPublicKey payment_point_arg_conv = *(LDKPublicKey*)payment_point_arg;
9659 FREE((void*)payment_point_arg);
9660 LDKPublicKey delayed_payment_basepoint_arg_conv = *(LDKPublicKey*)delayed_payment_basepoint_arg;
9661 FREE((void*)delayed_payment_basepoint_arg);
9662 LDKPublicKey htlc_basepoint_arg_conv = *(LDKPublicKey*)htlc_basepoint_arg;
9663 FREE((void*)htlc_basepoint_arg);
9664 LDKChannelPublicKeys ret = ChannelPublicKeys_new(funding_pubkey_arg_conv, revocation_basepoint_arg_conv, payment_point_arg_conv, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
9665 DO_ASSERT(ret.is_owned);
9666 return ((long)ret.inner) | 1;
9669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9670 LDKChannelPublicKeys obj_conv;
9671 obj_conv.inner = (void*)(obj & (~1));
9672 obj_conv.is_owned = (obj & 1) || (obj == 0);
9673 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9674 *ret = ChannelPublicKeys_write(&obj_conv);
9678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9679 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9680 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
9681 DO_ASSERT(ret.is_owned);
9682 return ((long)ret.inner) | 1;
9685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong broadcaster_delayed_payment_base, jlong broadcaster_htlc_base, jlong countersignatory_revocation_base, jlong countersignatory_htlc_base) {
9686 LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
9687 FREE((void*)per_commitment_point);
9688 LDKPublicKey broadcaster_delayed_payment_base_conv = *(LDKPublicKey*)broadcaster_delayed_payment_base;
9689 FREE((void*)broadcaster_delayed_payment_base);
9690 LDKPublicKey broadcaster_htlc_base_conv = *(LDKPublicKey*)broadcaster_htlc_base;
9691 FREE((void*)broadcaster_htlc_base);
9692 LDKPublicKey countersignatory_revocation_base_conv = *(LDKPublicKey*)countersignatory_revocation_base;
9693 FREE((void*)countersignatory_revocation_base);
9694 LDKPublicKey countersignatory_htlc_base_conv = *(LDKPublicKey*)countersignatory_htlc_base;
9695 FREE((void*)countersignatory_htlc_base);
9696 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
9697 *ret = TxCreationKeys_derive_new(per_commitment_point_conv, broadcaster_delayed_payment_base_conv, broadcaster_htlc_base_conv, countersignatory_revocation_base_conv, countersignatory_htlc_base_conv);
9701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jlong revocation_key, jshort contest_delay, jlong broadcaster_delayed_payment_key) {
9702 LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
9703 FREE((void*)revocation_key);
9704 LDKPublicKey broadcaster_delayed_payment_key_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key;
9705 FREE((void*)broadcaster_delayed_payment_key);
9706 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9707 *ret = get_revokeable_redeemscript(revocation_key_conv, contest_delay, broadcaster_delayed_payment_key_conv);
9711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9712 LDKHTLCOutputInCommitment this_ptr_conv;
9713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9715 return HTLCOutputInCommitment_free(this_ptr_conv);
9718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
9719 LDKHTLCOutputInCommitment this_ptr_conv;
9720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9722 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
9725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9726 LDKHTLCOutputInCommitment this_ptr_conv;
9727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9729 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
9732 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9733 LDKHTLCOutputInCommitment this_ptr_conv;
9734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9736 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
9739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9740 LDKHTLCOutputInCommitment this_ptr_conv;
9741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9743 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
9746 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9747 LDKHTLCOutputInCommitment this_ptr_conv;
9748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9750 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
9753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9754 LDKHTLCOutputInCommitment this_ptr_conv;
9755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9756 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9757 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
9760 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9761 LDKHTLCOutputInCommitment this_ptr_conv;
9762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9764 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9765 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
9769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9770 LDKHTLCOutputInCommitment this_ptr_conv;
9771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9773 LDKThirtyTwoBytes val_ref;
9774 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9775 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
9778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
9779 LDKHTLCOutputInCommitment obj_conv;
9780 obj_conv.inner = (void*)(obj & (~1));
9781 obj_conv.is_owned = (obj & 1) || (obj == 0);
9782 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9783 *ret = HTLCOutputInCommitment_write(&obj_conv);
9787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
9788 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9789 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
9790 DO_ASSERT(ret.is_owned);
9791 return ((long)ret.inner) | 1;
9794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
9795 LDKHTLCOutputInCommitment htlc_conv;
9796 htlc_conv.inner = (void*)(htlc & (~1));
9797 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9798 LDKTxCreationKeys keys_conv;
9799 keys_conv.inner = (void*)(keys & (~1));
9800 keys_conv.is_owned = (keys & 1) || (keys == 0);
9801 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9802 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
9806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jlong broadcaster, jlong countersignatory) {
9807 LDKPublicKey broadcaster_conv = *(LDKPublicKey*)broadcaster;
9808 FREE((void*)broadcaster);
9809 LDKPublicKey countersignatory_conv = *(LDKPublicKey*)countersignatory;
9810 FREE((void*)countersignatory);
9811 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9812 *ret = make_funding_redeemscript(broadcaster_conv, countersignatory_conv);
9816 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, jlong broadcaster_delayed_payment_key, jlong revocation_key) {
9817 unsigned char prev_hash_arr[32];
9818 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
9819 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
9820 LDKHTLCOutputInCommitment htlc_conv;
9821 htlc_conv.inner = (void*)(htlc & (~1));
9822 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
9823 LDKPublicKey broadcaster_delayed_payment_key_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key;
9824 FREE((void*)broadcaster_delayed_payment_key);
9825 LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
9826 FREE((void*)revocation_key);
9827 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9828 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_conv, revocation_key_conv);
9832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9833 LDKHolderCommitmentTransaction this_ptr_conv;
9834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9836 return HolderCommitmentTransaction_free(this_ptr_conv);
9839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
9840 LDKHolderCommitmentTransaction this_ptr_conv;
9841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9843 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
9844 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
9848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9849 LDKHolderCommitmentTransaction this_ptr_conv;
9850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9852 LDKTransaction val_conv = *(LDKTransaction*)val;
9854 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
9857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
9858 LDKHolderCommitmentTransaction this_ptr_conv;
9859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9861 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
9862 *ret = HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv);
9866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9867 LDKHolderCommitmentTransaction this_ptr_conv;
9868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9870 LDKSignature val_conv = *(LDKSignature*)val;
9872 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_conv);
9875 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9876 LDKHolderCommitmentTransaction this_ptr_conv;
9877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9879 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
9882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9883 LDKHolderCommitmentTransaction this_ptr_conv;
9884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9886 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
9889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9890 LDKHolderCommitmentTransaction this_ptr_conv;
9891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9893 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
9895 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
9898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jlong counterparty_sig, jlong holder_funding_key, jlong counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
9899 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
9900 FREE((void*)unsigned_tx);
9901 LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
9902 FREE((void*)counterparty_sig);
9903 LDKPublicKey holder_funding_key_conv = *(LDKPublicKey*)holder_funding_key;
9904 FREE((void*)holder_funding_key);
9905 LDKPublicKey counterparty_funding_key_conv = *(LDKPublicKey*)counterparty_funding_key;
9906 FREE((void*)counterparty_funding_key);
9907 LDKTxCreationKeys keys_conv;
9908 keys_conv.inner = (void*)(keys & (~1));
9909 keys_conv.is_owned = (keys & 1) || (keys == 0);
9910 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
9911 FREE((void*)htlc_data);
9912 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_conv, holder_funding_key_conv, counterparty_funding_key_conv, keys_conv, feerate_per_kw, htlc_data_conv);
9913 DO_ASSERT(ret.is_owned);
9914 return ((long)ret.inner) | 1;
9917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
9918 LDKHolderCommitmentTransaction this_arg_conv;
9919 this_arg_conv.inner = (void*)(this_arg & (~1));
9920 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9921 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
9922 DO_ASSERT(ret.is_owned);
9923 return ((long)ret.inner) | 1;
9926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
9927 LDKHolderCommitmentTransaction this_arg_conv;
9928 this_arg_conv.inner = (void*)(this_arg & (~1));
9929 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9930 jbyteArray _arr = (*_env)->NewByteArray(_env, 32);
9931 (*_env)->SetByteArrayRegion(_env, _arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
9935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) {
9936 LDKHolderCommitmentTransaction this_arg_conv;
9937 this_arg_conv.inner = (void*)(this_arg & (~1));
9938 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9939 unsigned char funding_key_arr[32];
9940 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
9941 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
9942 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
9943 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
9944 *ret = HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
9948 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) {
9949 LDKHolderCommitmentTransaction this_arg_conv;
9950 this_arg_conv.inner = (void*)(this_arg & (~1));
9951 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9952 unsigned char htlc_base_key_arr[32];
9953 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
9954 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
9955 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9956 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
9960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
9961 LDKHolderCommitmentTransaction obj_conv;
9962 obj_conv.inner = (void*)(obj & (~1));
9963 obj_conv.is_owned = (obj & 1) || (obj == 0);
9964 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9965 *ret = HolderCommitmentTransaction_write(&obj_conv);
9969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
9970 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9971 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
9972 DO_ASSERT(ret.is_owned);
9973 return ((long)ret.inner) | 1;
9976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9977 LDKInitFeatures this_ptr_conv;
9978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9980 return InitFeatures_free(this_ptr_conv);
9983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9984 LDKNodeFeatures this_ptr_conv;
9985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9987 return NodeFeatures_free(this_ptr_conv);
9990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9991 LDKChannelFeatures this_ptr_conv;
9992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9994 return ChannelFeatures_free(this_ptr_conv);
9997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9998 LDKRouteHop this_ptr_conv;
9999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10001 return RouteHop_free(this_ptr_conv);
10004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10005 LDKRouteHop this_ptr_conv;
10006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10008 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
10009 *ret = RouteHop_get_pubkey(&this_ptr_conv);
10013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10014 LDKRouteHop this_ptr_conv;
10015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10017 LDKPublicKey val_conv = *(LDKPublicKey*)val;
10019 return RouteHop_set_pubkey(&this_ptr_conv, val_conv);
10022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10023 LDKRouteHop this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10026 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
10027 DO_ASSERT(ret.is_owned);
10028 return ((long)ret.inner) | 1;
10031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10032 LDKRouteHop this_ptr_conv;
10033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10035 LDKNodeFeatures val_conv;
10036 val_conv.inner = (void*)(val & (~1));
10037 val_conv.is_owned = (val & 1) || (val == 0);
10038 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
10041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10042 LDKRouteHop 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 return RouteHop_get_short_channel_id(&this_ptr_conv);
10048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10049 LDKRouteHop this_ptr_conv;
10050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10052 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
10055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10056 LDKRouteHop this_ptr_conv;
10057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10059 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
10060 DO_ASSERT(ret.is_owned);
10061 return ((long)ret.inner) | 1;
10064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10065 LDKRouteHop this_ptr_conv;
10066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10068 LDKChannelFeatures val_conv;
10069 val_conv.inner = (void*)(val & (~1));
10070 val_conv.is_owned = (val & 1) || (val == 0);
10071 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10075 LDKRouteHop this_ptr_conv;
10076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10078 return RouteHop_get_fee_msat(&this_ptr_conv);
10081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10082 LDKRouteHop this_ptr_conv;
10083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10085 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10088 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10089 LDKRouteHop 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 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10096 LDKRouteHop this_ptr_conv;
10097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10099 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv * _env, jclass _b, jlong pubkey_arg, jlong node_features_arg, jlong short_channel_id_arg, jlong channel_features_arg, jlong fee_msat_arg, jint cltv_expiry_delta_arg) {
10103 LDKPublicKey pubkey_arg_conv = *(LDKPublicKey*)pubkey_arg;
10104 FREE((void*)pubkey_arg);
10105 LDKNodeFeatures node_features_arg_conv;
10106 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10107 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10108 LDKChannelFeatures channel_features_arg_conv;
10109 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10110 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10111 LDKRouteHop ret = RouteHop_new(pubkey_arg_conv, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
10112 DO_ASSERT(ret.is_owned);
10113 return ((long)ret.inner) | 1;
10116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10117 LDKRoute this_ptr_conv;
10118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10120 return Route_free(this_ptr_conv);
10123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10124 LDKRoute this_ptr_conv;
10125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10127 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10129 return Route_set_paths(&this_ptr_conv, val_conv);
10132 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10133 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10134 FREE((void*)paths_arg);
10135 LDKRoute ret = Route_new(paths_arg_conv);
10136 DO_ASSERT(ret.is_owned);
10137 return ((long)ret.inner) | 1;
10140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10142 obj_conv.inner = (void*)(obj & (~1));
10143 obj_conv.is_owned = (obj & 1) || (obj == 0);
10144 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10145 *ret = Route_write(&obj_conv);
10149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10150 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10151 LDKRoute ret = Route_read(ser_conv);
10152 DO_ASSERT(ret.is_owned);
10153 return ((long)ret.inner) | 1;
10156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10157 LDKRouteHint this_ptr_conv;
10158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10160 return RouteHint_free(this_ptr_conv);
10163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10164 LDKRouteHint this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10167 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
10168 *ret = RouteHint_get_src_node_id(&this_ptr_conv);
10172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10173 LDKRouteHint this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10176 LDKPublicKey val_conv = *(LDKPublicKey*)val;
10178 return RouteHint_set_src_node_id(&this_ptr_conv, val_conv);
10181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10182 LDKRouteHint this_ptr_conv;
10183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10185 return RouteHint_get_short_channel_id(&this_ptr_conv);
10188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10189 LDKRouteHint this_ptr_conv;
10190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10192 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10196 LDKRouteHint this_ptr_conv;
10197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10198 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10199 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10200 DO_ASSERT(ret.is_owned);
10201 return ((long)ret.inner) | 1;
10204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10205 LDKRouteHint this_ptr_conv;
10206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10208 LDKRoutingFees val_conv;
10209 val_conv.inner = (void*)(val & (~1));
10210 val_conv.is_owned = (val & 1) || (val == 0);
10211 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10214 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10215 LDKRouteHint this_ptr_conv;
10216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10218 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10222 LDKRouteHint this_ptr_conv;
10223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10225 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10229 LDKRouteHint this_ptr_conv;
10230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10232 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10236 LDKRouteHint this_ptr_conv;
10237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10239 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jlong src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
10243 LDKPublicKey src_node_id_arg_conv = *(LDKPublicKey*)src_node_id_arg;
10244 FREE((void*)src_node_id_arg);
10245 LDKRoutingFees fees_arg_conv;
10246 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10247 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10248 LDKRouteHint ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10249 DO_ASSERT(ret.is_owned);
10250 return ((long)ret.inner) | 1;
10253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jlong our_node_id, jlong network, jlong target, jlong first_hops, jlong last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
10254 LDKPublicKey our_node_id_conv = *(LDKPublicKey*)our_node_id;
10255 FREE((void*)our_node_id);
10256 LDKNetworkGraph network_conv;
10257 network_conv.inner = (void*)(network & (~1));
10258 network_conv.is_owned = (network & 1) || (network == 0);
10259 LDKPublicKey target_conv = *(LDKPublicKey*)target;
10260 FREE((void*)target);
10261 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10262 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10263 FREE((void*)last_hops);
10264 LDKLogger logger_conv = *(LDKLogger*)logger;
10265 if (logger_conv.free == LDKLogger_JCalls_free) {
10266 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10267 LDKLogger_JCalls_clone(logger_conv.this_arg);
10269 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10270 *ret = get_route(our_node_id_conv, &network_conv, target_conv, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10275 LDKNetworkGraph this_ptr_conv;
10276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10278 return NetworkGraph_free(this_ptr_conv);
10281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10282 LDKLockedNetworkGraph this_ptr_conv;
10283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10285 return LockedNetworkGraph_free(this_ptr_conv);
10288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10289 LDKNetGraphMsgHandler this_ptr_conv;
10290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10292 return NetGraphMsgHandler_free(this_ptr_conv);
10295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
10296 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10297 LDKLogger logger_conv = *(LDKLogger*)logger;
10298 if (logger_conv.free == LDKLogger_JCalls_free) {
10299 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10300 LDKLogger_JCalls_clone(logger_conv.this_arg);
10302 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
10303 DO_ASSERT(ret.is_owned);
10304 return ((long)ret.inner) | 1;
10307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
10308 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10309 LDKLogger logger_conv = *(LDKLogger*)logger;
10310 if (logger_conv.free == LDKLogger_JCalls_free) {
10311 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10312 LDKLogger_JCalls_clone(logger_conv.this_arg);
10314 LDKNetworkGraph network_graph_conv;
10315 network_graph_conv.inner = (void*)(network_graph & (~1));
10316 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
10317 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
10318 DO_ASSERT(ret.is_owned);
10319 return ((long)ret.inner) | 1;
10322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10323 LDKNetGraphMsgHandler this_arg_conv;
10324 this_arg_conv.inner = (void*)(this_arg & (~1));
10325 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10326 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
10327 DO_ASSERT(ret.is_owned);
10328 return ((long)ret.inner) | 1;
10331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10332 LDKLockedNetworkGraph this_arg_conv;
10333 this_arg_conv.inner = (void*)(this_arg & (~1));
10334 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10335 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
10336 DO_ASSERT(ret.is_owned);
10337 return ((long)ret.inner) | 1;
10340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
10341 LDKNetGraphMsgHandler this_arg_conv;
10342 this_arg_conv.inner = (void*)(this_arg & (~1));
10343 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10344 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10345 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
10349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10350 LDKDirectionalChannelInfo this_ptr_conv;
10351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10353 return DirectionalChannelInfo_free(this_ptr_conv);
10356 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10357 LDKDirectionalChannelInfo this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10360 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
10363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10364 LDKDirectionalChannelInfo this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10367 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
10370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
10371 LDKDirectionalChannelInfo this_ptr_conv;
10372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10374 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
10377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10378 LDKDirectionalChannelInfo this_ptr_conv;
10379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10381 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
10384 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10385 LDKDirectionalChannelInfo this_ptr_conv;
10386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10388 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
10391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10392 LDKDirectionalChannelInfo this_ptr_conv;
10393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10395 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
10398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10399 LDKDirectionalChannelInfo 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 DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
10405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10406 LDKDirectionalChannelInfo 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 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
10412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10413 LDKDirectionalChannelInfo 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 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
10417 DO_ASSERT(ret.is_owned);
10418 return ((long)ret.inner) | 1;
10421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10422 LDKDirectionalChannelInfo this_ptr_conv;
10423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10425 LDKChannelUpdate val_conv;
10426 val_conv.inner = (void*)(val & (~1));
10427 val_conv.is_owned = (val & 1) || (val == 0);
10428 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
10431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10432 LDKDirectionalChannelInfo obj_conv;
10433 obj_conv.inner = (void*)(obj & (~1));
10434 obj_conv.is_owned = (obj & 1) || (obj == 0);
10435 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10436 *ret = DirectionalChannelInfo_write(&obj_conv);
10440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10441 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10442 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
10443 DO_ASSERT(ret.is_owned);
10444 return ((long)ret.inner) | 1;
10447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10448 LDKChannelInfo this_ptr_conv;
10449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10451 return ChannelInfo_free(this_ptr_conv);
10454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10455 LDKChannelInfo this_ptr_conv;
10456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10458 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
10459 DO_ASSERT(ret.is_owned);
10460 return ((long)ret.inner) | 1;
10463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10464 LDKChannelInfo this_ptr_conv;
10465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10467 LDKChannelFeatures val_conv;
10468 val_conv.inner = (void*)(val & (~1));
10469 val_conv.is_owned = (val & 1) || (val == 0);
10470 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
10473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10474 LDKChannelInfo this_ptr_conv;
10475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10477 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
10478 *ret = ChannelInfo_get_node_one(&this_ptr_conv);
10482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10483 LDKChannelInfo this_ptr_conv;
10484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10486 LDKPublicKey val_conv = *(LDKPublicKey*)val;
10488 return ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
10491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10492 LDKChannelInfo this_ptr_conv;
10493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10495 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
10496 DO_ASSERT(ret.is_owned);
10497 return ((long)ret.inner) | 1;
10500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10501 LDKChannelInfo this_ptr_conv;
10502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10504 LDKDirectionalChannelInfo val_conv;
10505 val_conv.inner = (void*)(val & (~1));
10506 val_conv.is_owned = (val & 1) || (val == 0);
10507 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
10510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10511 LDKChannelInfo this_ptr_conv;
10512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10514 LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
10515 *ret = ChannelInfo_get_node_two(&this_ptr_conv);
10519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10520 LDKChannelInfo this_ptr_conv;
10521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10523 LDKPublicKey val_conv = *(LDKPublicKey*)val;
10525 return ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
10528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10529 LDKChannelInfo this_ptr_conv;
10530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10532 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
10533 DO_ASSERT(ret.is_owned);
10534 return ((long)ret.inner) | 1;
10537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10538 LDKChannelInfo this_ptr_conv;
10539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10541 LDKDirectionalChannelInfo val_conv;
10542 val_conv.inner = (void*)(val & (~1));
10543 val_conv.is_owned = (val & 1) || (val == 0);
10544 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
10547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10548 LDKChannelInfo this_ptr_conv;
10549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10551 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
10552 DO_ASSERT(ret.is_owned);
10553 return ((long)ret.inner) | 1;
10556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10557 LDKChannelInfo this_ptr_conv;
10558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10560 LDKChannelAnnouncement val_conv;
10561 val_conv.inner = (void*)(val & (~1));
10562 val_conv.is_owned = (val & 1) || (val == 0);
10563 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
10566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10567 LDKChannelInfo obj_conv;
10568 obj_conv.inner = (void*)(obj & (~1));
10569 obj_conv.is_owned = (obj & 1) || (obj == 0);
10570 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10571 *ret = ChannelInfo_write(&obj_conv);
10575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10576 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10577 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
10578 DO_ASSERT(ret.is_owned);
10579 return ((long)ret.inner) | 1;
10582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10583 LDKRoutingFees this_ptr_conv;
10584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10586 return RoutingFees_free(this_ptr_conv);
10589 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10590 LDKRoutingFees this_ptr_conv;
10591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10593 return RoutingFees_get_base_msat(&this_ptr_conv);
10596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10597 LDKRoutingFees this_ptr_conv;
10598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10600 return RoutingFees_set_base_msat(&this_ptr_conv, val);
10603 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10604 LDKRoutingFees this_ptr_conv;
10605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10607 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
10610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10611 LDKRoutingFees this_ptr_conv;
10612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10614 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
10617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
10618 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
10619 DO_ASSERT(ret.is_owned);
10620 return ((long)ret.inner) | 1;
10623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
10624 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10625 LDKRoutingFees ret = RoutingFees_read(ser_conv);
10626 DO_ASSERT(ret.is_owned);
10627 return ((long)ret.inner) | 1;
10630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
10631 LDKRoutingFees obj_conv;
10632 obj_conv.inner = (void*)(obj & (~1));
10633 obj_conv.is_owned = (obj & 1) || (obj == 0);
10634 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10635 *ret = RoutingFees_write(&obj_conv);
10639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10640 LDKNodeAnnouncementInfo this_ptr_conv;
10641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10643 return NodeAnnouncementInfo_free(this_ptr_conv);
10646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10647 LDKNodeAnnouncementInfo this_ptr_conv;
10648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10650 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
10651 DO_ASSERT(ret.is_owned);
10652 return ((long)ret.inner) | 1;
10655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10656 LDKNodeAnnouncementInfo this_ptr_conv;
10657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10659 LDKNodeFeatures val_conv;
10660 val_conv.inner = (void*)(val & (~1));
10661 val_conv.is_owned = (val & 1) || (val == 0);
10662 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
10665 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10666 LDKNodeAnnouncementInfo this_ptr_conv;
10667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10669 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
10672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10673 LDKNodeAnnouncementInfo this_ptr_conv;
10674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10676 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
10679 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
10680 LDKNodeAnnouncementInfo this_ptr_conv;
10681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10683 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
10684 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10689 LDKNodeAnnouncementInfo 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 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
10694 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
10697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
10698 LDKNodeAnnouncementInfo this_ptr_conv;
10699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10701 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10702 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
10706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10707 LDKNodeAnnouncementInfo this_ptr_conv;
10708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10710 LDKThirtyTwoBytes val_ref;
10711 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10712 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
10715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10716 LDKNodeAnnouncementInfo this_ptr_conv;
10717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10719 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
10721 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
10724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10725 LDKNodeAnnouncementInfo this_ptr_conv;
10726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10728 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
10729 DO_ASSERT(ret.is_owned);
10730 return ((long)ret.inner) | 1;
10733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10734 LDKNodeAnnouncementInfo this_ptr_conv;
10735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10737 LDKNodeAnnouncement val_conv;
10738 val_conv.inner = (void*)(val & (~1));
10739 val_conv.is_owned = (val & 1) || (val == 0);
10740 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
10743 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) {
10744 LDKNodeFeatures features_arg_conv;
10745 features_arg_conv.inner = (void*)(features_arg & (~1));
10746 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
10747 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
10748 FREE((void*)rgb_arg);
10749 LDKThirtyTwoBytes alias_arg_ref;
10750 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
10751 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
10752 FREE((void*)addresses_arg);
10753 LDKNodeAnnouncement announcement_message_arg_conv;
10754 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
10755 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
10756 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
10757 DO_ASSERT(ret.is_owned);
10758 return ((long)ret.inner) | 1;
10761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10762 LDKNodeAnnouncementInfo obj_conv;
10763 obj_conv.inner = (void*)(obj & (~1));
10764 obj_conv.is_owned = (obj & 1) || (obj == 0);
10765 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10766 *ret = NodeAnnouncementInfo_write(&obj_conv);
10770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10771 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10772 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
10773 DO_ASSERT(ret.is_owned);
10774 return ((long)ret.inner) | 1;
10777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10778 LDKNodeInfo this_ptr_conv;
10779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10781 return NodeInfo_free(this_ptr_conv);
10784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10785 LDKNodeInfo this_ptr_conv;
10786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10788 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
10790 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
10793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10794 LDKNodeInfo 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 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
10798 DO_ASSERT(ret.is_owned);
10799 return ((long)ret.inner) | 1;
10802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10803 LDKNodeInfo this_ptr_conv;
10804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10806 LDKRoutingFees val_conv;
10807 val_conv.inner = (void*)(val & (~1));
10808 val_conv.is_owned = (val & 1) || (val == 0);
10809 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
10812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
10813 LDKNodeInfo this_ptr_conv;
10814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10816 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
10817 DO_ASSERT(ret.is_owned);
10818 return ((long)ret.inner) | 1;
10821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10822 LDKNodeInfo 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 LDKNodeAnnouncementInfo val_conv;
10826 val_conv.inner = (void*)(val & (~1));
10827 val_conv.is_owned = (val & 1) || (val == 0);
10828 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
10831 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) {
10832 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
10833 FREE((void*)channels_arg);
10834 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
10835 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
10836 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
10837 LDKNodeAnnouncementInfo announcement_info_arg_conv;
10838 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
10839 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
10840 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
10841 DO_ASSERT(ret.is_owned);
10842 return ((long)ret.inner) | 1;
10845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10846 LDKNodeInfo obj_conv;
10847 obj_conv.inner = (void*)(obj & (~1));
10848 obj_conv.is_owned = (obj & 1) || (obj == 0);
10849 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10850 *ret = NodeInfo_write(&obj_conv);
10854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10855 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10856 LDKNodeInfo ret = NodeInfo_read(ser_conv);
10857 DO_ASSERT(ret.is_owned);
10858 return ((long)ret.inner) | 1;
10861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
10862 LDKNetworkGraph obj_conv;
10863 obj_conv.inner = (void*)(obj & (~1));
10864 obj_conv.is_owned = (obj & 1) || (obj == 0);
10865 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10866 *ret = NetworkGraph_write(&obj_conv);
10870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
10871 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10872 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
10873 DO_ASSERT(ret.is_owned);
10874 return ((long)ret.inner) | 1;
10877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
10878 LDKNetworkGraph ret = NetworkGraph_new();
10879 DO_ASSERT(ret.is_owned);
10880 return ((long)ret.inner) | 1;
10883 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) {
10884 LDKNetworkGraph this_arg_conv;
10885 this_arg_conv.inner = (void*)(this_arg & (~1));
10886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10887 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);