1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Running a leak check across all the allocations and frees of the JDK is a mess,
10 // so instead we implement our own naive leak checker here, relying on the -wrap
11 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
12 // and free'd in Rust or C across the generated bindings shared library.
16 static mtx_t allocation_mtx;
18 void __attribute__((constructor)) init_mtx() {
19 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
23 typedef struct allocation {
24 struct allocation* next;
26 const char* struct_name;
30 static allocation* allocation_ll = NULL;
32 void* __real_malloc(size_t len);
33 void* __real_calloc(size_t nmemb, size_t len);
34 static void new_allocation(void* res, const char* struct_name) {
35 allocation* new_alloc = __real_malloc(sizeof(allocation));
37 new_alloc->struct_name = struct_name;
38 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
39 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
40 new_alloc->next = allocation_ll;
41 allocation_ll = new_alloc;
42 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
44 static void* MALLOC(size_t len, const char* struct_name) {
45 void* res = __real_malloc(len);
46 new_allocation(res, struct_name);
49 void __real_free(void* ptr);
50 static void alloc_freed(void* ptr) {
52 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
53 allocation* it = allocation_ll;
54 while (it->ptr != ptr) { p = it; it = it->next; }
55 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
56 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
57 DO_ASSERT(it->ptr == ptr);
60 static void FREE(void* ptr) {
65 void* __wrap_malloc(size_t len) {
66 void* res = __real_malloc(len);
67 new_allocation(res, "malloc call");
70 void* __wrap_calloc(size_t nmemb, size_t len) {
71 void* res = __real_calloc(nmemb, len);
72 new_allocation(res, "calloc call");
75 void __wrap_free(void* ptr) {
80 void* __real_realloc(void* ptr, size_t newlen);
81 void* __wrap_realloc(void* ptr, size_t len) {
83 void* res = __real_realloc(ptr, len);
84 new_allocation(res, "realloc call");
87 void __wrap_reallocarray(void* ptr, size_t new_sz) {
88 // Rust doesn't seem to use reallocarray currently
92 void __attribute__((destructor)) check_leaks() {
93 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
94 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
95 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
96 fprintf(stderr, "\n\n");
98 DO_ASSERT(allocation_ll == NULL);
101 static jmethodID ordinal_meth = NULL;
102 static jmethodID slicedef_meth = NULL;
103 static jclass slicedef_cls = NULL;
104 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
105 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
106 DO_ASSERT(ordinal_meth != NULL);
107 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
108 DO_ASSERT(slicedef_meth != NULL);
109 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
110 DO_ASSERT(slicedef_cls != NULL);
113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
114 return *((bool*)ptr);
116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
117 return *((long*)ptr);
119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
122 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
123 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
124 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
127 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
128 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
129 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
130 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
133 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
134 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
135 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
136 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
137 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
140 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
141 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
142 txdata->datalen = (*env)->GetArrayLength(env, bytes);
143 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
144 txdata->data_is_owned = true;
145 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
149 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
150 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
151 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
152 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
153 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
154 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
155 return (long)vec->datalen;
157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
158 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
159 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
160 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
161 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
162 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
163 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
169 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
170 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
171 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
172 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {
175 LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
178 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
179 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
180 case 0: return LDKAccessError_UnknownChain;
181 case 1: return LDKAccessError_UnknownTx;
185 static jclass LDKAccessError_class = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
187 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
189 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
190 DO_ASSERT(LDKAccessError_class != NULL);
191 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
192 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownChain != NULL);
193 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
194 DO_ASSERT(LDKAccessError_LDKAccessError_UnknownTx != NULL);
196 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
198 case LDKAccessError_UnknownChain:
199 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
200 case LDKAccessError_UnknownTx:
201 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
206 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
207 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
208 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
209 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
213 static jclass LDKChannelMonitorUpdateErr_class = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
215 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
216 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
217 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
218 DO_ASSERT(LDKChannelMonitorUpdateErr_class != NULL);
219 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
220 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
221 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
222 DO_ASSERT(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
224 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
226 case LDKChannelMonitorUpdateErr_TemporaryFailure:
227 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
228 case LDKChannelMonitorUpdateErr_PermanentFailure:
229 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
234 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
235 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
236 case 0: return LDKConfirmationTarget_Background;
237 case 1: return LDKConfirmationTarget_Normal;
238 case 2: return LDKConfirmationTarget_HighPriority;
242 static jclass LDKConfirmationTarget_class = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
245 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
247 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
248 DO_ASSERT(LDKConfirmationTarget_class != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
251 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
252 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
253 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
254 DO_ASSERT(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
256 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
258 case LDKConfirmationTarget_Background:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
260 case LDKConfirmationTarget_Normal:
261 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
262 case LDKConfirmationTarget_HighPriority:
263 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
268 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
269 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
270 case 0: return LDKLevel_Off;
271 case 1: return LDKLevel_Error;
272 case 2: return LDKLevel_Warn;
273 case 3: return LDKLevel_Info;
274 case 4: return LDKLevel_Debug;
275 case 5: return LDKLevel_Trace;
279 static jclass LDKLevel_class = NULL;
280 static jfieldID LDKLevel_LDKLevel_Off = NULL;
281 static jfieldID LDKLevel_LDKLevel_Error = NULL;
282 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
283 static jfieldID LDKLevel_LDKLevel_Info = NULL;
284 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
285 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
287 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
288 DO_ASSERT(LDKLevel_class != NULL);
289 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
290 DO_ASSERT(LDKLevel_LDKLevel_Off != NULL);
291 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
292 DO_ASSERT(LDKLevel_LDKLevel_Error != NULL);
293 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
294 DO_ASSERT(LDKLevel_LDKLevel_Warn != NULL);
295 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
296 DO_ASSERT(LDKLevel_LDKLevel_Info != NULL);
297 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
298 DO_ASSERT(LDKLevel_LDKLevel_Debug != NULL);
299 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
300 DO_ASSERT(LDKLevel_LDKLevel_Trace != NULL);
302 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
313 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
315 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
320 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
321 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
322 case 0: return LDKNetwork_Bitcoin;
323 case 1: return LDKNetwork_Testnet;
324 case 2: return LDKNetwork_Regtest;
328 static jclass LDKNetwork_class = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
331 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
333 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
334 DO_ASSERT(LDKNetwork_class != NULL);
335 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
336 DO_ASSERT(LDKNetwork_LDKNetwork_Bitcoin != NULL);
337 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
338 DO_ASSERT(LDKNetwork_LDKNetwork_Testnet != NULL);
339 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
340 DO_ASSERT(LDKNetwork_LDKNetwork_Regtest != NULL);
342 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
344 case LDKNetwork_Bitcoin:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
346 case LDKNetwork_Testnet:
347 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
348 case LDKNetwork_Regtest:
349 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
355 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
356 case 0: return LDKSecp256k1Error_IncorrectSignature;
357 case 1: return LDKSecp256k1Error_InvalidMessage;
358 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359 case 3: return LDKSecp256k1Error_InvalidSignature;
360 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
362 case 6: return LDKSecp256k1Error_InvalidTweak;
363 case 7: return LDKSecp256k1Error_NotEnoughMemory;
364 case 8: return LDKSecp256k1Error_CallbackPanicked;
368 static jclass LDKSecp256k1Error_class = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
377 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
379 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
380 DO_ASSERT(LDKSecp256k1Error_class != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 DO_ASSERT(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
400 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
402 case LDKSecp256k1Error_IncorrectSignature:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
404 case LDKSecp256k1Error_InvalidMessage:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
406 case LDKSecp256k1Error_InvalidPublicKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
408 case LDKSecp256k1Error_InvalidSignature:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
410 case LDKSecp256k1Error_InvalidSecretKey:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
412 case LDKSecp256k1Error_InvalidRecoveryId:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
414 case LDKSecp256k1Error_InvalidTweak:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
416 case LDKSecp256k1Error_NotEnoughMemory:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
418 case LDKSecp256k1Error_CallbackPanicked:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
425 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
429 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
430 ret->datalen = (*env)->GetArrayLength(env, elems);
431 if (ret->datalen == 0) {
434 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
435 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
436 for (size_t i = 0; i < ret->datalen; i++) {
437 ret->data[i] = java_elems[i];
439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
444 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
446 LDKTransaction b_conv = *(LDKTransaction*)b;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
452 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
455 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
456 if (val->result_ok) {
457 return (long)val->contents.result;
459 return (long)val->contents.err;
462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
463 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
466 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
467 if (val->result_ok) {
468 return (long)val->contents.result;
470 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
474 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
476 a_conv.inner = (void*)(a & (~1));
477 a_conv.is_owned = (a & 1) || (a == 0);
478 if (a_conv.inner != NULL)
479 a_conv = OutPoint_clone(&a_conv);
481 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
486 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
487 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
488 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
491 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
492 ret->datalen = (*env)->GetArrayLength(env, elems);
493 if (ret->datalen == 0) {
496 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
497 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
498 for (size_t i = 0; i < ret->datalen; i++) {
499 jlong arr_elem = java_elems[i];
500 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
501 FREE((void*)arr_elem);
502 ret->data[i] = arr_elem_conv;
504 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
509 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
510 LDKThirtyTwoBytes a_ref;
511 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
513 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
519 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
524 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
525 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
526 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
529 LDKCVecTempl_Signature *ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
530 ret->datalen = (*env)->GetArrayLength(env, elems);
531 if (ret->datalen == 0) {
534 ret->data = MALLOC(sizeof(LDKSignature) * ret->datalen, "LDKCVecTempl_Signature Data");
535 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
536 for (size_t i = 0; i < ret->datalen; i++) {
537 jlong arr_elem = java_elems[i];
538 LDKSignature arr_elem_conv = *(LDKSignature*)arr_elem;
539 FREE((void*)arr_elem);
540 ret->data[i] = arr_elem_conv;
542 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
547 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
548 LDKSignature a_conv = *(LDKSignature*)a;
551 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
557 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
560 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
561 if (val->result_ok) {
562 return (long)val->contents.result;
564 return (long)val->contents.err;
567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
568 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
571 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
572 if (val->result_ok) {
573 return (long)val->contents.result;
575 return (long)val->contents.err;
578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
579 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
582 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
583 if (val->result_ok) {
584 return (long)val->contents.result;
586 return (long)val->contents.err;
589 static jclass LDKAPIError_APIMisuseError_class = NULL;
590 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
591 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
592 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
593 static jclass LDKAPIError_RouteError_class = NULL;
594 static jmethodID LDKAPIError_RouteError_meth = NULL;
595 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
596 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
597 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
598 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
600 LDKAPIError_APIMisuseError_class =
601 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
602 DO_ASSERT(LDKAPIError_APIMisuseError_class != NULL);
603 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
604 DO_ASSERT(LDKAPIError_APIMisuseError_meth != NULL);
605 LDKAPIError_FeeRateTooHigh_class =
606 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
607 DO_ASSERT(LDKAPIError_FeeRateTooHigh_class != NULL);
608 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
609 DO_ASSERT(LDKAPIError_FeeRateTooHigh_meth != NULL);
610 LDKAPIError_RouteError_class =
611 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
612 DO_ASSERT(LDKAPIError_RouteError_class != NULL);
613 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
614 DO_ASSERT(LDKAPIError_RouteError_meth != NULL);
615 LDKAPIError_ChannelUnavailable_class =
616 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
617 DO_ASSERT(LDKAPIError_ChannelUnavailable_class != NULL);
618 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
619 DO_ASSERT(LDKAPIError_ChannelUnavailable_meth != NULL);
620 LDKAPIError_MonitorUpdateFailed_class =
621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
622 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_class != NULL);
623 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
624 DO_ASSERT(LDKAPIError_MonitorUpdateFailed_meth != NULL);
626 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
627 LDKAPIError *obj = (LDKAPIError*)ptr;
629 case LDKAPIError_APIMisuseError: {
630 long err_ref = (long)&obj->api_misuse_error.err;
631 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
633 case LDKAPIError_FeeRateTooHigh: {
634 long err_ref = (long)&obj->fee_rate_too_high.err;
635 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
637 case LDKAPIError_RouteError: {
638 long err_ref = (long)&obj->route_error.err;
639 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
641 case LDKAPIError_ChannelUnavailable: {
642 long err_ref = (long)&obj->channel_unavailable.err;
643 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
645 case LDKAPIError_MonitorUpdateFailed: {
646 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
651 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
652 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
655 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
656 if (val->result_ok) {
657 return (long)val->contents.result;
659 return (long)val->contents.err;
662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
663 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
666 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
667 if (val->result_ok) {
668 return (long)val->contents.result;
670 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
673 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) {
674 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
675 LDKChannelAnnouncement a_conv;
676 a_conv.inner = (void*)(a & (~1));
677 a_conv.is_owned = (a & 1) || (a == 0);
678 if (a_conv.inner != NULL)
679 a_conv = ChannelAnnouncement_clone(&a_conv);
681 LDKChannelUpdate b_conv;
682 b_conv.inner = (void*)(b & (~1));
683 b_conv.is_owned = (b & 1) || (b == 0);
684 if (b_conv.inner != NULL)
685 b_conv = ChannelUpdate_clone(&b_conv);
687 LDKChannelUpdate c_conv;
688 c_conv.inner = (void*)(c & (~1));
689 c_conv.is_owned = (c & 1) || (c == 0);
690 if (c_conv.inner != NULL)
691 c_conv = ChannelUpdate_clone(&c_conv);
695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
696 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
699 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
700 if (val->result_ok) {
701 return (long)val->contents.result;
703 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
707 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
708 LDKHTLCOutputInCommitment a_conv;
709 a_conv.inner = (void*)(a & (~1));
710 a_conv.is_owned = (a & 1) || (a == 0);
711 if (a_conv.inner != NULL)
712 a_conv = HTLCOutputInCommitment_clone(&a_conv);
714 LDKSignature b_conv = *(LDKSignature*)b;
719 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
720 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
721 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
722 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
723 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
724 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
726 LDKSpendableOutputDescriptor_StaticOutput_class =
727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
728 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
729 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
730 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
731 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
733 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
734 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
735 DO_ASSERT(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
736 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
737 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
738 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
739 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
740 DO_ASSERT(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
742 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
743 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
745 case LDKSpendableOutputDescriptor_StaticOutput: {
746 LDKOutPoint outpoint_var = obj->static_output.outpoint;
747 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
748 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
750 if (outpoint_var.is_owned) {
751 outpoint_ref = (long)outpoint_var.inner | 1;
753 outpoint_ref = (long)&outpoint_var;
755 long output_ref = (long)&obj->static_output.output;
756 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
758 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
759 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
760 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
761 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
763 if (outpoint_var.is_owned) {
764 outpoint_ref = (long)outpoint_var.inner | 1;
766 outpoint_ref = (long)&outpoint_var;
768 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
769 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
770 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
771 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
772 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
773 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
774 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr);
776 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
777 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
778 DO_ASSERT((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
779 DO_ASSERT((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
781 if (outpoint_var.is_owned) {
782 outpoint_ref = (long)outpoint_var.inner | 1;
784 outpoint_ref = (long)&outpoint_var;
786 long output_ref = (long)&obj->static_output_counterparty_payment.output;
787 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
788 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
793 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
794 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
795 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
798 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
799 ret->datalen = (*env)->GetArrayLength(env, elems);
800 if (ret->datalen == 0) {
803 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
804 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
805 for (size_t i = 0; i < ret->datalen; i++) {
806 jlong arr_elem = java_elems[i];
807 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
808 FREE((void*)arr_elem);
809 ret->data[i] = arr_elem_conv;
811 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
815 static jclass LDKEvent_FundingGenerationReady_class = NULL;
816 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
817 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
818 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
819 static jclass LDKEvent_PaymentReceived_class = NULL;
820 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
821 static jclass LDKEvent_PaymentSent_class = NULL;
822 static jmethodID LDKEvent_PaymentSent_meth = NULL;
823 static jclass LDKEvent_PaymentFailed_class = NULL;
824 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
825 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
826 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
827 static jclass LDKEvent_SpendableOutputs_class = NULL;
828 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
830 LDKEvent_FundingGenerationReady_class =
831 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
832 DO_ASSERT(LDKEvent_FundingGenerationReady_class != NULL);
833 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
834 DO_ASSERT(LDKEvent_FundingGenerationReady_meth != NULL);
835 LDKEvent_FundingBroadcastSafe_class =
836 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
837 DO_ASSERT(LDKEvent_FundingBroadcastSafe_class != NULL);
838 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
839 DO_ASSERT(LDKEvent_FundingBroadcastSafe_meth != NULL);
840 LDKEvent_PaymentReceived_class =
841 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
842 DO_ASSERT(LDKEvent_PaymentReceived_class != NULL);
843 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
844 DO_ASSERT(LDKEvent_PaymentReceived_meth != NULL);
845 LDKEvent_PaymentSent_class =
846 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
847 DO_ASSERT(LDKEvent_PaymentSent_class != NULL);
848 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
849 DO_ASSERT(LDKEvent_PaymentSent_meth != NULL);
850 LDKEvent_PaymentFailed_class =
851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
852 DO_ASSERT(LDKEvent_PaymentFailed_class != NULL);
853 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
854 DO_ASSERT(LDKEvent_PaymentFailed_meth != NULL);
855 LDKEvent_PendingHTLCsForwardable_class =
856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
857 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_class != NULL);
858 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
859 DO_ASSERT(LDKEvent_PendingHTLCsForwardable_meth != NULL);
860 LDKEvent_SpendableOutputs_class =
861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
862 DO_ASSERT(LDKEvent_SpendableOutputs_class != NULL);
863 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
864 DO_ASSERT(LDKEvent_SpendableOutputs_meth != NULL);
866 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
867 LDKEvent *obj = (LDKEvent*)ptr;
869 case LDKEvent_FundingGenerationReady: {
870 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
871 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
872 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
873 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);
875 case LDKEvent_FundingBroadcastSafe: {
876 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
877 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
878 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
879 long funding_txo_ref;
880 if (funding_txo_var.is_owned) {
881 funding_txo_ref = (long)funding_txo_var.inner | 1;
883 funding_txo_ref = (long)&funding_txo_var;
885 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
887 case LDKEvent_PaymentReceived: {
888 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
889 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
890 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
891 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
892 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
894 case LDKEvent_PaymentSent: {
895 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
896 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
897 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
899 case LDKEvent_PaymentFailed: {
900 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
901 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
902 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
904 case LDKEvent_PendingHTLCsForwardable: {
905 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
907 case LDKEvent_SpendableOutputs: {
908 long outputs_ref = (long)&obj->spendable_outputs.outputs;
909 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
914 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
915 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
916 static jclass LDKErrorAction_IgnoreError_class = NULL;
917 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
918 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
919 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
921 LDKErrorAction_DisconnectPeer_class =
922 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
923 DO_ASSERT(LDKErrorAction_DisconnectPeer_class != NULL);
924 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
925 DO_ASSERT(LDKErrorAction_DisconnectPeer_meth != NULL);
926 LDKErrorAction_IgnoreError_class =
927 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
928 DO_ASSERT(LDKErrorAction_IgnoreError_class != NULL);
929 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
930 DO_ASSERT(LDKErrorAction_IgnoreError_meth != NULL);
931 LDKErrorAction_SendErrorMessage_class =
932 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
933 DO_ASSERT(LDKErrorAction_SendErrorMessage_class != NULL);
934 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
935 DO_ASSERT(LDKErrorAction_SendErrorMessage_meth != NULL);
937 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
938 LDKErrorAction *obj = (LDKErrorAction*)ptr;
940 case LDKErrorAction_DisconnectPeer: {
941 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
942 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
943 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 if (msg_var.is_owned) {
946 msg_ref = (long)msg_var.inner | 1;
948 msg_ref = (long)&msg_var;
950 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
952 case LDKErrorAction_IgnoreError: {
953 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
955 case LDKErrorAction_SendErrorMessage: {
956 LDKErrorMessage msg_var = obj->send_error_message.msg;
957 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
960 if (msg_var.is_owned) {
961 msg_ref = (long)msg_var.inner | 1;
963 msg_ref = (long)&msg_var;
965 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
970 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
971 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
972 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
973 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
974 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
975 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
977 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
978 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
979 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
980 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
981 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
982 LDKHTLCFailChannelUpdate_ChannelClosed_class =
983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
984 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
985 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
986 DO_ASSERT(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
987 LDKHTLCFailChannelUpdate_NodeFailure_class =
988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
989 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
990 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
991 DO_ASSERT(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
993 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
994 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
996 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
997 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
998 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
999 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1001 if (msg_var.is_owned) {
1002 msg_ref = (long)msg_var.inner | 1;
1004 msg_ref = (long)&msg_var;
1006 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1008 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1009 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1011 case LDKHTLCFailChannelUpdate_NodeFailure: {
1012 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1013 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1014 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1019 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1020 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1021 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1022 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1023 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1024 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1025 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1026 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1027 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1028 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1029 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1030 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1031 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1032 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1033 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1034 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1035 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1036 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1037 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1038 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1039 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1040 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1041 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1042 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1043 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1044 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1045 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1046 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1047 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1048 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1049 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1050 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1052 LDKMessageSendEvent_SendAcceptChannel_class =
1053 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1054 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1055 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1056 DO_ASSERT(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1057 LDKMessageSendEvent_SendOpenChannel_class =
1058 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1059 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1060 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1061 DO_ASSERT(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1062 LDKMessageSendEvent_SendFundingCreated_class =
1063 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1064 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1065 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1066 DO_ASSERT(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1067 LDKMessageSendEvent_SendFundingSigned_class =
1068 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1069 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1070 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1071 DO_ASSERT(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1072 LDKMessageSendEvent_SendFundingLocked_class =
1073 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1074 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1075 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1076 DO_ASSERT(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1077 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1078 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1079 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1080 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1081 DO_ASSERT(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1082 LDKMessageSendEvent_UpdateHTLCs_class =
1083 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1084 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1085 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1086 DO_ASSERT(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1087 LDKMessageSendEvent_SendRevokeAndACK_class =
1088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1089 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1090 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1091 DO_ASSERT(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1092 LDKMessageSendEvent_SendClosingSigned_class =
1093 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1094 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1095 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1096 DO_ASSERT(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1097 LDKMessageSendEvent_SendShutdown_class =
1098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1099 DO_ASSERT(LDKMessageSendEvent_SendShutdown_class != NULL);
1100 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1101 DO_ASSERT(LDKMessageSendEvent_SendShutdown_meth != NULL);
1102 LDKMessageSendEvent_SendChannelReestablish_class =
1103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1104 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1105 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1106 DO_ASSERT(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1107 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1108 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1109 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1110 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1111 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1112 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1114 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1115 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1116 DO_ASSERT(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1117 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1119 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1120 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1121 DO_ASSERT(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1122 LDKMessageSendEvent_HandleError_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1124 DO_ASSERT(LDKMessageSendEvent_HandleError_class != NULL);
1125 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1126 DO_ASSERT(LDKMessageSendEvent_HandleError_meth != NULL);
1127 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1128 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1129 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1130 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1131 DO_ASSERT(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1133 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1134 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1136 case LDKMessageSendEvent_SendAcceptChannel: {
1137 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1138 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1139 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1140 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1141 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1143 if (msg_var.is_owned) {
1144 msg_ref = (long)msg_var.inner | 1;
1146 msg_ref = (long)&msg_var;
1148 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1150 case LDKMessageSendEvent_SendOpenChannel: {
1151 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1152 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1153 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1154 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1155 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1157 if (msg_var.is_owned) {
1158 msg_ref = (long)msg_var.inner | 1;
1160 msg_ref = (long)&msg_var;
1162 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1164 case LDKMessageSendEvent_SendFundingCreated: {
1165 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1166 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1167 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1168 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1169 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1171 if (msg_var.is_owned) {
1172 msg_ref = (long)msg_var.inner | 1;
1174 msg_ref = (long)&msg_var;
1176 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1178 case LDKMessageSendEvent_SendFundingSigned: {
1179 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1180 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1181 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1182 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1183 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1185 if (msg_var.is_owned) {
1186 msg_ref = (long)msg_var.inner | 1;
1188 msg_ref = (long)&msg_var;
1190 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1192 case LDKMessageSendEvent_SendFundingLocked: {
1193 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1194 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1195 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1196 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1197 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1199 if (msg_var.is_owned) {
1200 msg_ref = (long)msg_var.inner | 1;
1202 msg_ref = (long)&msg_var;
1204 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1206 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1207 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1208 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1209 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1210 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1211 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 if (msg_var.is_owned) {
1214 msg_ref = (long)msg_var.inner | 1;
1216 msg_ref = (long)&msg_var;
1218 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1220 case LDKMessageSendEvent_UpdateHTLCs: {
1221 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1222 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1223 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1224 DO_ASSERT((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 DO_ASSERT((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1227 if (updates_var.is_owned) {
1228 updates_ref = (long)updates_var.inner | 1;
1230 updates_ref = (long)&updates_var;
1232 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1234 case LDKMessageSendEvent_SendRevokeAndACK: {
1235 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1236 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1237 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1238 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1239 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1241 if (msg_var.is_owned) {
1242 msg_ref = (long)msg_var.inner | 1;
1244 msg_ref = (long)&msg_var;
1246 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1248 case LDKMessageSendEvent_SendClosingSigned: {
1249 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1250 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1251 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1252 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1253 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1255 if (msg_var.is_owned) {
1256 msg_ref = (long)msg_var.inner | 1;
1258 msg_ref = (long)&msg_var;
1260 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1262 case LDKMessageSendEvent_SendShutdown: {
1263 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1264 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1265 LDKShutdown msg_var = obj->send_shutdown.msg;
1266 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1269 if (msg_var.is_owned) {
1270 msg_ref = (long)msg_var.inner | 1;
1272 msg_ref = (long)&msg_var;
1274 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1276 case LDKMessageSendEvent_SendChannelReestablish: {
1277 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1278 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1279 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1280 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1281 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1283 if (msg_var.is_owned) {
1284 msg_ref = (long)msg_var.inner | 1;
1286 msg_ref = (long)&msg_var;
1288 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1290 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1291 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1292 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1293 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1295 if (msg_var.is_owned) {
1296 msg_ref = (long)msg_var.inner | 1;
1298 msg_ref = (long)&msg_var;
1300 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1301 DO_ASSERT((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1302 DO_ASSERT((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1303 long update_msg_ref;
1304 if (update_msg_var.is_owned) {
1305 update_msg_ref = (long)update_msg_var.inner | 1;
1307 update_msg_ref = (long)&update_msg_var;
1309 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1311 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1312 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1313 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1314 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1316 if (msg_var.is_owned) {
1317 msg_ref = (long)msg_var.inner | 1;
1319 msg_ref = (long)&msg_var;
1321 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1323 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1324 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1325 DO_ASSERT((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 DO_ASSERT((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1328 if (msg_var.is_owned) {
1329 msg_ref = (long)msg_var.inner | 1;
1331 msg_ref = (long)&msg_var;
1333 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1335 case LDKMessageSendEvent_HandleError: {
1336 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1337 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1338 long action_ref = (long)&obj->handle_error.action;
1339 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1341 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1342 long update_ref = (long)&obj->payment_failure_network_update.update;
1343 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1348 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1349 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1350 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1353 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1354 ret->datalen = (*env)->GetArrayLength(env, elems);
1355 if (ret->datalen == 0) {
1358 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1359 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1360 for (size_t i = 0; i < ret->datalen; i++) {
1361 jlong arr_elem = java_elems[i];
1362 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1363 FREE((void*)arr_elem);
1364 ret->data[i] = arr_elem_conv;
1366 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1370 typedef struct LDKMessageSendEventsProvider_JCalls {
1371 atomic_size_t refcnt;
1374 jmethodID get_and_clear_pending_msg_events_meth;
1375 } LDKMessageSendEventsProvider_JCalls;
1376 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1377 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1379 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1380 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1381 DO_ASSERT(obj != NULL);
1382 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1383 LDKCVec_MessageSendEventZ res = *ret;
1387 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1388 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1389 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1391 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1392 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1396 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1397 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1398 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1399 return (void*) this_arg;
1401 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1402 jclass c = (*env)->GetObjectClass(env, o);
1403 DO_ASSERT(c != NULL);
1404 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1405 atomic_init(&calls->refcnt, 1);
1406 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1407 calls->o = (*env)->NewWeakGlobalRef(env, o);
1408 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1409 DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
1411 LDKMessageSendEventsProvider ret = {
1412 .this_arg = (void*) calls,
1413 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1414 .free = LDKMessageSendEventsProvider_JCalls_free,
1418 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1419 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1420 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1421 return (long)res_ptr;
1423 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1424 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1425 DO_ASSERT(ret != NULL);
1428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) {
1429 LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg;
1430 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1431 *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg);
1435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1436 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1437 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1440 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1441 ret->datalen = (*env)->GetArrayLength(env, elems);
1442 if (ret->datalen == 0) {
1445 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1446 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1447 for (size_t i = 0; i < ret->datalen; i++) {
1448 jlong arr_elem = java_elems[i];
1449 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1450 FREE((void*)arr_elem);
1451 ret->data[i] = arr_elem_conv;
1453 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1457 typedef struct LDKEventsProvider_JCalls {
1458 atomic_size_t refcnt;
1461 jmethodID get_and_clear_pending_events_meth;
1462 } LDKEventsProvider_JCalls;
1463 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1464 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1466 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1467 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1468 DO_ASSERT(obj != NULL);
1469 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1470 LDKCVec_EventZ res = *ret;
1474 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1475 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1476 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1478 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1479 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1483 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1484 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1485 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1486 return (void*) this_arg;
1488 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1489 jclass c = (*env)->GetObjectClass(env, o);
1490 DO_ASSERT(c != NULL);
1491 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1492 atomic_init(&calls->refcnt, 1);
1493 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1494 calls->o = (*env)->NewWeakGlobalRef(env, o);
1495 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1496 DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
1498 LDKEventsProvider ret = {
1499 .this_arg = (void*) calls,
1500 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1501 .free = LDKEventsProvider_JCalls_free,
1505 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1506 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1507 *res_ptr = LDKEventsProvider_init(env, _a, o);
1508 return (long)res_ptr;
1510 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1511 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1512 DO_ASSERT(ret != NULL);
1515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) {
1516 LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg;
1517 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1518 *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg);
1522 typedef struct LDKLogger_JCalls {
1523 atomic_size_t refcnt;
1528 void log_jcall(const void* this_arg, const char *record) {
1529 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1531 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1532 jstring record_conv = (*env)->NewStringUTF(env, record);
1533 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1534 DO_ASSERT(obj != NULL);
1535 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1537 static void LDKLogger_JCalls_free(void* this_arg) {
1538 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1539 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1541 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1542 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1546 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1547 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1548 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1549 return (void*) this_arg;
1551 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1552 jclass c = (*env)->GetObjectClass(env, o);
1553 DO_ASSERT(c != NULL);
1554 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1555 atomic_init(&calls->refcnt, 1);
1556 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1557 calls->o = (*env)->NewWeakGlobalRef(env, o);
1558 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1559 DO_ASSERT(calls->log_meth != NULL);
1562 .this_arg = (void*) calls,
1564 .free = LDKLogger_JCalls_free,
1568 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1569 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1570 *res_ptr = LDKLogger_init(env, _a, o);
1571 return (long)res_ptr;
1573 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1574 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1575 DO_ASSERT(ret != NULL);
1578 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1579 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1582 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1583 if (val->result_ok) {
1584 return (long)val->contents.result;
1586 return (long)val->contents.err;
1589 typedef struct LDKAccess_JCalls {
1590 atomic_size_t refcnt;
1593 jmethodID get_utxo_meth;
1595 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1596 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1598 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1599 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1600 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1602 DO_ASSERT(obj != NULL);
1603 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1604 LDKCResult_TxOutAccessErrorZ res = *ret;
1608 static void LDKAccess_JCalls_free(void* this_arg) {
1609 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1610 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1612 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1613 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1617 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1618 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1619 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1620 return (void*) this_arg;
1622 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1623 jclass c = (*env)->GetObjectClass(env, o);
1624 DO_ASSERT(c != NULL);
1625 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1626 atomic_init(&calls->refcnt, 1);
1627 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1628 calls->o = (*env)->NewWeakGlobalRef(env, o);
1629 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1630 DO_ASSERT(calls->get_utxo_meth != NULL);
1633 .this_arg = (void*) calls,
1634 .get_utxo = get_utxo_jcall,
1635 .free = LDKAccess_JCalls_free,
1639 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1640 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1641 *res_ptr = LDKAccess_init(env, _a, o);
1642 return (long)res_ptr;
1644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1645 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1646 DO_ASSERT(ret != NULL);
1649 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) {
1650 LDKAccess* arg_conv = (LDKAccess*)arg;
1651 unsigned char genesis_hash_arr[32];
1652 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1653 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1654 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1655 *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1659 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1660 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1661 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1662 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1663 for (size_t i = 0; i < vec->datalen; i++) {
1664 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
1665 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1667 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1671 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1672 ret->datalen = (*env)->GetArrayLength(env, elems);
1673 if (ret->datalen == 0) {
1676 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1677 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1678 for (size_t i = 0; i < ret->datalen; i++) {
1679 jlong arr_elem = java_elems[i];
1680 LDKHTLCOutputInCommitment arr_elem_conv;
1681 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1682 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1683 if (arr_elem_conv.inner != NULL)
1684 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1685 ret->data[i] = arr_elem_conv;
1687 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1691 typedef struct LDKChannelKeys_JCalls {
1692 atomic_size_t refcnt;
1695 jmethodID get_per_commitment_point_meth;
1696 jmethodID release_commitment_secret_meth;
1697 jmethodID key_derivation_params_meth;
1698 jmethodID sign_counterparty_commitment_meth;
1699 jmethodID sign_holder_commitment_meth;
1700 jmethodID sign_holder_commitment_htlc_transactions_meth;
1701 jmethodID sign_justice_transaction_meth;
1702 jmethodID sign_counterparty_htlc_transaction_meth;
1703 jmethodID sign_closing_transaction_meth;
1704 jmethodID sign_channel_announcement_meth;
1705 jmethodID on_accept_meth;
1706 } LDKChannelKeys_JCalls;
1707 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1708 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1710 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1711 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1712 DO_ASSERT(obj != NULL);
1713 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1715 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1718 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1719 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1721 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1722 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1723 DO_ASSERT(obj != NULL);
1724 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1725 LDKThirtyTwoBytes ret;
1726 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1729 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1730 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1732 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1734 DO_ASSERT(obj != NULL);
1735 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1736 LDKC2Tuple_u64u64Z res = *ret;
1740 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) {
1741 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1743 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1744 long commitment_tx_ref = (long)&commitment_tx;
1745 long htlcs_ref = (long)&htlcs;
1746 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1747 DO_ASSERT(obj != NULL);
1748 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
1749 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1753 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
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 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1758 DO_ASSERT(obj != NULL);
1759 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1760 LDKCResult_SignatureNoneZ res = *ret;
1764 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1765 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1767 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1768 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1769 DO_ASSERT(obj != NULL);
1770 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1771 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1775 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) {
1776 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1778 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1779 long justice_tx_ref = (long)&justice_tx;
1780 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1781 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1782 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1783 DO_ASSERT(obj != NULL);
1784 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1785 LDKCResult_SignatureNoneZ res = *ret;
1789 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) {
1790 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1792 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1793 long htlc_tx_ref = (long)&htlc_tx;
1794 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1795 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1796 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1797 DO_ASSERT(obj != NULL);
1798 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc);
1799 LDKCResult_SignatureNoneZ res = *ret;
1803 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1804 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1806 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1807 long closing_tx_ref = (long)&closing_tx;
1808 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1809 DO_ASSERT(obj != NULL);
1810 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1811 LDKCResult_SignatureNoneZ res = *ret;
1815 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1816 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1818 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1819 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1820 DO_ASSERT(obj != NULL);
1821 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1822 LDKCResult_SignatureNoneZ res = *ret;
1826 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1827 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1830 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1831 DO_ASSERT(obj != NULL);
1832 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1834 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1835 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1836 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1838 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1839 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1843 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1844 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1845 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1846 return (void*) this_arg;
1848 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1849 jclass c = (*env)->GetObjectClass(env, o);
1850 DO_ASSERT(c != NULL);
1851 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1852 atomic_init(&calls->refcnt, 1);
1853 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1854 calls->o = (*env)->NewWeakGlobalRef(env, o);
1855 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1856 DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
1857 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1858 DO_ASSERT(calls->release_commitment_secret_meth != NULL);
1859 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1860 DO_ASSERT(calls->key_derivation_params_meth != NULL);
1861 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1862 DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
1863 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1864 DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
1865 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1866 DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1867 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1868 DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1869 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1870 DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1871 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1872 DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1873 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1874 DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1875 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1876 DO_ASSERT(calls->on_accept_meth != NULL);
1878 LDKChannelKeys ret = {
1879 .this_arg = (void*) calls,
1880 .get_per_commitment_point = get_per_commitment_point_jcall,
1881 .release_commitment_secret = release_commitment_secret_jcall,
1882 .key_derivation_params = key_derivation_params_jcall,
1883 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1884 .sign_holder_commitment = sign_holder_commitment_jcall,
1885 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1886 .sign_justice_transaction = sign_justice_transaction_jcall,
1887 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1888 .sign_closing_transaction = sign_closing_transaction_jcall,
1889 .sign_channel_announcement = sign_channel_announcement_jcall,
1890 .on_accept = on_accept_jcall,
1891 .clone = LDKChannelKeys_JCalls_clone,
1892 .free = LDKChannelKeys_JCalls_free,
1896 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1897 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1898 *res_ptr = LDKChannelKeys_init(env, _a, o);
1899 return (long)res_ptr;
1901 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1902 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1903 DO_ASSERT(ret != NULL);
1906 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1907 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1908 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1909 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx).compressed_form);
1913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1914 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx).data);
1920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) {
1921 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1922 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1923 *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg);
1927 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) {
1928 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1929 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1930 FREE((void*)commitment_tx);
1931 LDKPreCalculatedTxCreationKeys keys_conv;
1932 keys_conv.inner = (void*)(keys & (~1));
1933 keys_conv.is_owned = (keys & 1) || (keys == 0);
1934 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1936 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1937 *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1942 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1943 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1944 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1945 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1946 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1947 *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, &holder_commitment_tx_conv);
1951 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) {
1952 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1953 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1954 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1955 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1956 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1957 *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, &holder_commitment_tx_conv);
1961 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) {
1962 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1963 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1964 FREE((void*)justice_tx);
1965 unsigned char per_commitment_key_arr[32];
1966 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1967 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1968 LDKHTLCOutputInCommitment htlc_conv;
1969 htlc_conv.inner = (void*)(htlc & (~1));
1970 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1971 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1972 *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1977 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1978 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1979 FREE((void*)htlc_tx);
1980 LDKPublicKey per_commitment_point_ref;
1981 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1982 LDKHTLCOutputInCommitment htlc_conv;
1983 htlc_conv.inner = (void*)(htlc & (~1));
1984 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1985 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1986 *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) {
1991 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1992 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1993 FREE((void*)closing_tx);
1994 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1995 *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv);
1999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
2000 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
2001 LDKUnsignedChannelAnnouncement msg_conv;
2002 msg_conv.inner = (void*)(msg & (~1));
2003 msg_conv.is_owned = (msg & 1) || (msg == 0);
2004 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2005 *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, &msg_conv);
2009 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) {
2010 LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
2011 LDKChannelPublicKeys channel_points_conv;
2012 channel_points_conv.inner = (void*)(channel_points & (~1));
2013 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2014 return (arg_conv->on_accept)(arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2017 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2018 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2019 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2020 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2021 for (size_t i = 0; i < vec->datalen; i++) {
2022 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2023 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2025 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2029 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2030 ret->datalen = (*env)->GetArrayLength(env, elems);
2031 if (ret->datalen == 0) {
2034 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2035 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2036 for (size_t i = 0; i < ret->datalen; i++) {
2037 jlong arr_elem = java_elems[i];
2038 LDKMonitorEvent arr_elem_conv;
2039 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2040 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2041 ret->data[i] = arr_elem_conv;
2043 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2047 typedef struct LDKWatch_JCalls {
2048 atomic_size_t refcnt;
2051 jmethodID watch_channel_meth;
2052 jmethodID update_channel_meth;
2053 jmethodID release_pending_monitor_events_meth;
2055 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2056 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2058 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2059 LDKOutPoint funding_txo_var = funding_txo;
2060 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2061 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2062 long funding_txo_ref;
2063 if (funding_txo_var.is_owned) {
2064 funding_txo_ref = (long)funding_txo_var.inner | 1;
2066 funding_txo_ref = (long)&funding_txo_var;
2068 LDKChannelMonitor monitor_var = monitor;
2069 DO_ASSERT((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2070 DO_ASSERT((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2072 if (monitor_var.is_owned) {
2073 monitor_ref = (long)monitor_var.inner | 1;
2075 monitor_ref = (long)&monitor_var;
2077 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2078 DO_ASSERT(obj != NULL);
2079 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2080 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2084 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2085 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2087 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2088 LDKOutPoint funding_txo_var = funding_txo;
2089 DO_ASSERT((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2090 DO_ASSERT((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2091 long funding_txo_ref;
2092 if (funding_txo_var.is_owned) {
2093 funding_txo_ref = (long)funding_txo_var.inner | 1;
2095 funding_txo_ref = (long)&funding_txo_var;
2097 LDKChannelMonitorUpdate update_var = update;
2098 DO_ASSERT((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2099 DO_ASSERT((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2101 if (update_var.is_owned) {
2102 update_ref = (long)update_var.inner | 1;
2104 update_ref = (long)&update_var;
2106 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2107 DO_ASSERT(obj != NULL);
2108 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2109 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2113 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2114 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2116 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2117 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2118 DO_ASSERT(obj != NULL);
2119 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2120 LDKCVec_MonitorEventZ res = *ret;
2124 static void LDKWatch_JCalls_free(void* this_arg) {
2125 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2126 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2128 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2129 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2133 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2134 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2135 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2136 return (void*) this_arg;
2138 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2139 jclass c = (*env)->GetObjectClass(env, o);
2140 DO_ASSERT(c != NULL);
2141 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2142 atomic_init(&calls->refcnt, 1);
2143 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2144 calls->o = (*env)->NewWeakGlobalRef(env, o);
2145 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2146 DO_ASSERT(calls->watch_channel_meth != NULL);
2147 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2148 DO_ASSERT(calls->update_channel_meth != NULL);
2149 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2150 DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
2153 .this_arg = (void*) calls,
2154 .watch_channel = watch_channel_jcall,
2155 .update_channel = update_channel_jcall,
2156 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2157 .free = LDKWatch_JCalls_free,
2161 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2162 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2163 *res_ptr = LDKWatch_init(env, _a, o);
2164 return (long)res_ptr;
2166 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2167 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2168 DO_ASSERT(ret != NULL);
2171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) {
2172 LDKWatch* arg_conv = (LDKWatch*)arg;
2173 LDKOutPoint funding_txo_conv;
2174 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2175 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2176 if (funding_txo_conv.inner != NULL)
2177 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2178 LDKChannelMonitor monitor_conv;
2179 monitor_conv.inner = (void*)(monitor & (~1));
2180 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2181 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2182 *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv);
2186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) {
2187 LDKWatch* arg_conv = (LDKWatch*)arg;
2188 LDKOutPoint funding_txo_conv;
2189 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2190 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2191 if (funding_txo_conv.inner != NULL)
2192 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2193 LDKChannelMonitorUpdate update_conv;
2194 update_conv.inner = (void*)(update & (~1));
2195 update_conv.is_owned = (update & 1) || (update == 0);
2196 if (update_conv.inner != NULL)
2197 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2198 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2199 *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv);
2203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) {
2204 LDKWatch* arg_conv = (LDKWatch*)arg;
2205 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2206 *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg);
2210 typedef struct LDKFilter_JCalls {
2211 atomic_size_t refcnt;
2214 jmethodID register_tx_meth;
2215 jmethodID register_output_meth;
2217 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2218 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2220 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2221 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2222 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2223 long script_pubkey_ref = (long)&script_pubkey;
2224 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2225 DO_ASSERT(obj != NULL);
2226 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
2228 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2229 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2231 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2232 long script_pubkey_ref = (long)&script_pubkey;
2233 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2234 DO_ASSERT(obj != NULL);
2235 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_ref);
2237 static void LDKFilter_JCalls_free(void* this_arg) {
2238 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2239 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2241 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2242 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2246 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2247 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2248 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2249 return (void*) this_arg;
2251 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2252 jclass c = (*env)->GetObjectClass(env, o);
2253 DO_ASSERT(c != NULL);
2254 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2255 atomic_init(&calls->refcnt, 1);
2256 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2257 calls->o = (*env)->NewWeakGlobalRef(env, o);
2258 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
2259 DO_ASSERT(calls->register_tx_meth != NULL);
2260 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
2261 DO_ASSERT(calls->register_output_meth != NULL);
2264 .this_arg = (void*) calls,
2265 .register_tx = register_tx_jcall,
2266 .register_output = register_output_jcall,
2267 .free = LDKFilter_JCalls_free,
2271 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2272 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2273 *res_ptr = LDKFilter_init(env, _a, o);
2274 return (long)res_ptr;
2276 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2277 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2278 DO_ASSERT(ret != NULL);
2281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) {
2282 LDKFilter* arg_conv = (LDKFilter*)arg;
2283 unsigned char txid_arr[32];
2284 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2285 unsigned char (*txid_ref)[32] = &txid_arr;
2286 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2287 return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv);
2290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) {
2291 LDKFilter* arg_conv = (LDKFilter*)arg;
2292 LDKOutPoint outpoint_conv;
2293 outpoint_conv.inner = (void*)(outpoint & (~1));
2294 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2295 LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
2296 return (arg_conv->register_output)(arg_conv->this_arg, &outpoint_conv, script_pubkey_conv);
2299 typedef struct LDKBroadcasterInterface_JCalls {
2300 atomic_size_t refcnt;
2303 jmethodID broadcast_transaction_meth;
2304 } LDKBroadcasterInterface_JCalls;
2305 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2306 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2308 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2309 long tx_ref = (long)&tx;
2310 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2311 DO_ASSERT(obj != NULL);
2312 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2314 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2315 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2316 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2318 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2319 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2323 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2324 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2326 return (void*) this_arg;
2328 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2329 jclass c = (*env)->GetObjectClass(env, o);
2330 DO_ASSERT(c != NULL);
2331 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2332 atomic_init(&calls->refcnt, 1);
2333 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2334 calls->o = (*env)->NewWeakGlobalRef(env, o);
2335 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2336 DO_ASSERT(calls->broadcast_transaction_meth != NULL);
2338 LDKBroadcasterInterface ret = {
2339 .this_arg = (void*) calls,
2340 .broadcast_transaction = broadcast_transaction_jcall,
2341 .free = LDKBroadcasterInterface_JCalls_free,
2345 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2346 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2347 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2348 return (long)res_ptr;
2350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2351 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2352 DO_ASSERT(ret != NULL);
2355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) {
2356 LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg;
2357 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2359 return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv);
2362 typedef struct LDKFeeEstimator_JCalls {
2363 atomic_size_t refcnt;
2366 jmethodID get_est_sat_per_1000_weight_meth;
2367 } LDKFeeEstimator_JCalls;
2368 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2369 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2371 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2372 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2373 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2374 DO_ASSERT(obj != NULL);
2375 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2377 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2378 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2379 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2381 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2382 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2386 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2387 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2388 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2389 return (void*) this_arg;
2391 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2392 jclass c = (*env)->GetObjectClass(env, o);
2393 DO_ASSERT(c != NULL);
2394 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2395 atomic_init(&calls->refcnt, 1);
2396 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2397 calls->o = (*env)->NewWeakGlobalRef(env, o);
2398 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2399 DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
2401 LDKFeeEstimator ret = {
2402 .this_arg = (void*) calls,
2403 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2404 .free = LDKFeeEstimator_JCalls_free,
2408 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2409 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2410 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2411 return (long)res_ptr;
2413 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2414 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2415 DO_ASSERT(ret != NULL);
2418 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) {
2419 LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg;
2420 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2421 return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv);
2424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2425 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2429 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2430 ret->datalen = (*env)->GetArrayLength(env, elems);
2431 if (ret->datalen == 0) {
2434 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2435 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2436 for (size_t i = 0; i < ret->datalen; i++) {
2437 jlong arr_elem = java_elems[i];
2438 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2439 FREE((void*)arr_elem);
2440 ret->data[i] = arr_elem_conv;
2442 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2446 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2447 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2448 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2451 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2452 ret->datalen = (*env)->GetArrayLength(env, elems);
2453 if (ret->datalen == 0) {
2456 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2457 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2458 for (size_t i = 0; i < ret->datalen; i++) {
2459 jlong arr_elem = java_elems[i];
2460 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2461 FREE((void*)arr_elem);
2462 ret->data[i] = arr_elem_conv;
2464 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2468 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2469 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2470 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2473 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2474 ret->datalen = (*env)->GetArrayLength(env, elems);
2475 if (ret->datalen == 0) {
2478 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2479 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2480 for (size_t i = 0; i < ret->datalen; i++) {
2481 jlong arr_elem = java_elems[i];
2482 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2483 FREE((void*)arr_elem);
2484 ret->data[i] = arr_elem_conv;
2486 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2490 typedef struct LDKKeysInterface_JCalls {
2491 atomic_size_t refcnt;
2494 jmethodID get_node_secret_meth;
2495 jmethodID get_destination_script_meth;
2496 jmethodID get_shutdown_pubkey_meth;
2497 jmethodID get_channel_keys_meth;
2498 jmethodID get_secure_random_bytes_meth;
2499 } LDKKeysInterface_JCalls;
2500 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2501 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2503 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2504 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2505 DO_ASSERT(obj != NULL);
2506 LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, obj, j_calls->get_node_secret_meth);
2507 LDKSecretKey res = *ret;
2511 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2512 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2514 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2515 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2516 DO_ASSERT(obj != NULL);
2517 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2518 LDKCVec_u8Z res = *ret;
2522 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2523 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2525 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2526 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2527 DO_ASSERT(obj != NULL);
2528 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2530 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2533 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2534 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2536 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2537 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2538 DO_ASSERT(obj != NULL);
2539 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2540 LDKChannelKeys res = *ret;
2544 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2545 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2547 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2548 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2549 DO_ASSERT(obj != NULL);
2550 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2551 LDKThirtyTwoBytes ret;
2552 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2555 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2556 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2557 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2559 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2560 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2564 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2565 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2566 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2567 return (void*) this_arg;
2569 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2570 jclass c = (*env)->GetObjectClass(env, o);
2571 DO_ASSERT(c != NULL);
2572 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2573 atomic_init(&calls->refcnt, 1);
2574 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2575 calls->o = (*env)->NewWeakGlobalRef(env, o);
2576 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
2577 DO_ASSERT(calls->get_node_secret_meth != NULL);
2578 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2579 DO_ASSERT(calls->get_destination_script_meth != NULL);
2580 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2581 DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
2582 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2583 DO_ASSERT(calls->get_channel_keys_meth != NULL);
2584 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2585 DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
2587 LDKKeysInterface ret = {
2588 .this_arg = (void*) calls,
2589 .get_node_secret = get_node_secret_jcall,
2590 .get_destination_script = get_destination_script_jcall,
2591 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2592 .get_channel_keys = get_channel_keys_jcall,
2593 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2594 .free = LDKKeysInterface_JCalls_free,
2598 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2599 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2600 *res_ptr = LDKKeysInterface_init(env, _a, o);
2601 return (long)res_ptr;
2603 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2604 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2605 DO_ASSERT(ret != NULL);
2608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) {
2609 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2610 LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
2611 *ret = (arg_conv->get_node_secret)(arg_conv->this_arg);
2615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) {
2616 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2617 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2618 *ret = (arg_conv->get_destination_script)(arg_conv->this_arg);
2622 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) {
2623 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2624 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2625 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg).compressed_form);
2629 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) {
2630 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2631 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2632 *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis);
2636 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) {
2637 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
2638 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2639 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (arg_conv->get_secure_random_bytes)(arg_conv->this_arg).data);
2643 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2644 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2645 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2646 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2647 for (size_t i = 0; i < vec->datalen; i++) {
2648 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
2649 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2651 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2655 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2656 ret->datalen = (*env)->GetArrayLength(env, elems);
2657 if (ret->datalen == 0) {
2660 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2661 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2662 for (size_t i = 0; i < ret->datalen; i++) {
2663 jlong arr_elem = java_elems[i];
2664 LDKChannelDetails arr_elem_conv;
2665 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2666 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2667 ret->data[i] = arr_elem_conv;
2669 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2673 static jclass LDKNetAddress_IPv4_class = NULL;
2674 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2675 static jclass LDKNetAddress_IPv6_class = NULL;
2676 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2677 static jclass LDKNetAddress_OnionV2_class = NULL;
2678 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2679 static jclass LDKNetAddress_OnionV3_class = NULL;
2680 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2682 LDKNetAddress_IPv4_class =
2683 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2684 DO_ASSERT(LDKNetAddress_IPv4_class != NULL);
2685 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2686 DO_ASSERT(LDKNetAddress_IPv4_meth != NULL);
2687 LDKNetAddress_IPv6_class =
2688 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2689 DO_ASSERT(LDKNetAddress_IPv6_class != NULL);
2690 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2691 DO_ASSERT(LDKNetAddress_IPv6_meth != NULL);
2692 LDKNetAddress_OnionV2_class =
2693 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2694 DO_ASSERT(LDKNetAddress_OnionV2_class != NULL);
2695 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2696 DO_ASSERT(LDKNetAddress_OnionV2_meth != NULL);
2697 LDKNetAddress_OnionV3_class =
2698 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2699 DO_ASSERT(LDKNetAddress_OnionV3_class != NULL);
2700 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2701 DO_ASSERT(LDKNetAddress_OnionV3_meth != NULL);
2703 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2704 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2706 case LDKNetAddress_IPv4: {
2707 long addr_ref = (long)&obj->i_pv4.addr;
2708 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2710 case LDKNetAddress_IPv6: {
2711 long addr_ref = (long)&obj->i_pv6.addr;
2712 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2714 case LDKNetAddress_OnionV2: {
2715 long addr_ref = (long)&obj->onion_v2.addr;
2716 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2718 case LDKNetAddress_OnionV3: {
2719 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2720 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2721 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);
2726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2727 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2728 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2731 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2732 ret->datalen = (*env)->GetArrayLength(env, elems);
2733 if (ret->datalen == 0) {
2736 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2737 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2738 for (size_t i = 0; i < ret->datalen; i++) {
2739 jlong arr_elem = java_elems[i];
2740 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2741 FREE((void*)arr_elem);
2742 ret->data[i] = arr_elem_conv;
2744 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2748 typedef struct LDKChannelMessageHandler_JCalls {
2749 atomic_size_t refcnt;
2752 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2753 jmethodID handle_open_channel_meth;
2754 jmethodID handle_accept_channel_meth;
2755 jmethodID handle_funding_created_meth;
2756 jmethodID handle_funding_signed_meth;
2757 jmethodID handle_funding_locked_meth;
2758 jmethodID handle_shutdown_meth;
2759 jmethodID handle_closing_signed_meth;
2760 jmethodID handle_update_add_htlc_meth;
2761 jmethodID handle_update_fulfill_htlc_meth;
2762 jmethodID handle_update_fail_htlc_meth;
2763 jmethodID handle_update_fail_malformed_htlc_meth;
2764 jmethodID handle_commitment_signed_meth;
2765 jmethodID handle_revoke_and_ack_meth;
2766 jmethodID handle_update_fee_meth;
2767 jmethodID handle_announcement_signatures_meth;
2768 jmethodID peer_disconnected_meth;
2769 jmethodID peer_connected_meth;
2770 jmethodID handle_channel_reestablish_meth;
2771 jmethodID handle_error_meth;
2772 } LDKChannelMessageHandler_JCalls;
2773 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2774 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2777 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2778 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2779 LDKInitFeatures their_features_var = their_features;
2780 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2781 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2782 long their_features_ref;
2783 if (their_features_var.is_owned) {
2784 their_features_ref = (long)their_features_var.inner | 1;
2786 their_features_ref = (long)&their_features_var;
2788 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2789 DO_ASSERT(obj != NULL);
2790 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2792 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2793 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2795 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2796 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2797 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2798 LDKInitFeatures their_features_var = their_features;
2799 DO_ASSERT((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2800 DO_ASSERT((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2801 long their_features_ref;
2802 if (their_features_var.is_owned) {
2803 their_features_ref = (long)their_features_var.inner | 1;
2805 their_features_ref = (long)&their_features_var;
2807 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2808 DO_ASSERT(obj != NULL);
2809 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2811 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2812 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2814 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2815 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2816 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2817 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2818 DO_ASSERT(obj != NULL);
2819 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2821 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2822 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2824 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2825 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2826 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2827 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2828 DO_ASSERT(obj != NULL);
2829 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2831 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2832 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2834 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2835 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2836 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2837 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2838 DO_ASSERT(obj != NULL);
2839 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2841 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2842 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2844 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2845 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2846 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2847 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2848 DO_ASSERT(obj != NULL);
2849 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2851 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2852 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2855 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2856 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2857 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2858 DO_ASSERT(obj != NULL);
2859 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2861 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2862 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2864 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2865 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2866 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2867 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2868 DO_ASSERT(obj != NULL);
2869 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2871 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2872 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2874 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2875 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2876 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2877 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2878 DO_ASSERT(obj != NULL);
2879 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2881 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2882 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2884 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2885 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2886 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2887 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2888 DO_ASSERT(obj != NULL);
2889 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2891 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2892 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2894 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2895 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2896 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2897 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2898 DO_ASSERT(obj != NULL);
2899 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2901 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2902 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2904 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2905 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2906 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2907 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2908 DO_ASSERT(obj != NULL);
2909 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2911 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2912 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2914 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2915 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2916 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2917 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2918 DO_ASSERT(obj != NULL);
2919 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2921 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2922 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2925 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2926 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2927 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2928 DO_ASSERT(obj != NULL);
2929 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2931 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2932 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2934 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2935 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2936 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2937 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2938 DO_ASSERT(obj != NULL);
2939 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2941 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2942 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2944 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2945 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2946 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2947 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2948 DO_ASSERT(obj != NULL);
2949 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2951 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2952 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2954 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2955 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2956 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2957 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2958 DO_ASSERT(obj != NULL);
2959 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
2961 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2962 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2964 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2965 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2966 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2967 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2968 DO_ASSERT(obj != NULL);
2969 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2971 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2972 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2974 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2975 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2976 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2977 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2978 DO_ASSERT(obj != NULL);
2979 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
2981 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2982 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2983 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2985 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2986 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2990 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2991 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2992 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2993 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
2994 return (void*) this_arg;
2996 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
2997 jclass c = (*env)->GetObjectClass(env, o);
2998 DO_ASSERT(c != NULL);
2999 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3000 atomic_init(&calls->refcnt, 1);
3001 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3002 calls->o = (*env)->NewWeakGlobalRef(env, o);
3003 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3004 DO_ASSERT(calls->handle_open_channel_meth != NULL);
3005 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3006 DO_ASSERT(calls->handle_accept_channel_meth != NULL);
3007 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3008 DO_ASSERT(calls->handle_funding_created_meth != NULL);
3009 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3010 DO_ASSERT(calls->handle_funding_signed_meth != NULL);
3011 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3012 DO_ASSERT(calls->handle_funding_locked_meth != NULL);
3013 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3014 DO_ASSERT(calls->handle_shutdown_meth != NULL);
3015 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3016 DO_ASSERT(calls->handle_closing_signed_meth != NULL);
3017 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3018 DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
3019 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3020 DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
3021 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3022 DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
3023 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3024 DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
3025 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3026 DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
3027 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3028 DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
3029 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3030 DO_ASSERT(calls->handle_update_fee_meth != NULL);
3031 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3032 DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
3033 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3034 DO_ASSERT(calls->peer_disconnected_meth != NULL);
3035 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3036 DO_ASSERT(calls->peer_connected_meth != NULL);
3037 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3038 DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
3039 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3040 DO_ASSERT(calls->handle_error_meth != NULL);
3042 LDKChannelMessageHandler ret = {
3043 .this_arg = (void*) calls,
3044 .handle_open_channel = handle_open_channel_jcall,
3045 .handle_accept_channel = handle_accept_channel_jcall,
3046 .handle_funding_created = handle_funding_created_jcall,
3047 .handle_funding_signed = handle_funding_signed_jcall,
3048 .handle_funding_locked = handle_funding_locked_jcall,
3049 .handle_shutdown = handle_shutdown_jcall,
3050 .handle_closing_signed = handle_closing_signed_jcall,
3051 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3052 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3053 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3054 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3055 .handle_commitment_signed = handle_commitment_signed_jcall,
3056 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3057 .handle_update_fee = handle_update_fee_jcall,
3058 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3059 .peer_disconnected = peer_disconnected_jcall,
3060 .peer_connected = peer_connected_jcall,
3061 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3062 .handle_error = handle_error_jcall,
3063 .free = LDKChannelMessageHandler_JCalls_free,
3064 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3066 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3069 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3070 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3071 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3072 return (long)res_ptr;
3074 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3075 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3076 DO_ASSERT(ret != NULL);
3079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3080 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3081 LDKPublicKey their_node_id_ref;
3082 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3083 LDKInitFeatures their_features_conv;
3084 their_features_conv.inner = (void*)(their_features & (~1));
3085 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3086 LDKOpenChannel msg_conv;
3087 msg_conv.inner = (void*)(msg & (~1));
3088 msg_conv.is_owned = (msg & 1) || (msg == 0);
3089 return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3093 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3094 LDKPublicKey their_node_id_ref;
3095 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3096 LDKInitFeatures their_features_conv;
3097 their_features_conv.inner = (void*)(their_features & (~1));
3098 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3099 LDKAcceptChannel msg_conv;
3100 msg_conv.inner = (void*)(msg & (~1));
3101 msg_conv.is_owned = (msg & 1) || (msg == 0);
3102 return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3106 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3107 LDKPublicKey their_node_id_ref;
3108 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3109 LDKFundingCreated msg_conv;
3110 msg_conv.inner = (void*)(msg & (~1));
3111 msg_conv.is_owned = (msg & 1) || (msg == 0);
3112 return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3116 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3117 LDKPublicKey their_node_id_ref;
3118 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3119 LDKFundingSigned msg_conv;
3120 msg_conv.inner = (void*)(msg & (~1));
3121 msg_conv.is_owned = (msg & 1) || (msg == 0);
3122 return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3126 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3127 LDKPublicKey their_node_id_ref;
3128 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3129 LDKFundingLocked msg_conv;
3130 msg_conv.inner = (void*)(msg & (~1));
3131 msg_conv.is_owned = (msg & 1) || (msg == 0);
3132 return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3136 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3137 LDKPublicKey their_node_id_ref;
3138 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3139 LDKShutdown msg_conv;
3140 msg_conv.inner = (void*)(msg & (~1));
3141 msg_conv.is_owned = (msg & 1) || (msg == 0);
3142 return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3146 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3147 LDKPublicKey their_node_id_ref;
3148 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3149 LDKClosingSigned msg_conv;
3150 msg_conv.inner = (void*)(msg & (~1));
3151 msg_conv.is_owned = (msg & 1) || (msg == 0);
3152 return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3156 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3157 LDKPublicKey their_node_id_ref;
3158 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3159 LDKUpdateAddHTLC msg_conv;
3160 msg_conv.inner = (void*)(msg & (~1));
3161 msg_conv.is_owned = (msg & 1) || (msg == 0);
3162 return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3166 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3167 LDKPublicKey their_node_id_ref;
3168 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3169 LDKUpdateFulfillHTLC msg_conv;
3170 msg_conv.inner = (void*)(msg & (~1));
3171 msg_conv.is_owned = (msg & 1) || (msg == 0);
3172 return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3176 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3177 LDKPublicKey their_node_id_ref;
3178 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3179 LDKUpdateFailHTLC msg_conv;
3180 msg_conv.inner = (void*)(msg & (~1));
3181 msg_conv.is_owned = (msg & 1) || (msg == 0);
3182 return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3186 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3187 LDKPublicKey their_node_id_ref;
3188 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3189 LDKUpdateFailMalformedHTLC msg_conv;
3190 msg_conv.inner = (void*)(msg & (~1));
3191 msg_conv.is_owned = (msg & 1) || (msg == 0);
3192 return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3196 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3197 LDKPublicKey their_node_id_ref;
3198 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3199 LDKCommitmentSigned msg_conv;
3200 msg_conv.inner = (void*)(msg & (~1));
3201 msg_conv.is_owned = (msg & 1) || (msg == 0);
3202 return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3206 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3207 LDKPublicKey their_node_id_ref;
3208 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3209 LDKRevokeAndACK msg_conv;
3210 msg_conv.inner = (void*)(msg & (~1));
3211 msg_conv.is_owned = (msg & 1) || (msg == 0);
3212 return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3216 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3217 LDKPublicKey their_node_id_ref;
3218 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3219 LDKUpdateFee msg_conv;
3220 msg_conv.inner = (void*)(msg & (~1));
3221 msg_conv.is_owned = (msg & 1) || (msg == 0);
3222 return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3226 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3227 LDKPublicKey their_node_id_ref;
3228 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3229 LDKAnnouncementSignatures msg_conv;
3230 msg_conv.inner = (void*)(msg & (~1));
3231 msg_conv.is_owned = (msg & 1) || (msg == 0);
3232 return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jboolean no_connection_possible) {
3236 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3237 LDKPublicKey their_node_id_ref;
3238 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3239 return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3243 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3244 LDKPublicKey their_node_id_ref;
3245 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3247 msg_conv.inner = (void*)(msg & (~1));
3248 msg_conv.is_owned = (msg & 1) || (msg == 0);
3249 return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3253 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3254 LDKPublicKey their_node_id_ref;
3255 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3256 LDKChannelReestablish msg_conv;
3257 msg_conv.inner = (void*)(msg & (~1));
3258 msg_conv.is_owned = (msg & 1) || (msg == 0);
3259 return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jbyteArray their_node_id, jlong msg) {
3263 LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
3264 LDKPublicKey their_node_id_ref;
3265 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3266 LDKErrorMessage msg_conv;
3267 msg_conv.inner = (void*)(msg & (~1));
3268 msg_conv.is_owned = (msg & 1) || (msg == 0);
3269 return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_ref, &msg_conv);
3272 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3273 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3274 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3275 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3276 for (size_t i = 0; i < vec->datalen; i++) {
3277 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3278 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3280 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3284 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3285 ret->datalen = (*env)->GetArrayLength(env, elems);
3286 if (ret->datalen == 0) {
3289 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3290 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3291 for (size_t i = 0; i < ret->datalen; i++) {
3292 jlong arr_elem = java_elems[i];
3293 LDKChannelMonitor arr_elem_conv;
3294 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3295 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3296 ret->data[i] = arr_elem_conv;
3298 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3302 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3303 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3304 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3307 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3308 ret->datalen = (*env)->GetArrayLength(env, elems);
3309 if (ret->datalen == 0) {
3312 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3313 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3314 for (size_t i = 0; i < ret->datalen; i++) {
3315 ret->data[i] = java_elems[i];
3317 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3321 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3322 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3323 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3324 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3325 for (size_t i = 0; i < vec->datalen; i++) {
3326 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3327 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3329 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3333 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3334 ret->datalen = (*env)->GetArrayLength(env, elems);
3335 if (ret->datalen == 0) {
3338 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3339 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3340 for (size_t i = 0; i < ret->datalen; i++) {
3341 jlong arr_elem = java_elems[i];
3342 LDKUpdateAddHTLC arr_elem_conv;
3343 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3344 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3345 if (arr_elem_conv.inner != NULL)
3346 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3347 ret->data[i] = arr_elem_conv;
3349 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3353 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3354 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3355 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3356 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3357 for (size_t i = 0; i < vec->datalen; i++) {
3358 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3359 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3361 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3365 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3366 ret->datalen = (*env)->GetArrayLength(env, elems);
3367 if (ret->datalen == 0) {
3370 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3371 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3372 for (size_t i = 0; i < ret->datalen; i++) {
3373 jlong arr_elem = java_elems[i];
3374 LDKUpdateFulfillHTLC arr_elem_conv;
3375 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3376 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3377 if (arr_elem_conv.inner != NULL)
3378 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3379 ret->data[i] = arr_elem_conv;
3381 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3385 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3386 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3387 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3388 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3389 for (size_t i = 0; i < vec->datalen; i++) {
3390 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3391 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3393 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3397 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3398 ret->datalen = (*env)->GetArrayLength(env, elems);
3399 if (ret->datalen == 0) {
3402 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3403 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3404 for (size_t i = 0; i < ret->datalen; i++) {
3405 jlong arr_elem = java_elems[i];
3406 LDKUpdateFailHTLC arr_elem_conv;
3407 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3408 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3409 if (arr_elem_conv.inner != NULL)
3410 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3411 ret->data[i] = arr_elem_conv;
3413 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3417 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3418 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3419 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3420 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3421 for (size_t i = 0; i < vec->datalen; i++) {
3422 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3423 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3425 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3429 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3430 ret->datalen = (*env)->GetArrayLength(env, elems);
3431 if (ret->datalen == 0) {
3434 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3435 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3436 for (size_t i = 0; i < ret->datalen; i++) {
3437 jlong arr_elem = java_elems[i];
3438 LDKUpdateFailMalformedHTLC arr_elem_conv;
3439 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3440 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3441 if (arr_elem_conv.inner != NULL)
3442 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3443 ret->data[i] = arr_elem_conv;
3445 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3450 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3453 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3454 if (val->result_ok) {
3455 return (long)val->contents.result;
3457 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3461 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3462 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3465 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3466 ret->datalen = (*env)->GetArrayLength(env, elems);
3467 if (ret->datalen == 0) {
3470 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3471 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3472 for (size_t i = 0; i < ret->datalen; i++) {
3473 jlong arr_elem = java_elems[i];
3474 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3475 FREE((void*)arr_elem);
3476 ret->data[i] = arr_elem_conv;
3478 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3482 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3483 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3484 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3485 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3486 for (size_t i = 0; i < vec->datalen; i++) {
3487 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3488 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3490 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3494 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3495 ret->datalen = (*env)->GetArrayLength(env, elems);
3496 if (ret->datalen == 0) {
3499 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3500 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3501 for (size_t i = 0; i < ret->datalen; i++) {
3502 jlong arr_elem = java_elems[i];
3503 LDKNodeAnnouncement arr_elem_conv;
3504 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3505 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3506 if (arr_elem_conv.inner != NULL)
3507 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3508 ret->data[i] = arr_elem_conv;
3510 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3514 typedef struct LDKRoutingMessageHandler_JCalls {
3515 atomic_size_t refcnt;
3518 jmethodID handle_node_announcement_meth;
3519 jmethodID handle_channel_announcement_meth;
3520 jmethodID handle_channel_update_meth;
3521 jmethodID handle_htlc_fail_channel_update_meth;
3522 jmethodID get_next_channel_announcements_meth;
3523 jmethodID get_next_node_announcements_meth;
3524 jmethodID should_request_full_sync_meth;
3525 } LDKRoutingMessageHandler_JCalls;
3526 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3527 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3529 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3530 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3531 DO_ASSERT(obj != NULL);
3532 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3533 LDKCResult_boolLightningErrorZ res = *ret;
3537 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3538 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3540 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3541 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3542 DO_ASSERT(obj != NULL);
3543 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3544 LDKCResult_boolLightningErrorZ res = *ret;
3548 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3549 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3552 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3553 DO_ASSERT(obj != NULL);
3554 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3555 LDKCResult_boolLightningErrorZ res = *ret;
3559 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3560 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3562 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3564 DO_ASSERT(obj != NULL);
3565 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3567 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3568 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3570 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3571 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3572 DO_ASSERT(obj != NULL);
3573 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3574 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3578 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3579 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3581 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3582 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3583 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3584 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3585 DO_ASSERT(obj != NULL);
3586 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3587 LDKCVec_NodeAnnouncementZ res = *ret;
3591 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3592 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3594 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3595 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3596 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3597 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3598 DO_ASSERT(obj != NULL);
3599 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3601 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3602 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3603 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3605 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3606 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3610 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3611 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3612 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3613 return (void*) this_arg;
3615 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3616 jclass c = (*env)->GetObjectClass(env, o);
3617 DO_ASSERT(c != NULL);
3618 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3619 atomic_init(&calls->refcnt, 1);
3620 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3621 calls->o = (*env)->NewWeakGlobalRef(env, o);
3622 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3623 DO_ASSERT(calls->handle_node_announcement_meth != NULL);
3624 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3625 DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
3626 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3627 DO_ASSERT(calls->handle_channel_update_meth != NULL);
3628 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3629 DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
3630 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3631 DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
3632 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3633 DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
3634 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3635 DO_ASSERT(calls->should_request_full_sync_meth != NULL);
3637 LDKRoutingMessageHandler ret = {
3638 .this_arg = (void*) calls,
3639 .handle_node_announcement = handle_node_announcement_jcall,
3640 .handle_channel_announcement = handle_channel_announcement_jcall,
3641 .handle_channel_update = handle_channel_update_jcall,
3642 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3643 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3644 .get_next_node_announcements = get_next_node_announcements_jcall,
3645 .should_request_full_sync = should_request_full_sync_jcall,
3646 .free = LDKRoutingMessageHandler_JCalls_free,
3650 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3651 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3652 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3653 return (long)res_ptr;
3655 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3656 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3657 DO_ASSERT(ret != NULL);
3660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3661 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3662 LDKNodeAnnouncement msg_conv;
3663 msg_conv.inner = (void*)(msg & (~1));
3664 msg_conv.is_owned = (msg & 1) || (msg == 0);
3665 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3666 *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, &msg_conv);
3670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3671 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3672 LDKChannelAnnouncement msg_conv;
3673 msg_conv.inner = (void*)(msg & (~1));
3674 msg_conv.is_owned = (msg & 1) || (msg == 0);
3675 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3676 *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, &msg_conv);
3680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
3681 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3682 LDKChannelUpdate msg_conv;
3683 msg_conv.inner = (void*)(msg & (~1));
3684 msg_conv.is_owned = (msg & 1) || (msg == 0);
3685 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3686 *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, &msg_conv);
3690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) {
3691 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3692 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3693 return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv);
3696 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) {
3697 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3698 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3699 *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount);
3703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong arg, jbyteArray starting_point, jbyte batch_amount) {
3704 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3705 LDKPublicKey starting_point_ref;
3706 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3707 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3708 *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_ref, batch_amount);
3712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jbyteArray node_id) {
3713 LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
3714 LDKPublicKey node_id_ref;
3715 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3716 return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_ref);
3719 typedef struct LDKSocketDescriptor_JCalls {
3720 atomic_size_t refcnt;
3723 jmethodID send_data_meth;
3724 jmethodID disconnect_socket_meth;
3726 jmethodID hash_meth;
3727 } LDKSocketDescriptor_JCalls;
3728 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3729 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3731 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3732 long data_ref = (long)&data;
3733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3734 DO_ASSERT(obj != NULL);
3735 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_ref, resume_read);
3737 void disconnect_socket_jcall(void* this_arg) {
3738 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3742 DO_ASSERT(obj != NULL);
3743 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3745 bool eq_jcall(const void* this_arg, const void *other_arg) {
3746 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3748 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3749 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3750 DO_ASSERT(obj != NULL);
3751 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3753 uint64_t hash_jcall(const void* this_arg) {
3754 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3756 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3757 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3758 DO_ASSERT(obj != NULL);
3759 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3761 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3762 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3763 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3765 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3766 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3770 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3771 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3772 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3773 return (void*) this_arg;
3775 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3776 jclass c = (*env)->GetObjectClass(env, o);
3777 DO_ASSERT(c != NULL);
3778 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3779 atomic_init(&calls->refcnt, 1);
3780 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3781 calls->o = (*env)->NewWeakGlobalRef(env, o);
3782 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
3783 DO_ASSERT(calls->send_data_meth != NULL);
3784 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3785 DO_ASSERT(calls->disconnect_socket_meth != NULL);
3786 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3787 DO_ASSERT(calls->eq_meth != NULL);
3788 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3789 DO_ASSERT(calls->hash_meth != NULL);
3791 LDKSocketDescriptor ret = {
3792 .this_arg = (void*) calls,
3793 .send_data = send_data_jcall,
3794 .disconnect_socket = disconnect_socket_jcall,
3797 .clone = LDKSocketDescriptor_JCalls_clone,
3798 .free = LDKSocketDescriptor_JCalls_free,
3802 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3803 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3804 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3805 return (long)res_ptr;
3807 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3808 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3809 DO_ASSERT(ret != NULL);
3812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) {
3813 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3814 LDKu8slice data_conv = *(LDKu8slice*)data;
3815 return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read);
3818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) {
3819 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3820 return (arg_conv->disconnect_socket)(arg_conv->this_arg);
3823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) {
3824 LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
3825 return (arg_conv->hash)(arg_conv->this_arg);
3828 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3829 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3830 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3833 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3836 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3837 if (val->result_ok) {
3838 return (long)val->contents.result;
3840 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3844 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3847 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3848 if (val->result_ok) {
3849 return (long)val->contents.result;
3851 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3854 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3855 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3858 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3859 if (val->result_ok) {
3860 return (long)val->contents.result;
3862 return (long)val->contents.err;
3865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3866 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3869 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3870 if (val->result_ok) {
3871 return (long)val->contents.result;
3873 return (long)val->contents.err;
3876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3877 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3880 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3881 if (val->result_ok) {
3882 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3884 return (long)val->contents.err;
3887 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3888 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3889 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3892 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3893 ret->datalen = (*env)->GetArrayLength(env, elems);
3894 if (ret->datalen == 0) {
3897 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3898 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3899 for (size_t i = 0; i < ret->datalen; i++) {
3900 jlong arr_elem = java_elems[i];
3901 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3902 FREE((void*)arr_elem);
3903 ret->data[i] = arr_elem_conv;
3905 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3909 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3910 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3911 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3912 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3913 for (size_t i = 0; i < vec->datalen; i++) {
3914 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3915 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3917 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3921 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3922 ret->datalen = (*env)->GetArrayLength(env, elems);
3923 if (ret->datalen == 0) {
3926 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3927 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3928 for (size_t i = 0; i < ret->datalen; i++) {
3929 jlong arr_elem = java_elems[i];
3930 LDKRouteHop arr_elem_conv;
3931 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3932 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3933 if (arr_elem_conv.inner != NULL)
3934 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3935 ret->data[i] = arr_elem_conv;
3937 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3941 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3942 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3943 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3946 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3947 ret->datalen = (*env)->GetArrayLength(env, elems);
3948 if (ret->datalen == 0) {
3951 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3952 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3953 for (size_t i = 0; i < ret->datalen; i++) {
3954 jlong arr_elem = java_elems[i];
3955 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3956 FREE((void*)arr_elem);
3957 ret->data[i] = arr_elem_conv;
3959 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3964 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3967 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3968 if (val->result_ok) {
3969 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3971 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3974 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3975 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
3976 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3977 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3978 for (size_t i = 0; i < vec->datalen; i++) {
3979 DO_ASSERT((((long)vec->data[i].inner) & 1) == 0);
3980 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3982 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
3986 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
3987 ret->datalen = (*env)->GetArrayLength(env, elems);
3988 if (ret->datalen == 0) {
3991 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
3992 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3993 for (size_t i = 0; i < ret->datalen; i++) {
3994 jlong arr_elem = java_elems[i];
3995 LDKRouteHint arr_elem_conv;
3996 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3997 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3998 ret->data[i] = arr_elem_conv;
4000 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4005 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4007 return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4011 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4013 return C2Tuple_OutPointScriptZ_free(arg_conv);
4016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4017 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4019 return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4023 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4025 return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4029 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4031 return C2Tuple_u64u64Z_free(arg_conv);
4034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4035 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4037 return C2Tuple_usizeTransactionZ_free(arg_conv);
4040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4041 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4043 return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4047 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4049 return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4053 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4055 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4056 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4061 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4063 return CResult_CVec_SignatureZNoneZ_free(arg_conv);
4066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4067 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4069 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4070 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4075 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4077 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4078 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4083 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4085 return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4089 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4091 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4092 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4097 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4099 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4100 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4105 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4107 return CResult_NoneAPIErrorZ_free(arg_conv);
4110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4111 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4113 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4114 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4119 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4121 return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4125 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4127 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4128 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4133 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4135 return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4139 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4141 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4142 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4147 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4149 return CResult_NonePaymentSendFailureZ_free(arg_conv);
4152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4153 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4155 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4156 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4161 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4163 return CResult_NonePeerHandleErrorZ_free(arg_conv);
4166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4167 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4169 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4170 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4175 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4177 return CResult_PublicKeySecpErrorZ_free(arg_conv);
4180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4181 LDKPublicKey arg_ref;
4182 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4183 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4184 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4189 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4191 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4192 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4197 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4199 return CResult_RouteLightningErrorZ_free(arg_conv);
4202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4203 LDKRoute arg_conv = *(LDKRoute*)arg;
4205 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4206 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4211 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4213 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4214 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4219 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4221 return CResult_SecretKeySecpErrorZ_free(arg_conv);
4224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4225 LDKSecretKey arg_conv = *(LDKSecretKey*)arg;
4227 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4228 *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv);
4232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4233 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4235 return CResult_SignatureNoneZ_free(arg_conv);
4238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4239 LDKSignature arg_conv = *(LDKSignature*)arg;
4241 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4242 *ret = CResult_SignatureNoneZ_ok(arg_conv);
4246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4247 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4249 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4250 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4255 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4257 return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4261 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4263 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4264 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4269 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4271 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4272 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4277 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4279 return CResult_TxOutAccessErrorZ_free(arg_conv);
4282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4283 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4285 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4286 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4291 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4293 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4294 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4299 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4301 return CResult_boolLightningErrorZ_free(arg_conv);
4304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4305 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4306 *ret = CResult_boolLightningErrorZ_ok(arg);
4310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4311 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4313 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4314 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4319 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4321 return CResult_boolPeerHandleErrorZ_free(arg_conv);
4324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4325 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4326 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4331 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4333 return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4337 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4339 return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4343 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4345 return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4349 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4351 return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4355 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4357 return CVec_CVec_RouteHopZZ_free(arg_conv);
4360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4361 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4363 return CVec_ChannelDetailsZ_free(arg_conv);
4366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4367 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4369 return CVec_ChannelMonitorZ_free(arg_conv);
4372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4373 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4375 return CVec_EventZ_free(arg_conv);
4378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4379 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4381 return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4385 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4387 return CVec_MessageSendEventZ_free(arg_conv);
4390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4391 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4393 return CVec_MonitorEventZ_free(arg_conv);
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4397 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4399 return CVec_NetAddressZ_free(arg_conv);
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4403 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4405 return CVec_NodeAnnouncementZ_free(arg_conv);
4408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4409 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4411 return CVec_PublicKeyZ_free(arg_conv);
4414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4415 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4417 return CVec_RouteHintZ_free(arg_conv);
4420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4421 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4423 return CVec_RouteHopZ_free(arg_conv);
4426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4427 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4429 return CVec_SignatureZ_free(arg_conv);
4432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4433 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4435 return CVec_SpendableOutputDescriptorZ_free(arg_conv);
4438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4439 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4441 return CVec_TransactionZ_free(arg_conv);
4444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4445 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4447 return CVec_TxOutZ_free(arg_conv);
4450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4451 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4453 return CVec_UpdateAddHTLCZ_free(arg_conv);
4456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4457 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4459 return CVec_UpdateFailHTLCZ_free(arg_conv);
4462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4463 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4465 return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4469 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4471 return CVec_UpdateFulfillHTLCZ_free(arg_conv);
4474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4475 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4477 return CVec_u64Z_free(arg_conv);
4480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4481 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4483 return CVec_u8Z_free(arg_conv);
4486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4487 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4489 return Transaction_free(_res_conv);
4492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4493 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4495 return TxOut_free(_res_conv);
4498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4499 LDKTransaction b_conv = *(LDKTransaction*)b;
4501 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4502 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4507 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4508 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4513 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4514 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4520 a_conv.inner = (void*)(a & (~1));
4521 a_conv.is_owned = (a & 1) || (a == 0);
4522 if (a_conv.inner != NULL)
4523 a_conv = OutPoint_clone(&a_conv);
4524 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4526 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4527 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4532 LDKThirtyTwoBytes a_ref;
4533 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4534 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4536 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4537 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4542 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4543 *ret = C2Tuple_u64u64Z_new(a, b);
4547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4548 LDKSignature a_conv = *(LDKSignature*)a;
4550 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4552 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4553 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
4557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4558 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4559 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4564 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4565 *ret = CResult_SignatureNoneZ_err();
4569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4570 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4571 *ret = CResult_CVec_SignatureZNoneZ_err();
4575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4576 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4577 *ret = CResult_NoneAPIErrorZ_ok();
4581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4582 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4583 *ret = CResult_NonePaymentSendFailureZ_ok();
4587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4588 LDKChannelAnnouncement a_conv;
4589 a_conv.inner = (void*)(a & (~1));
4590 a_conv.is_owned = (a & 1) || (a == 0);
4591 if (a_conv.inner != NULL)
4592 a_conv = ChannelAnnouncement_clone(&a_conv);
4593 LDKChannelUpdate b_conv;
4594 b_conv.inner = (void*)(b & (~1));
4595 b_conv.is_owned = (b & 1) || (b == 0);
4596 if (b_conv.inner != NULL)
4597 b_conv = ChannelUpdate_clone(&b_conv);
4598 LDKChannelUpdate c_conv;
4599 c_conv.inner = (void*)(c & (~1));
4600 c_conv.is_owned = (c & 1) || (c == 0);
4601 if (c_conv.inner != NULL)
4602 c_conv = ChannelUpdate_clone(&c_conv);
4603 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4604 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4609 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4610 *ret = CResult_NonePeerHandleErrorZ_ok();
4614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4615 LDKHTLCOutputInCommitment a_conv;
4616 a_conv.inner = (void*)(a & (~1));
4617 a_conv.is_owned = (a & 1) || (a == 0);
4618 if (a_conv.inner != NULL)
4619 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4620 LDKSignature b_conv = *(LDKSignature*)b;
4622 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4623 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
4627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4628 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4629 FREE((void*)this_ptr);
4630 return Event_free(this_ptr_conv);
4633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4634 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4635 FREE((void*)this_ptr);
4636 return MessageSendEvent_free(this_ptr_conv);
4639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4640 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4641 FREE((void*)this_ptr);
4642 return MessageSendEventsProvider_free(this_ptr_conv);
4645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4646 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4647 FREE((void*)this_ptr);
4648 return EventsProvider_free(this_ptr_conv);
4651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4652 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4653 FREE((void*)this_ptr);
4654 return APIError_free(this_ptr_conv);
4657 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4658 jclass ret = LDKLevel_to_java(_env, Level_max());
4662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4663 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4664 FREE((void*)this_ptr);
4665 return Logger_free(this_ptr_conv);
4668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4669 LDKChannelHandshakeConfig this_ptr_conv;
4670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4672 return ChannelHandshakeConfig_free(this_ptr_conv);
4675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4676 LDKChannelHandshakeConfig orig_conv;
4677 orig_conv.inner = (void*)(orig & (~1));
4678 orig_conv.is_owned = (orig & 1) || (orig == 0);
4679 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4680 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4683 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4684 LDKChannelHandshakeConfig this_ptr_conv;
4685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4687 return ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4691 LDKChannelHandshakeConfig this_ptr_conv;
4692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4694 return ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4697 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4698 LDKChannelHandshakeConfig this_ptr_conv;
4699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4701 return ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4705 LDKChannelHandshakeConfig this_ptr_conv;
4706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4708 return ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4712 LDKChannelHandshakeConfig this_ptr_conv;
4713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4715 return ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4719 LDKChannelHandshakeConfig this_ptr_conv;
4720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4722 return ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4725 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) {
4726 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4727 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4731 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4732 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4736 LDKChannelHandshakeLimits this_ptr_conv;
4737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4739 return ChannelHandshakeLimits_free(this_ptr_conv);
4742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4743 LDKChannelHandshakeLimits orig_conv;
4744 orig_conv.inner = (void*)(orig & (~1));
4745 orig_conv.is_owned = (orig & 1) || (orig == 0);
4746 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4747 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4751 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4758 LDKChannelHandshakeLimits 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 return ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4765 LDKChannelHandshakeLimits this_ptr_conv;
4766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4768 return ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4772 LDKChannelHandshakeLimits this_ptr_conv;
4773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4774 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4775 return ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4779 LDKChannelHandshakeLimits this_ptr_conv;
4780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4782 return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4785 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) {
4786 LDKChannelHandshakeLimits 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 return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4793 LDKChannelHandshakeLimits this_ptr_conv;
4794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4796 return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4800 LDKChannelHandshakeLimits this_ptr_conv;
4801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4803 return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4806 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4807 LDKChannelHandshakeLimits this_ptr_conv;
4808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4810 return ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4814 LDKChannelHandshakeLimits this_ptr_conv;
4815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4817 return ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4820 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4821 LDKChannelHandshakeLimits this_ptr_conv;
4822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4824 return ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4828 LDKChannelHandshakeLimits this_ptr_conv;
4829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4831 return ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4834 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4835 LDKChannelHandshakeLimits this_ptr_conv;
4836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4838 return ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4842 LDKChannelHandshakeLimits this_ptr_conv;
4843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4845 return ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4848 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4849 LDKChannelHandshakeLimits this_ptr_conv;
4850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4852 return ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4856 LDKChannelHandshakeLimits this_ptr_conv;
4857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4859 return ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4862 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4863 LDKChannelHandshakeLimits this_ptr_conv;
4864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4866 return ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4870 LDKChannelHandshakeLimits this_ptr_conv;
4871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4873 return ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4876 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4877 LDKChannelHandshakeLimits this_ptr_conv;
4878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4880 return ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4884 LDKChannelHandshakeLimits this_ptr_conv;
4885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4887 return ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4890 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) {
4891 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);
4892 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4896 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4897 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4901 LDKChannelConfig this_ptr_conv;
4902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4904 return ChannelConfig_free(this_ptr_conv);
4907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4908 LDKChannelConfig orig_conv;
4909 orig_conv.inner = (void*)(orig & (~1));
4910 orig_conv.is_owned = (orig & 1) || (orig == 0);
4911 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
4912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4915 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4916 LDKChannelConfig this_ptr_conv;
4917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4919 return ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4923 LDKChannelConfig this_ptr_conv;
4924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4926 return ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4930 LDKChannelConfig this_ptr_conv;
4931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4933 return ChannelConfig_get_announced_channel(&this_ptr_conv);
4936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4937 LDKChannelConfig this_ptr_conv;
4938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4940 return ChannelConfig_set_announced_channel(&this_ptr_conv, val);
4943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4944 LDKChannelConfig this_ptr_conv;
4945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4947 return ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
4950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4951 LDKChannelConfig this_ptr_conv;
4952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4954 return ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
4957 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) {
4958 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
4959 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
4963 LDKChannelConfig ret = ChannelConfig_default();
4964 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
4968 LDKChannelConfig obj_conv;
4969 obj_conv.inner = (void*)(obj & (~1));
4970 obj_conv.is_owned = (obj & 1) || (obj == 0);
4971 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4972 *ret = ChannelConfig_write(&obj_conv);
4976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
4977 LDKu8slice ser_conv = *(LDKu8slice*)ser;
4978 LDKChannelConfig ret = ChannelConfig_read(ser_conv);
4979 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4983 LDKUserConfig this_ptr_conv;
4984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4986 return UserConfig_free(this_ptr_conv);
4989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4990 LDKUserConfig orig_conv;
4991 orig_conv.inner = (void*)(orig & (~1));
4992 orig_conv.is_owned = (orig & 1) || (orig == 0);
4993 LDKUserConfig ret = UserConfig_clone(&orig_conv);
4994 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4998 LDKUserConfig this_ptr_conv;
4999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5001 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5002 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5006 LDKUserConfig this_ptr_conv;
5007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5009 LDKChannelHandshakeConfig val_conv;
5010 val_conv.inner = (void*)(val & (~1));
5011 val_conv.is_owned = (val & 1) || (val == 0);
5012 if (val_conv.inner != NULL)
5013 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5014 return UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5018 LDKUserConfig this_ptr_conv;
5019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5021 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5022 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5026 LDKUserConfig this_ptr_conv;
5027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5029 LDKChannelHandshakeLimits val_conv;
5030 val_conv.inner = (void*)(val & (~1));
5031 val_conv.is_owned = (val & 1) || (val == 0);
5032 if (val_conv.inner != NULL)
5033 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5034 return UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5038 LDKUserConfig this_ptr_conv;
5039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5041 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5042 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5046 LDKUserConfig this_ptr_conv;
5047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5049 LDKChannelConfig val_conv;
5050 val_conv.inner = (void*)(val & (~1));
5051 val_conv.is_owned = (val & 1) || (val == 0);
5052 if (val_conv.inner != NULL)
5053 val_conv = ChannelConfig_clone(&val_conv);
5054 return UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5057 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) {
5058 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5059 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5060 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5061 if (own_channel_config_arg_conv.inner != NULL)
5062 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5063 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5064 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5065 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5066 if (peer_channel_config_limits_arg_conv.inner != NULL)
5067 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5068 LDKChannelConfig channel_options_arg_conv;
5069 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5070 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5071 if (channel_options_arg_conv.inner != NULL)
5072 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5073 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5074 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5078 LDKUserConfig ret = UserConfig_default();
5079 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5083 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5084 FREE((void*)this_ptr);
5085 return Access_free(this_ptr_conv);
5088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5089 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5090 FREE((void*)this_ptr);
5091 return Watch_free(this_ptr_conv);
5094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5095 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5096 FREE((void*)this_ptr);
5097 return Filter_free(this_ptr_conv);
5100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5101 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5102 FREE((void*)this_ptr);
5103 return BroadcasterInterface_free(this_ptr_conv);
5106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5107 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5108 FREE((void*)this_ptr);
5109 return FeeEstimator_free(this_ptr_conv);
5112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5113 LDKChainMonitor this_ptr_conv;
5114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5116 return ChainMonitor_free(this_ptr_conv);
5119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5120 LDKChainMonitor this_arg_conv;
5121 this_arg_conv.inner = (void*)(this_arg & (~1));
5122 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5123 unsigned char header_arr[80];
5124 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5125 unsigned char (*header_ref)[80] = &header_arr;
5126 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5127 FREE((void*)txdata);
5128 return ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5132 LDKChainMonitor this_arg_conv;
5133 this_arg_conv.inner = (void*)(this_arg & (~1));
5134 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5135 unsigned char header_arr[80];
5136 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5137 unsigned char (*header_ref)[80] = &header_arr;
5138 return ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5142 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5143 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5144 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5145 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5146 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5148 LDKLogger logger_conv = *(LDKLogger*)logger;
5149 if (logger_conv.free == LDKLogger_JCalls_free) {
5150 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5151 LDKLogger_JCalls_clone(logger_conv.this_arg);
5153 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5154 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5155 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5156 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5158 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5159 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5163 LDKChainMonitor this_arg_conv;
5164 this_arg_conv.inner = (void*)(this_arg & (~1));
5165 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5166 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5167 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5172 LDKChainMonitor this_arg_conv;
5173 this_arg_conv.inner = (void*)(this_arg & (~1));
5174 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5175 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5176 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5181 LDKChannelMonitorUpdate this_ptr_conv;
5182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5184 return ChannelMonitorUpdate_free(this_ptr_conv);
5187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5188 LDKChannelMonitorUpdate orig_conv;
5189 orig_conv.inner = (void*)(orig & (~1));
5190 orig_conv.is_owned = (orig & 1) || (orig == 0);
5191 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5192 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5196 LDKChannelMonitorUpdate this_ptr_conv;
5197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5198 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5199 return ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5203 LDKChannelMonitorUpdate this_ptr_conv;
5204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5206 return ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5210 LDKChannelMonitorUpdate obj_conv;
5211 obj_conv.inner = (void*)(obj & (~1));
5212 obj_conv.is_owned = (obj & 1) || (obj == 0);
5213 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5214 *ret = ChannelMonitorUpdate_write(&obj_conv);
5218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5219 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5220 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_conv);
5221 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5225 LDKMonitorUpdateError 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 return MonitorUpdateError_free(this_ptr_conv);
5231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5232 LDKMonitorEvent this_ptr_conv;
5233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5235 return MonitorEvent_free(this_ptr_conv);
5238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5239 LDKHTLCUpdate this_ptr_conv;
5240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5242 return HTLCUpdate_free(this_ptr_conv);
5245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5246 LDKHTLCUpdate orig_conv;
5247 orig_conv.inner = (void*)(orig & (~1));
5248 orig_conv.is_owned = (orig & 1) || (orig == 0);
5249 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5250 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5254 LDKHTLCUpdate obj_conv;
5255 obj_conv.inner = (void*)(obj & (~1));
5256 obj_conv.is_owned = (obj & 1) || (obj == 0);
5257 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5258 *ret = HTLCUpdate_write(&obj_conv);
5262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5263 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5264 LDKHTLCUpdate ret = HTLCUpdate_read(ser_conv);
5265 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5269 LDKChannelMonitor this_ptr_conv;
5270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5272 return ChannelMonitor_free(this_ptr_conv);
5275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5276 LDKChannelMonitor this_arg_conv;
5277 this_arg_conv.inner = (void*)(this_arg & (~1));
5278 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5279 LDKChannelMonitorUpdate updates_conv;
5280 updates_conv.inner = (void*)(updates & (~1));
5281 updates_conv.is_owned = (updates & 1) || (updates == 0);
5282 if (updates_conv.inner != NULL)
5283 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5284 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5285 LDKLogger* logger_conv = (LDKLogger*)logger;
5286 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5287 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5292 LDKChannelMonitor this_arg_conv;
5293 this_arg_conv.inner = (void*)(this_arg & (~1));
5294 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5295 return ChannelMonitor_get_latest_update_id(&this_arg_conv);
5298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5299 LDKChannelMonitor this_arg_conv;
5300 this_arg_conv.inner = (void*)(this_arg & (~1));
5301 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5302 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5303 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5308 LDKChannelMonitor this_arg_conv;
5309 this_arg_conv.inner = (void*)(this_arg & (~1));
5310 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5311 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5312 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5317 LDKChannelMonitor this_arg_conv;
5318 this_arg_conv.inner = (void*)(this_arg & (~1));
5319 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5320 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5321 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5326 LDKChannelMonitor this_arg_conv;
5327 this_arg_conv.inner = (void*)(this_arg & (~1));
5328 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5329 LDKLogger* logger_conv = (LDKLogger*)logger;
5330 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5331 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5335 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) {
5336 LDKChannelMonitor this_arg_conv;
5337 this_arg_conv.inner = (void*)(this_arg & (~1));
5338 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5339 unsigned char header_arr[80];
5340 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5341 unsigned char (*header_ref)[80] = &header_arr;
5342 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5343 FREE((void*)txdata);
5344 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5345 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5346 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5347 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5349 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5350 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5351 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5352 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5354 LDKLogger logger_conv = *(LDKLogger*)logger;
5355 if (logger_conv.free == LDKLogger_JCalls_free) {
5356 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5357 LDKLogger_JCalls_clone(logger_conv.this_arg);
5359 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5360 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5364 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) {
5365 LDKChannelMonitor this_arg_conv;
5366 this_arg_conv.inner = (void*)(this_arg & (~1));
5367 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5368 unsigned char header_arr[80];
5369 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5370 unsigned char (*header_ref)[80] = &header_arr;
5371 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5372 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5373 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5374 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5376 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5377 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5378 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5379 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5381 LDKLogger logger_conv = *(LDKLogger*)logger;
5382 if (logger_conv.free == LDKLogger_JCalls_free) {
5383 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5384 LDKLogger_JCalls_clone(logger_conv.this_arg);
5386 return ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5390 LDKOutPoint this_ptr_conv;
5391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5393 return OutPoint_free(this_ptr_conv);
5396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5397 LDKOutPoint orig_conv;
5398 orig_conv.inner = (void*)(orig & (~1));
5399 orig_conv.is_owned = (orig & 1) || (orig == 0);
5400 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5401 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5404 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5405 LDKOutPoint this_ptr_conv;
5406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5408 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5409 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5414 LDKOutPoint this_ptr_conv;
5415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5417 LDKThirtyTwoBytes val_ref;
5418 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5419 return OutPoint_set_txid(&this_ptr_conv, val_ref);
5422 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5423 LDKOutPoint this_ptr_conv;
5424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5426 return OutPoint_get_index(&this_ptr_conv);
5429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5430 LDKOutPoint this_ptr_conv;
5431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5433 return OutPoint_set_index(&this_ptr_conv, val);
5436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5437 LDKThirtyTwoBytes txid_arg_ref;
5438 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5439 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5440 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5443 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5444 LDKOutPoint this_arg_conv;
5445 this_arg_conv.inner = (void*)(this_arg & (~1));
5446 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5447 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5448 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5453 LDKOutPoint obj_conv;
5454 obj_conv.inner = (void*)(obj & (~1));
5455 obj_conv.is_owned = (obj & 1) || (obj == 0);
5456 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5457 *ret = OutPoint_write(&obj_conv);
5461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
5462 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5463 LDKOutPoint ret = OutPoint_read(ser_conv);
5464 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5468 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5469 FREE((void*)this_ptr);
5470 return SpendableOutputDescriptor_free(this_ptr_conv);
5473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5474 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5475 FREE((void*)this_ptr);
5476 return ChannelKeys_free(this_ptr_conv);
5479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5480 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5481 FREE((void*)this_ptr);
5482 return KeysInterface_free(this_ptr_conv);
5485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5486 LDKInMemoryChannelKeys 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 return InMemoryChannelKeys_free(this_ptr_conv);
5492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5493 LDKInMemoryChannelKeys orig_conv;
5494 orig_conv.inner = (void*)(orig & (~1));
5495 orig_conv.is_owned = (orig & 1) || (orig == 0);
5496 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5497 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5500 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5501 LDKInMemoryChannelKeys this_ptr_conv;
5502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5504 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5505 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5510 LDKInMemoryChannelKeys this_ptr_conv;
5511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5513 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5515 return InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_conv);
5518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5519 LDKInMemoryChannelKeys 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5523 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5528 LDKInMemoryChannelKeys this_ptr_conv;
5529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5531 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5533 return InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_conv);
5536 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5537 LDKInMemoryChannelKeys this_ptr_conv;
5538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5540 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5541 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5546 LDKInMemoryChannelKeys this_ptr_conv;
5547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5549 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5551 return InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_conv);
5554 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5555 LDKInMemoryChannelKeys this_ptr_conv;
5556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5558 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5559 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5564 LDKInMemoryChannelKeys this_ptr_conv;
5565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5567 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5569 return InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_conv);
5572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5573 LDKInMemoryChannelKeys this_ptr_conv;
5574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5576 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5577 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5582 LDKInMemoryChannelKeys this_ptr_conv;
5583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5585 LDKSecretKey val_conv = *(LDKSecretKey*)val;
5587 return InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_conv);
5590 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5591 LDKInMemoryChannelKeys this_ptr_conv;
5592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5594 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5595 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5600 LDKInMemoryChannelKeys this_ptr_conv;
5601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5603 LDKThirtyTwoBytes val_ref;
5604 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5605 return InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5608 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) {
5609 LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
5610 FREE((void*)funding_key);
5611 LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
5612 FREE((void*)revocation_base_key);
5613 LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
5614 FREE((void*)payment_key);
5615 LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
5616 FREE((void*)delayed_payment_base_key);
5617 LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
5618 FREE((void*)htlc_base_key);
5619 LDKThirtyTwoBytes commitment_seed_ref;
5620 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5621 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5622 FREE((void*)key_derivation_params);
5623 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);
5624 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5628 LDKInMemoryChannelKeys this_arg_conv;
5629 this_arg_conv.inner = (void*)(this_arg & (~1));
5630 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5631 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5632 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5635 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5636 LDKInMemoryChannelKeys this_arg_conv;
5637 this_arg_conv.inner = (void*)(this_arg & (~1));
5638 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5639 return InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5642 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5643 LDKInMemoryChannelKeys this_arg_conv;
5644 this_arg_conv.inner = (void*)(this_arg & (~1));
5645 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5646 return InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5650 LDKInMemoryChannelKeys this_arg_conv;
5651 this_arg_conv.inner = (void*)(this_arg & (~1));
5652 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5653 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5654 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5659 LDKInMemoryChannelKeys obj_conv;
5660 obj_conv.inner = (void*)(obj & (~1));
5661 obj_conv.is_owned = (obj & 1) || (obj == 0);
5662 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5663 *ret = InMemoryChannelKeys_write(&obj_conv);
5667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5668 LDKu8slice ser_conv = *(LDKu8slice*)ser;
5669 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_conv);
5670 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5674 LDKKeysManager this_ptr_conv;
5675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5677 return KeysManager_free(this_ptr_conv);
5680 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) {
5681 unsigned char seed_arr[32];
5682 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5683 unsigned char (*seed_ref)[32] = &seed_arr;
5684 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5685 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5686 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5689 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) {
5690 LDKKeysManager this_arg_conv;
5691 this_arg_conv.inner = (void*)(this_arg & (~1));
5692 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5693 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5694 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5698 LDKKeysManager this_arg_conv;
5699 this_arg_conv.inner = (void*)(this_arg & (~1));
5700 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5701 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5702 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5707 LDKChannelManager this_ptr_conv;
5708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5710 return ChannelManager_free(this_ptr_conv);
5713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5714 LDKChannelDetails this_ptr_conv;
5715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5717 return ChannelDetails_free(this_ptr_conv);
5720 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5721 LDKChannelDetails this_ptr_conv;
5722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5724 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5725 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5730 LDKChannelDetails this_ptr_conv;
5731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5733 LDKThirtyTwoBytes val_ref;
5734 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5735 return ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5738 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5739 LDKChannelDetails this_ptr_conv;
5740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5742 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5743 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5748 LDKChannelDetails this_ptr_conv;
5749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5751 LDKPublicKey val_ref;
5752 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5753 return ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5757 LDKChannelDetails this_ptr_conv;
5758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5760 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5765 LDKChannelDetails this_ptr_conv;
5766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5768 LDKInitFeatures val_conv;
5769 val_conv.inner = (void*)(val & (~1));
5770 val_conv.is_owned = (val & 1) || (val == 0);
5771 return ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5775 LDKChannelDetails this_ptr_conv;
5776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5778 return ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5782 LDKChannelDetails this_ptr_conv;
5783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5785 return ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5789 LDKChannelDetails this_ptr_conv;
5790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5792 return ChannelDetails_get_user_id(&this_ptr_conv);
5795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5796 LDKChannelDetails this_ptr_conv;
5797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5799 return ChannelDetails_set_user_id(&this_ptr_conv, val);
5802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5803 LDKChannelDetails this_ptr_conv;
5804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5806 return ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5810 LDKChannelDetails this_ptr_conv;
5811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5813 return ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5817 LDKChannelDetails this_ptr_conv;
5818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5820 return ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5824 LDKChannelDetails this_ptr_conv;
5825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5827 return ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5830 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5831 LDKChannelDetails this_ptr_conv;
5832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5834 return ChannelDetails_get_is_live(&this_ptr_conv);
5837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5838 LDKChannelDetails this_ptr_conv;
5839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5841 return ChannelDetails_set_is_live(&this_ptr_conv, val);
5844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5845 LDKPaymentSendFailure this_ptr_conv;
5846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5848 return PaymentSendFailure_free(this_ptr_conv);
5851 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) {
5852 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5853 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5854 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5855 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5856 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5858 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5859 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5860 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5861 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5863 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5864 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5865 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5866 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5868 LDKLogger logger_conv = *(LDKLogger*)logger;
5869 if (logger_conv.free == LDKLogger_JCalls_free) {
5870 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5871 LDKLogger_JCalls_clone(logger_conv.this_arg);
5873 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5874 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5875 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5876 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5878 LDKUserConfig config_conv;
5879 config_conv.inner = (void*)(config & (~1));
5880 config_conv.is_owned = (config & 1) || (config == 0);
5881 if (config_conv.inner != NULL)
5882 config_conv = UserConfig_clone(&config_conv);
5883 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);
5884 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
5888 LDKChannelManager this_arg_conv;
5889 this_arg_conv.inner = (void*)(this_arg & (~1));
5890 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5891 LDKPublicKey their_network_key_ref;
5892 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
5893 LDKUserConfig override_config_conv;
5894 override_config_conv.inner = (void*)(override_config & (~1));
5895 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
5896 if (override_config_conv.inner != NULL)
5897 override_config_conv = UserConfig_clone(&override_config_conv);
5898 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5899 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
5903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5904 LDKChannelManager this_arg_conv;
5905 this_arg_conv.inner = (void*)(this_arg & (~1));
5906 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5907 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5908 *ret = ChannelManager_list_channels(&this_arg_conv);
5912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5913 LDKChannelManager this_arg_conv;
5914 this_arg_conv.inner = (void*)(this_arg & (~1));
5915 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5916 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
5917 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
5921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5922 LDKChannelManager this_arg_conv;
5923 this_arg_conv.inner = (void*)(this_arg & (~1));
5924 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5925 unsigned char channel_id_arr[32];
5926 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5927 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5928 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5929 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
5933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
5934 LDKChannelManager this_arg_conv;
5935 this_arg_conv.inner = (void*)(this_arg & (~1));
5936 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5937 unsigned char channel_id_arr[32];
5938 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
5939 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
5940 return ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
5943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
5944 LDKChannelManager this_arg_conv;
5945 this_arg_conv.inner = (void*)(this_arg & (~1));
5946 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5947 return ChannelManager_force_close_all_channels(&this_arg_conv);
5950 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) {
5951 LDKChannelManager this_arg_conv;
5952 this_arg_conv.inner = (void*)(this_arg & (~1));
5953 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5954 LDKRoute route_conv;
5955 route_conv.inner = (void*)(route & (~1));
5956 route_conv.is_owned = (route & 1) || (route == 0);
5957 LDKThirtyTwoBytes payment_hash_ref;
5958 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
5959 LDKThirtyTwoBytes payment_secret_ref;
5960 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
5961 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5962 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
5966 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) {
5967 LDKChannelManager this_arg_conv;
5968 this_arg_conv.inner = (void*)(this_arg & (~1));
5969 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5970 unsigned char temporary_channel_id_arr[32];
5971 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
5972 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
5973 LDKOutPoint funding_txo_conv;
5974 funding_txo_conv.inner = (void*)(funding_txo & (~1));
5975 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
5976 if (funding_txo_conv.inner != NULL)
5977 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5978 return ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
5981 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) {
5982 LDKChannelManager this_arg_conv;
5983 this_arg_conv.inner = (void*)(this_arg & (~1));
5984 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5985 LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
5987 LDKThirtyTwoBytes alias_ref;
5988 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
5989 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
5990 FREE((void*)addresses);
5991 return ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_conv, alias_ref, addresses_conv);
5994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
5995 LDKChannelManager this_arg_conv;
5996 this_arg_conv.inner = (void*)(this_arg & (~1));
5997 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5998 return ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6002 LDKChannelManager this_arg_conv;
6003 this_arg_conv.inner = (void*)(this_arg & (~1));
6004 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6005 return ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6008 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) {
6009 LDKChannelManager this_arg_conv;
6010 this_arg_conv.inner = (void*)(this_arg & (~1));
6011 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6012 unsigned char payment_hash_arr[32];
6013 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6014 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6015 LDKThirtyTwoBytes payment_secret_ref;
6016 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6017 return ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6020 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) {
6021 LDKChannelManager this_arg_conv;
6022 this_arg_conv.inner = (void*)(this_arg & (~1));
6023 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6024 LDKThirtyTwoBytes payment_preimage_ref;
6025 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6026 LDKThirtyTwoBytes payment_secret_ref;
6027 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6028 return ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6031 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6032 LDKChannelManager this_arg_conv;
6033 this_arg_conv.inner = (void*)(this_arg & (~1));
6034 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6035 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6036 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6040 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) {
6041 LDKChannelManager this_arg_conv;
6042 this_arg_conv.inner = (void*)(this_arg & (~1));
6043 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6044 LDKOutPoint funding_txo_conv;
6045 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6046 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6047 return ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6051 LDKChannelManager this_arg_conv;
6052 this_arg_conv.inner = (void*)(this_arg & (~1));
6053 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6054 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6055 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6059 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6060 LDKChannelManager this_arg_conv;
6061 this_arg_conv.inner = (void*)(this_arg & (~1));
6062 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6063 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6064 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6069 LDKChannelManager this_arg_conv;
6070 this_arg_conv.inner = (void*)(this_arg & (~1));
6071 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6072 unsigned char header_arr[80];
6073 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6074 unsigned char (*header_ref)[80] = &header_arr;
6075 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6076 FREE((void*)txdata);
6077 return ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6081 LDKChannelManager this_arg_conv;
6082 this_arg_conv.inner = (void*)(this_arg & (~1));
6083 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6084 unsigned char header_arr[80];
6085 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6086 unsigned char (*header_ref)[80] = &header_arr;
6087 return ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6091 LDKChannelManager this_arg_conv;
6092 this_arg_conv.inner = (void*)(this_arg & (~1));
6093 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6094 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6095 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6100 LDKChannelManagerReadArgs this_ptr_conv;
6101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6103 return ChannelManagerReadArgs_free(this_ptr_conv);
6106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6107 LDKChannelManagerReadArgs this_ptr_conv;
6108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6110 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6115 LDKChannelManagerReadArgs this_ptr_conv;
6116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6118 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6119 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6120 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6121 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6123 return ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6127 LDKChannelManagerReadArgs this_ptr_conv;
6128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6130 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6135 LDKChannelManagerReadArgs this_ptr_conv;
6136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6138 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6139 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6140 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6141 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6143 return ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6147 LDKChannelManagerReadArgs 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 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6155 LDKChannelManagerReadArgs this_ptr_conv;
6156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6158 LDKWatch val_conv = *(LDKWatch*)val;
6159 if (val_conv.free == LDKWatch_JCalls_free) {
6160 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6161 LDKWatch_JCalls_clone(val_conv.this_arg);
6163 return ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6167 LDKChannelManagerReadArgs this_ptr_conv;
6168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6170 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6175 LDKChannelManagerReadArgs this_ptr_conv;
6176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6178 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6179 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6181 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6183 return ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6187 LDKChannelManagerReadArgs this_ptr_conv;
6188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6190 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6195 LDKChannelManagerReadArgs this_ptr_conv;
6196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6198 LDKLogger val_conv = *(LDKLogger*)val;
6199 if (val_conv.free == LDKLogger_JCalls_free) {
6200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6201 LDKLogger_JCalls_clone(val_conv.this_arg);
6203 return ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6207 LDKChannelManagerReadArgs 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 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6211 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6215 LDKChannelManagerReadArgs this_ptr_conv;
6216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6218 LDKUserConfig val_conv;
6219 val_conv.inner = (void*)(val & (~1));
6220 val_conv.is_owned = (val & 1) || (val == 0);
6221 if (val_conv.inner != NULL)
6222 val_conv = UserConfig_clone(&val_conv);
6223 return ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6226 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) {
6227 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6228 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6230 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6232 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6233 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6234 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6235 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6237 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6238 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6239 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6240 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6242 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6243 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6244 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6245 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6247 LDKLogger logger_conv = *(LDKLogger*)logger;
6248 if (logger_conv.free == LDKLogger_JCalls_free) {
6249 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6250 LDKLogger_JCalls_clone(logger_conv.this_arg);
6252 LDKUserConfig default_config_conv;
6253 default_config_conv.inner = (void*)(default_config & (~1));
6254 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6255 if (default_config_conv.inner != NULL)
6256 default_config_conv = UserConfig_clone(&default_config_conv);
6257 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6258 FREE((void*)channel_monitors);
6259 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6260 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6264 LDKDecodeError this_ptr_conv;
6265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6267 return DecodeError_free(this_ptr_conv);
6270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6271 LDKInit this_ptr_conv;
6272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6274 return Init_free(this_ptr_conv);
6277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6278 LDKErrorMessage this_ptr_conv;
6279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6280 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6281 return ErrorMessage_free(this_ptr_conv);
6284 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6285 LDKErrorMessage orig_conv;
6286 orig_conv.inner = (void*)(orig & (~1));
6287 orig_conv.is_owned = (orig & 1) || (orig == 0);
6288 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6289 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6292 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6293 LDKErrorMessage this_ptr_conv;
6294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6296 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6297 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6302 LDKErrorMessage this_ptr_conv;
6303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6305 LDKThirtyTwoBytes val_ref;
6306 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6307 return ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6311 LDKErrorMessage this_ptr_conv;
6312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6314 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6315 *ret = ErrorMessage_get_data(&this_ptr_conv);
6319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6320 LDKErrorMessage this_ptr_conv;
6321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6323 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6325 return ErrorMessage_set_data(&this_ptr_conv, val_conv);
6328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6329 LDKThirtyTwoBytes channel_id_arg_ref;
6330 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6331 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6332 FREE((void*)data_arg);
6333 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6334 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6338 LDKPing this_ptr_conv;
6339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6341 return Ping_free(this_ptr_conv);
6344 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6345 LDKPing 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 return Ping_get_ponglen(&this_ptr_conv);
6351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6352 LDKPing this_ptr_conv;
6353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6355 return Ping_set_ponglen(&this_ptr_conv, val);
6358 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6359 LDKPing this_ptr_conv;
6360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6362 return Ping_get_byteslen(&this_ptr_conv);
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6366 LDKPing this_ptr_conv;
6367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6369 return Ping_set_byteslen(&this_ptr_conv, val);
6372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6373 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6374 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6378 LDKPong this_ptr_conv;
6379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6381 return Pong_free(this_ptr_conv);
6384 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6385 LDKPong this_ptr_conv;
6386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6388 return Pong_get_byteslen(&this_ptr_conv);
6391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6392 LDKPong this_ptr_conv;
6393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6395 return Pong_set_byteslen(&this_ptr_conv, val);
6398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6399 LDKPong ret = Pong_new(byteslen_arg);
6400 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6404 LDKOpenChannel this_ptr_conv;
6405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6407 return OpenChannel_free(this_ptr_conv);
6410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6411 LDKOpenChannel orig_conv;
6412 orig_conv.inner = (void*)(orig & (~1));
6413 orig_conv.is_owned = (orig & 1) || (orig == 0);
6414 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6415 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6418 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6419 LDKOpenChannel this_ptr_conv;
6420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6422 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6423 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6428 LDKOpenChannel this_ptr_conv;
6429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6431 LDKThirtyTwoBytes val_ref;
6432 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6433 return OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6436 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6437 LDKOpenChannel this_ptr_conv;
6438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6440 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6441 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6446 LDKOpenChannel this_ptr_conv;
6447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6449 LDKThirtyTwoBytes val_ref;
6450 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6451 return OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6455 LDKOpenChannel this_ptr_conv;
6456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6458 return OpenChannel_get_funding_satoshis(&this_ptr_conv);
6461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6462 LDKOpenChannel this_ptr_conv;
6463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6465 return OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6469 LDKOpenChannel this_ptr_conv;
6470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6472 return OpenChannel_get_push_msat(&this_ptr_conv);
6475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6476 LDKOpenChannel this_ptr_conv;
6477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6479 return OpenChannel_set_push_msat(&this_ptr_conv, val);
6482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6483 LDKOpenChannel this_ptr_conv;
6484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6486 return OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6490 LDKOpenChannel this_ptr_conv;
6491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6493 return OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6497 LDKOpenChannel this_ptr_conv;
6498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6500 return OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6503 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) {
6504 LDKOpenChannel this_ptr_conv;
6505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6507 return OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6511 LDKOpenChannel this_ptr_conv;
6512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6514 return OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6518 LDKOpenChannel this_ptr_conv;
6519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6521 return OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6525 LDKOpenChannel this_ptr_conv;
6526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6528 return OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6532 LDKOpenChannel this_ptr_conv;
6533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6535 return OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6538 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6539 LDKOpenChannel this_ptr_conv;
6540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6542 return OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6546 LDKOpenChannel this_ptr_conv;
6547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6549 return OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6552 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6553 LDKOpenChannel this_ptr_conv;
6554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6556 return OpenChannel_get_to_self_delay(&this_ptr_conv);
6559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6560 LDKOpenChannel this_ptr_conv;
6561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6563 return OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6566 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6567 LDKOpenChannel this_ptr_conv;
6568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6570 return OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6574 LDKOpenChannel this_ptr_conv;
6575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6577 return OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6580 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6581 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6585 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6590 LDKOpenChannel 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 val_ref;
6594 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6595 return OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6598 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6599 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6603 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6608 LDKOpenChannel this_ptr_conv;
6609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6611 LDKPublicKey val_ref;
6612 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6613 return OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6616 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6617 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6621 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6626 LDKOpenChannel 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 val_ref;
6630 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6631 return OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6635 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6639 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6644 LDKOpenChannel 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 LDKPublicKey val_ref;
6648 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6649 return OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6653 LDKOpenChannel this_ptr_conv;
6654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6656 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6657 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6662 LDKOpenChannel this_ptr_conv;
6663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6665 LDKPublicKey val_ref;
6666 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6667 return OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6671 LDKOpenChannel this_ptr_conv;
6672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6674 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6675 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6680 LDKOpenChannel this_ptr_conv;
6681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6683 LDKPublicKey val_ref;
6684 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6685 return OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6688 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6689 LDKOpenChannel this_ptr_conv;
6690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6692 return OpenChannel_get_channel_flags(&this_ptr_conv);
6695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6696 LDKOpenChannel this_ptr_conv;
6697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6699 return OpenChannel_set_channel_flags(&this_ptr_conv, val);
6702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6703 LDKAcceptChannel this_ptr_conv;
6704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6706 return AcceptChannel_free(this_ptr_conv);
6709 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6710 LDKAcceptChannel orig_conv;
6711 orig_conv.inner = (void*)(orig & (~1));
6712 orig_conv.is_owned = (orig & 1) || (orig == 0);
6713 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6714 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6718 LDKAcceptChannel this_ptr_conv;
6719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6721 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6722 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6727 LDKAcceptChannel this_ptr_conv;
6728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6730 LDKThirtyTwoBytes val_ref;
6731 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6732 return AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6736 LDKAcceptChannel this_ptr_conv;
6737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6739 return AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6743 LDKAcceptChannel this_ptr_conv;
6744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6746 return AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6750 LDKAcceptChannel this_ptr_conv;
6751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6753 return AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6756 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) {
6757 LDKAcceptChannel this_ptr_conv;
6758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6760 return AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6764 LDKAcceptChannel this_ptr_conv;
6765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6767 return AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6771 LDKAcceptChannel this_ptr_conv;
6772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6774 return AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6778 LDKAcceptChannel this_ptr_conv;
6779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6781 return AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6785 LDKAcceptChannel this_ptr_conv;
6786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6788 return AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6791 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6792 LDKAcceptChannel this_ptr_conv;
6793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6795 return AcceptChannel_get_minimum_depth(&this_ptr_conv);
6798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6799 LDKAcceptChannel this_ptr_conv;
6800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6802 return AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6805 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6806 LDKAcceptChannel this_ptr_conv;
6807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6809 return AcceptChannel_get_to_self_delay(&this_ptr_conv);
6812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6813 LDKAcceptChannel this_ptr_conv;
6814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6816 return AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
6819 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6820 LDKAcceptChannel this_ptr_conv;
6821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6823 return AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
6826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6827 LDKAcceptChannel this_ptr_conv;
6828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6830 return AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6833 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6834 LDKAcceptChannel this_ptr_conv;
6835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6837 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6838 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6843 LDKAcceptChannel this_ptr_conv;
6844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6846 LDKPublicKey val_ref;
6847 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6848 return AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6851 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6852 LDKAcceptChannel this_ptr_conv;
6853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6855 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6856 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6861 LDKAcceptChannel this_ptr_conv;
6862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6864 LDKPublicKey val_ref;
6865 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6866 return AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6869 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6870 LDKAcceptChannel this_ptr_conv;
6871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6873 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6874 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
6878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6879 LDKAcceptChannel this_ptr_conv;
6880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6882 LDKPublicKey val_ref;
6883 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6884 return AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
6887 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6888 LDKAcceptChannel this_ptr_conv;
6889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6891 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6892 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6897 LDKAcceptChannel 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 LDKPublicKey val_ref;
6901 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6902 return AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6905 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6906 LDKAcceptChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6910 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6915 LDKAcceptChannel this_ptr_conv;
6916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6918 LDKPublicKey val_ref;
6919 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6920 return AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6923 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6924 LDKAcceptChannel this_ptr_conv;
6925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6927 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6928 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6933 LDKAcceptChannel this_ptr_conv;
6934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6936 LDKPublicKey val_ref;
6937 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6938 return AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6942 LDKFundingCreated this_ptr_conv;
6943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6945 return FundingCreated_free(this_ptr_conv);
6948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6949 LDKFundingCreated orig_conv;
6950 orig_conv.inner = (void*)(orig & (~1));
6951 orig_conv.is_owned = (orig & 1) || (orig == 0);
6952 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
6953 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6956 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6957 LDKFundingCreated 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6961 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
6965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6966 LDKFundingCreated this_ptr_conv;
6967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6969 LDKThirtyTwoBytes val_ref;
6970 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6971 return FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
6974 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6975 LDKFundingCreated this_ptr_conv;
6976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6978 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6979 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
6983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6984 LDKFundingCreated this_ptr_conv;
6985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6987 LDKThirtyTwoBytes val_ref;
6988 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6989 return FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
6992 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6993 LDKFundingCreated this_ptr_conv;
6994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6996 return FundingCreated_get_funding_output_index(&this_ptr_conv);
6999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7000 LDKFundingCreated this_ptr_conv;
7001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7003 return FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7007 LDKFundingCreated this_ptr_conv;
7008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7010 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7011 *ret = FundingCreated_get_signature(&this_ptr_conv);
7015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7016 LDKFundingCreated this_ptr_conv;
7017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7019 LDKSignature val_conv = *(LDKSignature*)val;
7021 return FundingCreated_set_signature(&this_ptr_conv, val_conv);
7024 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) {
7025 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7026 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7027 LDKThirtyTwoBytes funding_txid_arg_ref;
7028 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7029 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7030 FREE((void*)signature_arg);
7031 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_conv);
7032 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7036 LDKFundingSigned this_ptr_conv;
7037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7039 return FundingSigned_free(this_ptr_conv);
7042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7043 LDKFundingSigned orig_conv;
7044 orig_conv.inner = (void*)(orig & (~1));
7045 orig_conv.is_owned = (orig & 1) || (orig == 0);
7046 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7047 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7050 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7051 LDKFundingSigned this_ptr_conv;
7052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7054 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7055 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7060 LDKFundingSigned this_ptr_conv;
7061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7063 LDKThirtyTwoBytes val_ref;
7064 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7065 return FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7069 LDKFundingSigned this_ptr_conv;
7070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7072 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7073 *ret = FundingSigned_get_signature(&this_ptr_conv);
7077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7078 LDKFundingSigned this_ptr_conv;
7079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7081 LDKSignature val_conv = *(LDKSignature*)val;
7083 return FundingSigned_set_signature(&this_ptr_conv, val_conv);
7086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong signature_arg) {
7087 LDKThirtyTwoBytes channel_id_arg_ref;
7088 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7089 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7090 FREE((void*)signature_arg);
7091 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_conv);
7092 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7096 LDKFundingLocked this_ptr_conv;
7097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7099 return FundingLocked_free(this_ptr_conv);
7102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7103 LDKFundingLocked orig_conv;
7104 orig_conv.inner = (void*)(orig & (~1));
7105 orig_conv.is_owned = (orig & 1) || (orig == 0);
7106 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7107 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7110 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7111 LDKFundingLocked this_ptr_conv;
7112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7114 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7115 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7120 LDKFundingLocked this_ptr_conv;
7121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7123 LDKThirtyTwoBytes val_ref;
7124 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7125 return FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7128 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7129 LDKFundingLocked this_ptr_conv;
7130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7132 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7133 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7138 LDKFundingLocked this_ptr_conv;
7139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7141 LDKPublicKey val_ref;
7142 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7143 return FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7147 LDKThirtyTwoBytes channel_id_arg_ref;
7148 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7149 LDKPublicKey next_per_commitment_point_arg_ref;
7150 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7151 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7152 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7156 LDKShutdown this_ptr_conv;
7157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7159 return Shutdown_free(this_ptr_conv);
7162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7163 LDKShutdown orig_conv;
7164 orig_conv.inner = (void*)(orig & (~1));
7165 orig_conv.is_owned = (orig & 1) || (orig == 0);
7166 LDKShutdown ret = Shutdown_clone(&orig_conv);
7167 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7170 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7171 LDKShutdown this_ptr_conv;
7172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7174 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7175 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7180 LDKShutdown 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 LDKThirtyTwoBytes val_ref;
7184 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7185 return Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7189 LDKShutdown this_ptr_conv;
7190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7192 LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
7193 *ret = Shutdown_get_scriptpubkey(&this_ptr_conv);
7197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7198 LDKShutdown this_ptr_conv;
7199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7201 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7203 return Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7207 LDKThirtyTwoBytes channel_id_arg_ref;
7208 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7209 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7210 FREE((void*)scriptpubkey_arg);
7211 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7212 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7216 LDKClosingSigned this_ptr_conv;
7217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7219 return ClosingSigned_free(this_ptr_conv);
7222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7223 LDKClosingSigned orig_conv;
7224 orig_conv.inner = (void*)(orig & (~1));
7225 orig_conv.is_owned = (orig & 1) || (orig == 0);
7226 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7227 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7231 LDKClosingSigned this_ptr_conv;
7232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7234 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7235 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7240 LDKClosingSigned this_ptr_conv;
7241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7243 LDKThirtyTwoBytes val_ref;
7244 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7245 return ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7249 LDKClosingSigned this_ptr_conv;
7250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7252 return ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7256 LDKClosingSigned this_ptr_conv;
7257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7259 return ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7263 LDKClosingSigned this_ptr_conv;
7264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7266 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7267 *ret = ClosingSigned_get_signature(&this_ptr_conv);
7271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7272 LDKClosingSigned 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 LDKSignature val_conv = *(LDKSignature*)val;
7277 return ClosingSigned_set_signature(&this_ptr_conv, val_conv);
7280 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) {
7281 LDKThirtyTwoBytes channel_id_arg_ref;
7282 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7283 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7284 FREE((void*)signature_arg);
7285 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_conv);
7286 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7290 LDKUpdateAddHTLC 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 return UpdateAddHTLC_free(this_ptr_conv);
7296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7297 LDKUpdateAddHTLC orig_conv;
7298 orig_conv.inner = (void*)(orig & (~1));
7299 orig_conv.is_owned = (orig & 1) || (orig == 0);
7300 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7301 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7304 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7305 LDKUpdateAddHTLC this_ptr_conv;
7306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7308 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7309 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7314 LDKUpdateAddHTLC this_ptr_conv;
7315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7317 LDKThirtyTwoBytes val_ref;
7318 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7319 return UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7323 LDKUpdateAddHTLC this_ptr_conv;
7324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7326 return UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7330 LDKUpdateAddHTLC this_ptr_conv;
7331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7333 return UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7337 LDKUpdateAddHTLC this_ptr_conv;
7338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7340 return UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7344 LDKUpdateAddHTLC this_ptr_conv;
7345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7347 return UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7350 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7351 LDKUpdateAddHTLC this_ptr_conv;
7352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7354 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7355 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7360 LDKUpdateAddHTLC this_ptr_conv;
7361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7363 LDKThirtyTwoBytes val_ref;
7364 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7365 return UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7368 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7369 LDKUpdateAddHTLC this_ptr_conv;
7370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7372 return UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7376 LDKUpdateAddHTLC this_ptr_conv;
7377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7379 return UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7383 LDKUpdateFulfillHTLC this_ptr_conv;
7384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7386 return UpdateFulfillHTLC_free(this_ptr_conv);
7389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7390 LDKUpdateFulfillHTLC orig_conv;
7391 orig_conv.inner = (void*)(orig & (~1));
7392 orig_conv.is_owned = (orig & 1) || (orig == 0);
7393 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7394 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7397 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7398 LDKUpdateFulfillHTLC this_ptr_conv;
7399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7401 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7402 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7407 LDKUpdateFulfillHTLC this_ptr_conv;
7408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7410 LDKThirtyTwoBytes val_ref;
7411 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7412 return UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7416 LDKUpdateFulfillHTLC this_ptr_conv;
7417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7419 return UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7423 LDKUpdateFulfillHTLC this_ptr_conv;
7424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7426 return UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7429 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7430 LDKUpdateFulfillHTLC this_ptr_conv;
7431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7433 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7434 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7439 LDKUpdateFulfillHTLC this_ptr_conv;
7440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7442 LDKThirtyTwoBytes val_ref;
7443 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7444 return UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7447 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) {
7448 LDKThirtyTwoBytes channel_id_arg_ref;
7449 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7450 LDKThirtyTwoBytes payment_preimage_arg_ref;
7451 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7452 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7457 LDKUpdateFailHTLC this_ptr_conv;
7458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7460 return UpdateFailHTLC_free(this_ptr_conv);
7463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7464 LDKUpdateFailHTLC orig_conv;
7465 orig_conv.inner = (void*)(orig & (~1));
7466 orig_conv.is_owned = (orig & 1) || (orig == 0);
7467 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7468 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7471 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7472 LDKUpdateFailHTLC this_ptr_conv;
7473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7475 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7476 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7481 LDKUpdateFailHTLC this_ptr_conv;
7482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7484 LDKThirtyTwoBytes val_ref;
7485 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7486 return UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7490 LDKUpdateFailHTLC this_ptr_conv;
7491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7493 return UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7497 LDKUpdateFailHTLC this_ptr_conv;
7498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7500 return UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7504 LDKUpdateFailMalformedHTLC this_ptr_conv;
7505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7507 return UpdateFailMalformedHTLC_free(this_ptr_conv);
7510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7511 LDKUpdateFailMalformedHTLC orig_conv;
7512 orig_conv.inner = (void*)(orig & (~1));
7513 orig_conv.is_owned = (orig & 1) || (orig == 0);
7514 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7515 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7519 LDKUpdateFailMalformedHTLC this_ptr_conv;
7520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7522 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7523 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7528 LDKUpdateFailMalformedHTLC this_ptr_conv;
7529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7531 LDKThirtyTwoBytes val_ref;
7532 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7533 return UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7537 LDKUpdateFailMalformedHTLC this_ptr_conv;
7538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7540 return UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7544 LDKUpdateFailMalformedHTLC this_ptr_conv;
7545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7547 return UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7550 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7551 LDKUpdateFailMalformedHTLC this_ptr_conv;
7552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7554 return UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7558 LDKUpdateFailMalformedHTLC this_ptr_conv;
7559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7561 return UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7565 LDKCommitmentSigned this_ptr_conv;
7566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7568 return CommitmentSigned_free(this_ptr_conv);
7571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7572 LDKCommitmentSigned orig_conv;
7573 orig_conv.inner = (void*)(orig & (~1));
7574 orig_conv.is_owned = (orig & 1) || (orig == 0);
7575 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7576 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7579 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7580 LDKCommitmentSigned this_ptr_conv;
7581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7583 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7584 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7589 LDKCommitmentSigned this_ptr_conv;
7590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7592 LDKThirtyTwoBytes val_ref;
7593 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7594 return CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7598 LDKCommitmentSigned this_ptr_conv;
7599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7601 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7602 *ret = CommitmentSigned_get_signature(&this_ptr_conv);
7606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7607 LDKCommitmentSigned this_ptr_conv;
7608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7610 LDKSignature val_conv = *(LDKSignature*)val;
7612 return CommitmentSigned_set_signature(&this_ptr_conv, val_conv);
7615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7616 LDKCommitmentSigned this_ptr_conv;
7617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7619 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7621 return CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7624 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) {
7625 LDKThirtyTwoBytes channel_id_arg_ref;
7626 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7627 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
7628 FREE((void*)signature_arg);
7629 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7630 FREE((void*)htlc_signatures_arg);
7631 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_conv, htlc_signatures_arg_conv);
7632 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7636 LDKRevokeAndACK this_ptr_conv;
7637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7639 return RevokeAndACK_free(this_ptr_conv);
7642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7643 LDKRevokeAndACK orig_conv;
7644 orig_conv.inner = (void*)(orig & (~1));
7645 orig_conv.is_owned = (orig & 1) || (orig == 0);
7646 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7647 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7650 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7651 LDKRevokeAndACK 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7655 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7660 LDKRevokeAndACK 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 LDKThirtyTwoBytes val_ref;
7664 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7665 return RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7668 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7669 LDKRevokeAndACK 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7673 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7678 LDKRevokeAndACK 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 LDKThirtyTwoBytes val_ref;
7682 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7683 return RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7687 LDKRevokeAndACK 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7691 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7696 LDKRevokeAndACK this_ptr_conv;
7697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7699 LDKPublicKey val_ref;
7700 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7701 return RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7704 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray per_commitment_secret_arg, jbyteArray next_per_commitment_point_arg) {
7705 LDKThirtyTwoBytes channel_id_arg_ref;
7706 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7707 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7708 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7709 LDKPublicKey next_per_commitment_point_arg_ref;
7710 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7711 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7712 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7716 LDKUpdateFee this_ptr_conv;
7717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7719 return UpdateFee_free(this_ptr_conv);
7722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7723 LDKUpdateFee orig_conv;
7724 orig_conv.inner = (void*)(orig & (~1));
7725 orig_conv.is_owned = (orig & 1) || (orig == 0);
7726 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
7727 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7730 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7731 LDKUpdateFee this_ptr_conv;
7732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7734 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7735 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7740 LDKUpdateFee this_ptr_conv;
7741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7743 LDKThirtyTwoBytes val_ref;
7744 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7745 return UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7748 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7749 LDKUpdateFee 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 return UpdateFee_get_feerate_per_kw(&this_ptr_conv);
7755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7756 LDKUpdateFee this_ptr_conv;
7757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7759 return UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
7762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
7763 LDKThirtyTwoBytes channel_id_arg_ref;
7764 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7765 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
7766 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7770 LDKDataLossProtect this_ptr_conv;
7771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7773 return DataLossProtect_free(this_ptr_conv);
7776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7777 LDKDataLossProtect orig_conv;
7778 orig_conv.inner = (void*)(orig & (~1));
7779 orig_conv.is_owned = (orig & 1) || (orig == 0);
7780 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
7781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7785 LDKDataLossProtect this_ptr_conv;
7786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7788 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7789 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
7793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7794 LDKDataLossProtect this_ptr_conv;
7795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7797 LDKThirtyTwoBytes val_ref;
7798 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7799 return DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
7802 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7803 LDKDataLossProtect this_ptr_conv;
7804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7806 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7807 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
7811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7812 LDKDataLossProtect this_ptr_conv;
7813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7815 LDKPublicKey val_ref;
7816 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7817 return DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
7820 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jbyteArray your_last_per_commitment_secret_arg, jbyteArray my_current_per_commitment_point_arg) {
7821 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
7822 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
7823 LDKPublicKey my_current_per_commitment_point_arg_ref;
7824 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
7825 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
7826 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7830 LDKChannelReestablish this_ptr_conv;
7831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7833 return ChannelReestablish_free(this_ptr_conv);
7836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7837 LDKChannelReestablish orig_conv;
7838 orig_conv.inner = (void*)(orig & (~1));
7839 orig_conv.is_owned = (orig & 1) || (orig == 0);
7840 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
7841 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7844 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7845 LDKChannelReestablish this_ptr_conv;
7846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7848 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7849 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
7853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7854 LDKChannelReestablish 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 LDKThirtyTwoBytes val_ref;
7858 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7859 return ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
7862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7863 LDKChannelReestablish this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7866 return ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
7869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7870 LDKChannelReestablish this_ptr_conv;
7871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7873 return ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
7876 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
7877 LDKChannelReestablish this_ptr_conv;
7878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7880 return ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
7883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7884 LDKChannelReestablish this_ptr_conv;
7885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7887 return ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
7890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7891 LDKAnnouncementSignatures this_ptr_conv;
7892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7894 return AnnouncementSignatures_free(this_ptr_conv);
7897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7898 LDKAnnouncementSignatures orig_conv;
7899 orig_conv.inner = (void*)(orig & (~1));
7900 orig_conv.is_owned = (orig & 1) || (orig == 0);
7901 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
7902 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7905 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7906 LDKAnnouncementSignatures 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7910 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
7914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7915 LDKAnnouncementSignatures 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 LDKThirtyTwoBytes val_ref;
7919 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7920 return AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
7923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7924 LDKAnnouncementSignatures 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 return AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
7930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7931 LDKAnnouncementSignatures this_ptr_conv;
7932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7934 return AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
7937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7938 LDKAnnouncementSignatures this_ptr_conv;
7939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7941 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7942 *ret = AnnouncementSignatures_get_node_signature(&this_ptr_conv);
7946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7947 LDKAnnouncementSignatures this_ptr_conv;
7948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7950 LDKSignature val_conv = *(LDKSignature*)val;
7952 return AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_conv);
7955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7956 LDKAnnouncementSignatures this_ptr_conv;
7957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7958 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7959 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7960 *ret = AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv);
7964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7965 LDKAnnouncementSignatures this_ptr_conv;
7966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7968 LDKSignature val_conv = *(LDKSignature*)val;
7970 return AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_conv);
7973 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) {
7974 LDKThirtyTwoBytes channel_id_arg_ref;
7975 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7976 LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
7977 FREE((void*)node_signature_arg);
7978 LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
7979 FREE((void*)bitcoin_signature_arg);
7980 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
7981 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7985 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
7986 FREE((void*)this_ptr);
7987 return NetAddress_free(this_ptr_conv);
7990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7991 LDKUnsignedNodeAnnouncement this_ptr_conv;
7992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7994 return UnsignedNodeAnnouncement_free(this_ptr_conv);
7997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7998 LDKUnsignedNodeAnnouncement orig_conv;
7999 orig_conv.inner = (void*)(orig & (~1));
8000 orig_conv.is_owned = (orig & 1) || (orig == 0);
8001 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
8002 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8006 LDKUnsignedNodeAnnouncement this_ptr_conv;
8007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8009 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8010 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8014 LDKUnsignedNodeAnnouncement this_ptr_conv;
8015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8017 LDKNodeFeatures val_conv;
8018 val_conv.inner = (void*)(val & (~1));
8019 val_conv.is_owned = (val & 1) || (val == 0);
8020 return UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8023 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8024 LDKUnsignedNodeAnnouncement this_ptr_conv;
8025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8027 return UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8031 LDKUnsignedNodeAnnouncement this_ptr_conv;
8032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8034 return UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8037 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8038 LDKUnsignedNodeAnnouncement this_ptr_conv;
8039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8041 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8042 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8047 LDKUnsignedNodeAnnouncement 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 LDKPublicKey val_ref;
8051 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8052 return UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8055 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8056 LDKUnsignedNodeAnnouncement this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8059 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8060 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8065 LDKUnsignedNodeAnnouncement this_ptr_conv;
8066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8068 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
8070 return UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_conv);
8073 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8074 LDKUnsignedNodeAnnouncement this_ptr_conv;
8075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8077 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8078 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8083 LDKUnsignedNodeAnnouncement this_ptr_conv;
8084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8086 LDKThirtyTwoBytes val_ref;
8087 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8088 return UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8092 LDKUnsignedNodeAnnouncement this_ptr_conv;
8093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8095 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8097 return UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8101 LDKNodeAnnouncement this_ptr_conv;
8102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8104 return NodeAnnouncement_free(this_ptr_conv);
8107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8108 LDKNodeAnnouncement orig_conv;
8109 orig_conv.inner = (void*)(orig & (~1));
8110 orig_conv.is_owned = (orig & 1) || (orig == 0);
8111 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8112 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8115 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8116 LDKNodeAnnouncement this_ptr_conv;
8117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8119 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8120 *ret = NodeAnnouncement_get_signature(&this_ptr_conv);
8124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8125 LDKNodeAnnouncement this_ptr_conv;
8126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8128 LDKSignature val_conv = *(LDKSignature*)val;
8130 return NodeAnnouncement_set_signature(&this_ptr_conv, val_conv);
8133 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8134 LDKNodeAnnouncement this_ptr_conv;
8135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8137 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8138 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8142 LDKNodeAnnouncement this_ptr_conv;
8143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8145 LDKUnsignedNodeAnnouncement val_conv;
8146 val_conv.inner = (void*)(val & (~1));
8147 val_conv.is_owned = (val & 1) || (val == 0);
8148 if (val_conv.inner != NULL)
8149 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8150 return NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_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 LDKUnsignedNodeAnnouncement 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 if (contents_arg_conv.inner != NULL)
8160 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8161 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
8162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8166 LDKUnsignedChannelAnnouncement this_ptr_conv;
8167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8169 return UnsignedChannelAnnouncement_free(this_ptr_conv);
8172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8173 LDKUnsignedChannelAnnouncement orig_conv;
8174 orig_conv.inner = (void*)(orig & (~1));
8175 orig_conv.is_owned = (orig & 1) || (orig == 0);
8176 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8177 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8181 LDKUnsignedChannelAnnouncement 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 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8185 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8189 LDKUnsignedChannelAnnouncement this_ptr_conv;
8190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8192 LDKChannelFeatures val_conv;
8193 val_conv.inner = (void*)(val & (~1));
8194 val_conv.is_owned = (val & 1) || (val == 0);
8195 return UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8198 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8199 LDKUnsignedChannelAnnouncement this_ptr_conv;
8200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8202 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8203 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8208 LDKUnsignedChannelAnnouncement this_ptr_conv;
8209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8211 LDKThirtyTwoBytes val_ref;
8212 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8213 return UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8217 LDKUnsignedChannelAnnouncement this_ptr_conv;
8218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8220 return UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8224 LDKUnsignedChannelAnnouncement this_ptr_conv;
8225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8226 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8227 return UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8231 LDKUnsignedChannelAnnouncement this_ptr_conv;
8232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8234 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8235 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8240 LDKUnsignedChannelAnnouncement this_ptr_conv;
8241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8243 LDKPublicKey val_ref;
8244 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8245 return UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8249 LDKUnsignedChannelAnnouncement this_ptr_conv;
8250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8252 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8253 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8258 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
8262 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8263 return UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8266 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8267 LDKUnsignedChannelAnnouncement this_ptr_conv;
8268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8270 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8271 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8276 LDKUnsignedChannelAnnouncement this_ptr_conv;
8277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8279 LDKPublicKey val_ref;
8280 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8281 return UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8285 LDKUnsignedChannelAnnouncement this_ptr_conv;
8286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8288 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8289 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8294 LDKUnsignedChannelAnnouncement this_ptr_conv;
8295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8297 LDKPublicKey val_ref;
8298 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8299 return UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8303 LDKChannelAnnouncement this_ptr_conv;
8304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8306 return ChannelAnnouncement_free(this_ptr_conv);
8309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8310 LDKChannelAnnouncement orig_conv;
8311 orig_conv.inner = (void*)(orig & (~1));
8312 orig_conv.is_owned = (orig & 1) || (orig == 0);
8313 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8314 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8318 LDKChannelAnnouncement this_ptr_conv;
8319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8321 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8322 *ret = ChannelAnnouncement_get_node_signature_1(&this_ptr_conv);
8326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8327 LDKChannelAnnouncement this_ptr_conv;
8328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8330 LDKSignature val_conv = *(LDKSignature*)val;
8332 return ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_conv);
8335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8336 LDKChannelAnnouncement this_ptr_conv;
8337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8339 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8340 *ret = ChannelAnnouncement_get_node_signature_2(&this_ptr_conv);
8344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8345 LDKChannelAnnouncement this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8348 LDKSignature val_conv = *(LDKSignature*)val;
8350 return ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_conv);
8353 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8354 LDKChannelAnnouncement this_ptr_conv;
8355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8357 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8358 *ret = ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv);
8362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8363 LDKChannelAnnouncement 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 LDKSignature val_conv = *(LDKSignature*)val;
8368 return ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_conv);
8371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8372 LDKChannelAnnouncement 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8376 *ret = ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv);
8380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8381 LDKChannelAnnouncement 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 LDKSignature val_conv = *(LDKSignature*)val;
8386 return ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_conv);
8389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8390 LDKChannelAnnouncement this_ptr_conv;
8391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8393 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8394 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8398 LDKChannelAnnouncement this_ptr_conv;
8399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8401 LDKUnsignedChannelAnnouncement val_conv;
8402 val_conv.inner = (void*)(val & (~1));
8403 val_conv.is_owned = (val & 1) || (val == 0);
8404 if (val_conv.inner != NULL)
8405 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8406 return ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8409 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) {
8410 LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
8411 FREE((void*)node_signature_1_arg);
8412 LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
8413 FREE((void*)node_signature_2_arg);
8414 LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
8415 FREE((void*)bitcoin_signature_1_arg);
8416 LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
8417 FREE((void*)bitcoin_signature_2_arg);
8418 LDKUnsignedChannelAnnouncement contents_arg_conv;
8419 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8420 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8421 if (contents_arg_conv.inner != NULL)
8422 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8423 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);
8424 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8428 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_free(this_ptr_conv);
8434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8435 LDKUnsignedChannelUpdate orig_conv;
8436 orig_conv.inner = (void*)(orig & (~1));
8437 orig_conv.is_owned = (orig & 1) || (orig == 0);
8438 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8439 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8442 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8443 LDKUnsignedChannelUpdate this_ptr_conv;
8444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8446 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8447 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8452 LDKUnsignedChannelUpdate this_ptr_conv;
8453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8455 LDKThirtyTwoBytes val_ref;
8456 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8457 return UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8461 LDKUnsignedChannelUpdate this_ptr_conv;
8462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8464 return UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8468 LDKUnsignedChannelUpdate this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8471 return UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8474 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8475 LDKUnsignedChannelUpdate this_ptr_conv;
8476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8478 return UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8482 LDKUnsignedChannelUpdate this_ptr_conv;
8483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8485 return UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8488 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8489 LDKUnsignedChannelUpdate this_ptr_conv;
8490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8492 return UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8496 LDKUnsignedChannelUpdate this_ptr_conv;
8497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8499 return UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8502 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8503 LDKUnsignedChannelUpdate this_ptr_conv;
8504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8506 return UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8510 LDKUnsignedChannelUpdate this_ptr_conv;
8511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8513 return UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8517 LDKUnsignedChannelUpdate this_ptr_conv;
8518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8520 return UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8524 LDKUnsignedChannelUpdate this_ptr_conv;
8525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8527 return UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8530 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8531 LDKUnsignedChannelUpdate this_ptr_conv;
8532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8534 return UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8538 LDKUnsignedChannelUpdate this_ptr_conv;
8539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8541 return UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8544 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8545 LDKUnsignedChannelUpdate this_ptr_conv;
8546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8548 return UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8552 LDKUnsignedChannelUpdate this_ptr_conv;
8553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8555 return UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8559 LDKChannelUpdate this_ptr_conv;
8560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8562 return ChannelUpdate_free(this_ptr_conv);
8565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8566 LDKChannelUpdate orig_conv;
8567 orig_conv.inner = (void*)(orig & (~1));
8568 orig_conv.is_owned = (orig & 1) || (orig == 0);
8569 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8570 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8573 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8574 LDKChannelUpdate this_ptr_conv;
8575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8577 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8578 *ret = ChannelUpdate_get_signature(&this_ptr_conv);
8582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8583 LDKChannelUpdate this_ptr_conv;
8584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8586 LDKSignature val_conv = *(LDKSignature*)val;
8588 return ChannelUpdate_set_signature(&this_ptr_conv, val_conv);
8591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8592 LDKChannelUpdate this_ptr_conv;
8593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8595 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8596 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8600 LDKChannelUpdate this_ptr_conv;
8601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8603 LDKUnsignedChannelUpdate val_conv;
8604 val_conv.inner = (void*)(val & (~1));
8605 val_conv.is_owned = (val & 1) || (val == 0);
8606 if (val_conv.inner != NULL)
8607 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8608 return ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
8612 LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
8613 FREE((void*)signature_arg);
8614 LDKUnsignedChannelUpdate contents_arg_conv;
8615 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8616 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8617 if (contents_arg_conv.inner != NULL)
8618 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
8619 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
8620 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8624 LDKQueryChannelRange this_ptr_conv;
8625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8627 return QueryChannelRange_free(this_ptr_conv);
8630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8631 LDKQueryChannelRange orig_conv;
8632 orig_conv.inner = (void*)(orig & (~1));
8633 orig_conv.is_owned = (orig & 1) || (orig == 0);
8634 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
8635 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8638 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8639 LDKQueryChannelRange this_ptr_conv;
8640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8642 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8643 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8648 LDKQueryChannelRange this_ptr_conv;
8649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8651 LDKThirtyTwoBytes val_ref;
8652 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8653 return QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8656 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8657 LDKQueryChannelRange this_ptr_conv;
8658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8659 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8660 return QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8664 LDKQueryChannelRange this_ptr_conv;
8665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8667 return QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8670 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8671 LDKQueryChannelRange this_ptr_conv;
8672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8674 return QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8678 LDKQueryChannelRange this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8681 return QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8684 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) {
8685 LDKThirtyTwoBytes chain_hash_arg_ref;
8686 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8687 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8688 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8692 LDKReplyChannelRange this_ptr_conv;
8693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8695 return ReplyChannelRange_free(this_ptr_conv);
8698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8699 LDKReplyChannelRange orig_conv;
8700 orig_conv.inner = (void*)(orig & (~1));
8701 orig_conv.is_owned = (orig & 1) || (orig == 0);
8702 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
8703 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8706 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8707 LDKReplyChannelRange this_ptr_conv;
8708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8710 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8711 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
8715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8716 LDKReplyChannelRange this_ptr_conv;
8717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8719 LDKThirtyTwoBytes val_ref;
8720 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8721 return ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8724 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8725 LDKReplyChannelRange this_ptr_conv;
8726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8728 return ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
8731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8732 LDKReplyChannelRange this_ptr_conv;
8733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8735 return ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
8738 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8739 LDKReplyChannelRange this_ptr_conv;
8740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8742 return ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
8745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8746 LDKReplyChannelRange this_ptr_conv;
8747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8749 return ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8752 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8753 LDKReplyChannelRange this_ptr_conv;
8754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8756 return ReplyChannelRange_get_full_information(&this_ptr_conv);
8759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8760 LDKReplyChannelRange this_ptr_conv;
8761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8763 return ReplyChannelRange_set_full_information(&this_ptr_conv, val);
8766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8767 LDKReplyChannelRange this_ptr_conv;
8768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8770 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8772 return ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
8775 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) {
8776 LDKThirtyTwoBytes chain_hash_arg_ref;
8777 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8778 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8779 FREE((void*)short_channel_ids_arg);
8780 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
8781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8785 LDKQueryShortChannelIds this_ptr_conv;
8786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8788 return QueryShortChannelIds_free(this_ptr_conv);
8791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8792 LDKQueryShortChannelIds orig_conv;
8793 orig_conv.inner = (void*)(orig & (~1));
8794 orig_conv.is_owned = (orig & 1) || (orig == 0);
8795 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
8796 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8799 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8800 LDKQueryShortChannelIds this_ptr_conv;
8801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8803 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8804 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
8808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8809 LDKQueryShortChannelIds this_ptr_conv;
8810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8812 LDKThirtyTwoBytes val_ref;
8813 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8814 return QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
8817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8818 LDKQueryShortChannelIds this_ptr_conv;
8819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8821 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8823 return QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
8826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
8827 LDKThirtyTwoBytes chain_hash_arg_ref;
8828 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8829 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
8830 FREE((void*)short_channel_ids_arg);
8831 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
8832 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8836 LDKReplyShortChannelIdsEnd this_ptr_conv;
8837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8839 return ReplyShortChannelIdsEnd_free(this_ptr_conv);
8842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8843 LDKReplyShortChannelIdsEnd orig_conv;
8844 orig_conv.inner = (void*)(orig & (~1));
8845 orig_conv.is_owned = (orig & 1) || (orig == 0);
8846 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
8847 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8851 LDKReplyShortChannelIdsEnd this_ptr_conv;
8852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8854 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8855 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
8859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8860 LDKReplyShortChannelIdsEnd this_ptr_conv;
8861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8863 LDKThirtyTwoBytes val_ref;
8864 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8865 return ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
8868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
8869 LDKReplyShortChannelIdsEnd this_ptr_conv;
8870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8872 return ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
8875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8876 LDKReplyShortChannelIdsEnd this_ptr_conv;
8877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8879 return ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
8882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
8883 LDKThirtyTwoBytes chain_hash_arg_ref;
8884 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8885 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
8886 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8890 LDKGossipTimestampFilter this_ptr_conv;
8891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8893 return GossipTimestampFilter_free(this_ptr_conv);
8896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8897 LDKGossipTimestampFilter orig_conv;
8898 orig_conv.inner = (void*)(orig & (~1));
8899 orig_conv.is_owned = (orig & 1) || (orig == 0);
8900 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
8901 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8905 LDKGossipTimestampFilter this_ptr_conv;
8906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8908 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8909 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
8913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8914 LDKGossipTimestampFilter this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8917 LDKThirtyTwoBytes val_ref;
8918 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8919 return GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
8922 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8923 LDKGossipTimestampFilter this_ptr_conv;
8924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8926 return GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
8929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8930 LDKGossipTimestampFilter this_ptr_conv;
8931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8933 return GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
8936 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
8937 LDKGossipTimestampFilter this_ptr_conv;
8938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8940 return GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
8943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8944 LDKGossipTimestampFilter this_ptr_conv;
8945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8947 return GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
8950 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) {
8951 LDKThirtyTwoBytes chain_hash_arg_ref;
8952 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8953 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
8954 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8958 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
8959 FREE((void*)this_ptr);
8960 return ErrorAction_free(this_ptr_conv);
8963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8964 LDKLightningError this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8967 return LightningError_free(this_ptr_conv);
8970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
8971 LDKLightningError this_ptr_conv;
8972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8974 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
8975 *ret = LightningError_get_err(&this_ptr_conv);
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8980 LDKLightningError this_ptr_conv;
8981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8983 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
8985 return LightningError_set_err(&this_ptr_conv, val_conv);
8988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
8989 LDKLightningError this_ptr_conv;
8990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8992 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
8993 *ret = LightningError_get_action(&this_ptr_conv);
8997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8998 LDKLightningError this_ptr_conv;
8999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9001 LDKErrorAction val_conv = *(LDKErrorAction*)val;
9003 return LightningError_set_action(&this_ptr_conv, val_conv);
9006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
9007 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
9008 FREE((void*)err_arg);
9009 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9010 FREE((void*)action_arg);
9011 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
9012 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9016 LDKCommitmentUpdate this_ptr_conv;
9017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9019 return CommitmentUpdate_free(this_ptr_conv);
9022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9023 LDKCommitmentUpdate orig_conv;
9024 orig_conv.inner = (void*)(orig & (~1));
9025 orig_conv.is_owned = (orig & 1) || (orig == 0);
9026 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9027 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9031 LDKCommitmentUpdate this_ptr_conv;
9032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9034 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9036 return CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9040 LDKCommitmentUpdate this_ptr_conv;
9041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9043 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9045 return CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9049 LDKCommitmentUpdate this_ptr_conv;
9050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9052 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9054 return CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9058 LDKCommitmentUpdate this_ptr_conv;
9059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9061 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9063 return CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9067 LDKCommitmentUpdate this_ptr_conv;
9068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9070 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9071 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9075 LDKCommitmentUpdate this_ptr_conv;
9076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9078 LDKUpdateFee val_conv;
9079 val_conv.inner = (void*)(val & (~1));
9080 val_conv.is_owned = (val & 1) || (val == 0);
9081 if (val_conv.inner != NULL)
9082 val_conv = UpdateFee_clone(&val_conv);
9083 return CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9087 LDKCommitmentUpdate this_ptr_conv;
9088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9090 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9091 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9095 LDKCommitmentUpdate this_ptr_conv;
9096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9098 LDKCommitmentSigned val_conv;
9099 val_conv.inner = (void*)(val & (~1));
9100 val_conv.is_owned = (val & 1) || (val == 0);
9101 if (val_conv.inner != NULL)
9102 val_conv = CommitmentSigned_clone(&val_conv);
9103 return CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9106 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) {
9107 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9108 FREE((void*)update_add_htlcs_arg);
9109 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9110 FREE((void*)update_fulfill_htlcs_arg);
9111 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9112 FREE((void*)update_fail_htlcs_arg);
9113 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9114 FREE((void*)update_fail_malformed_htlcs_arg);
9115 LDKUpdateFee update_fee_arg_conv;
9116 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9117 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9118 if (update_fee_arg_conv.inner != NULL)
9119 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9120 LDKCommitmentSigned commitment_signed_arg_conv;
9121 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9122 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9123 if (commitment_signed_arg_conv.inner != NULL)
9124 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9125 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);
9126 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9130 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9131 FREE((void*)this_ptr);
9132 return HTLCFailChannelUpdate_free(this_ptr_conv);
9135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9136 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9137 FREE((void*)this_ptr);
9138 return ChannelMessageHandler_free(this_ptr_conv);
9141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9142 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9143 FREE((void*)this_ptr);
9144 return RoutingMessageHandler_free(this_ptr_conv);
9147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9148 LDKAcceptChannel obj_conv;
9149 obj_conv.inner = (void*)(obj & (~1));
9150 obj_conv.is_owned = (obj & 1) || (obj == 0);
9151 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9152 *ret = AcceptChannel_write(&obj_conv);
9156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9157 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9158 LDKAcceptChannel ret = AcceptChannel_read(ser_conv);
9159 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9163 LDKAnnouncementSignatures obj_conv;
9164 obj_conv.inner = (void*)(obj & (~1));
9165 obj_conv.is_owned = (obj & 1) || (obj == 0);
9166 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9167 *ret = AnnouncementSignatures_write(&obj_conv);
9171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
9172 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9173 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_conv);
9174 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9178 LDKChannelReestablish obj_conv;
9179 obj_conv.inner = (void*)(obj & (~1));
9180 obj_conv.is_owned = (obj & 1) || (obj == 0);
9181 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9182 *ret = ChannelReestablish_write(&obj_conv);
9186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
9187 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9188 LDKChannelReestablish ret = ChannelReestablish_read(ser_conv);
9189 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9193 LDKClosingSigned obj_conv;
9194 obj_conv.inner = (void*)(obj & (~1));
9195 obj_conv.is_owned = (obj & 1) || (obj == 0);
9196 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9197 *ret = ClosingSigned_write(&obj_conv);
9201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9202 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9203 LDKClosingSigned ret = ClosingSigned_read(ser_conv);
9204 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9208 LDKCommitmentSigned obj_conv;
9209 obj_conv.inner = (void*)(obj & (~1));
9210 obj_conv.is_owned = (obj & 1) || (obj == 0);
9211 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9212 *ret = CommitmentSigned_write(&obj_conv);
9216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9217 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9218 LDKCommitmentSigned ret = CommitmentSigned_read(ser_conv);
9219 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9223 LDKFundingCreated obj_conv;
9224 obj_conv.inner = (void*)(obj & (~1));
9225 obj_conv.is_owned = (obj & 1) || (obj == 0);
9226 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9227 *ret = FundingCreated_write(&obj_conv);
9231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
9232 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9233 LDKFundingCreated ret = FundingCreated_read(ser_conv);
9234 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9238 LDKFundingSigned obj_conv;
9239 obj_conv.inner = (void*)(obj & (~1));
9240 obj_conv.is_owned = (obj & 1) || (obj == 0);
9241 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9242 *ret = FundingSigned_write(&obj_conv);
9246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
9247 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9248 LDKFundingSigned ret = FundingSigned_read(ser_conv);
9249 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9253 LDKFundingLocked obj_conv;
9254 obj_conv.inner = (void*)(obj & (~1));
9255 obj_conv.is_owned = (obj & 1) || (obj == 0);
9256 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9257 *ret = FundingLocked_write(&obj_conv);
9261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
9262 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9263 LDKFundingLocked ret = FundingLocked_read(ser_conv);
9264 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9267 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9269 obj_conv.inner = (void*)(obj & (~1));
9270 obj_conv.is_owned = (obj & 1) || (obj == 0);
9271 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9272 *ret = Init_write(&obj_conv);
9276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
9277 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9278 LDKInit ret = Init_read(ser_conv);
9279 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9283 LDKOpenChannel obj_conv;
9284 obj_conv.inner = (void*)(obj & (~1));
9285 obj_conv.is_owned = (obj & 1) || (obj == 0);
9286 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9287 *ret = OpenChannel_write(&obj_conv);
9291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
9292 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9293 LDKOpenChannel ret = OpenChannel_read(ser_conv);
9294 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9298 LDKRevokeAndACK obj_conv;
9299 obj_conv.inner = (void*)(obj & (~1));
9300 obj_conv.is_owned = (obj & 1) || (obj == 0);
9301 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9302 *ret = RevokeAndACK_write(&obj_conv);
9306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
9307 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9308 LDKRevokeAndACK ret = RevokeAndACK_read(ser_conv);
9309 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9313 LDKShutdown obj_conv;
9314 obj_conv.inner = (void*)(obj & (~1));
9315 obj_conv.is_owned = (obj & 1) || (obj == 0);
9316 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9317 *ret = Shutdown_write(&obj_conv);
9321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
9322 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9323 LDKShutdown ret = Shutdown_read(ser_conv);
9324 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9328 LDKUpdateFailHTLC obj_conv;
9329 obj_conv.inner = (void*)(obj & (~1));
9330 obj_conv.is_owned = (obj & 1) || (obj == 0);
9331 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9332 *ret = UpdateFailHTLC_write(&obj_conv);
9336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9337 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9338 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_conv);
9339 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9343 LDKUpdateFailMalformedHTLC obj_conv;
9344 obj_conv.inner = (void*)(obj & (~1));
9345 obj_conv.is_owned = (obj & 1) || (obj == 0);
9346 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9347 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
9351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9352 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9353 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_conv);
9354 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9357 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9358 LDKUpdateFee obj_conv;
9359 obj_conv.inner = (void*)(obj & (~1));
9360 obj_conv.is_owned = (obj & 1) || (obj == 0);
9361 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9362 *ret = UpdateFee_write(&obj_conv);
9366 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
9367 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9368 LDKUpdateFee ret = UpdateFee_read(ser_conv);
9369 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9373 LDKUpdateFulfillHTLC obj_conv;
9374 obj_conv.inner = (void*)(obj & (~1));
9375 obj_conv.is_owned = (obj & 1) || (obj == 0);
9376 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9377 *ret = UpdateFulfillHTLC_write(&obj_conv);
9381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9382 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9383 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_conv);
9384 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9388 LDKUpdateAddHTLC obj_conv;
9389 obj_conv.inner = (void*)(obj & (~1));
9390 obj_conv.is_owned = (obj & 1) || (obj == 0);
9391 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9392 *ret = UpdateAddHTLC_write(&obj_conv);
9396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
9397 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9398 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_conv);
9399 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9404 obj_conv.inner = (void*)(obj & (~1));
9405 obj_conv.is_owned = (obj & 1) || (obj == 0);
9406 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9407 *ret = Ping_write(&obj_conv);
9411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
9412 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9413 LDKPing ret = Ping_read(ser_conv);
9414 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9419 obj_conv.inner = (void*)(obj & (~1));
9420 obj_conv.is_owned = (obj & 1) || (obj == 0);
9421 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9422 *ret = Pong_write(&obj_conv);
9426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
9427 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9428 LDKPong ret = Pong_read(ser_conv);
9429 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9433 LDKUnsignedChannelAnnouncement obj_conv;
9434 obj_conv.inner = (void*)(obj & (~1));
9435 obj_conv.is_owned = (obj & 1) || (obj == 0);
9436 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9437 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9442 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9443 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_conv);
9444 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9448 LDKChannelAnnouncement obj_conv;
9449 obj_conv.inner = (void*)(obj & (~1));
9450 obj_conv.is_owned = (obj & 1) || (obj == 0);
9451 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9452 *ret = ChannelAnnouncement_write(&obj_conv);
9456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9457 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9458 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_conv);
9459 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9463 LDKUnsignedChannelUpdate obj_conv;
9464 obj_conv.inner = (void*)(obj & (~1));
9465 obj_conv.is_owned = (obj & 1) || (obj == 0);
9466 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9467 *ret = UnsignedChannelUpdate_write(&obj_conv);
9471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9472 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9473 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_conv);
9474 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9478 LDKChannelUpdate obj_conv;
9479 obj_conv.inner = (void*)(obj & (~1));
9480 obj_conv.is_owned = (obj & 1) || (obj == 0);
9481 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9482 *ret = ChannelUpdate_write(&obj_conv);
9486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
9487 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9488 LDKChannelUpdate ret = ChannelUpdate_read(ser_conv);
9489 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9493 LDKErrorMessage obj_conv;
9494 obj_conv.inner = (void*)(obj & (~1));
9495 obj_conv.is_owned = (obj & 1) || (obj == 0);
9496 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9497 *ret = ErrorMessage_write(&obj_conv);
9501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
9502 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9503 LDKErrorMessage ret = ErrorMessage_read(ser_conv);
9504 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9508 LDKUnsignedNodeAnnouncement obj_conv;
9509 obj_conv.inner = (void*)(obj & (~1));
9510 obj_conv.is_owned = (obj & 1) || (obj == 0);
9511 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9512 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9517 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9518 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_conv);
9519 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9523 LDKNodeAnnouncement obj_conv;
9524 obj_conv.inner = (void*)(obj & (~1));
9525 obj_conv.is_owned = (obj & 1) || (obj == 0);
9526 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9527 *ret = NodeAnnouncement_write(&obj_conv);
9531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
9532 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9533 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_conv);
9534 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
9538 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9539 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_conv);
9540 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9544 LDKQueryShortChannelIds obj_conv;
9545 obj_conv.inner = (void*)(obj & (~1));
9546 obj_conv.is_owned = (obj & 1) || (obj == 0);
9547 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9548 *ret = QueryShortChannelIds_write(&obj_conv);
9552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
9553 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9554 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_conv);
9555 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9559 LDKReplyShortChannelIdsEnd obj_conv;
9560 obj_conv.inner = (void*)(obj & (~1));
9561 obj_conv.is_owned = (obj & 1) || (obj == 0);
9562 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9563 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9568 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9569 LDKQueryChannelRange ret = QueryChannelRange_read(ser_conv);
9570 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9573 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9574 LDKQueryChannelRange obj_conv;
9575 obj_conv.inner = (void*)(obj & (~1));
9576 obj_conv.is_owned = (obj & 1) || (obj == 0);
9577 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9578 *ret = QueryChannelRange_write(&obj_conv);
9582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
9583 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9584 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_conv);
9585 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9589 LDKReplyChannelRange obj_conv;
9590 obj_conv.inner = (void*)(obj & (~1));
9591 obj_conv.is_owned = (obj & 1) || (obj == 0);
9592 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9593 *ret = ReplyChannelRange_write(&obj_conv);
9597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
9598 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9599 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_conv);
9600 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
9604 LDKGossipTimestampFilter obj_conv;
9605 obj_conv.inner = (void*)(obj & (~1));
9606 obj_conv.is_owned = (obj & 1) || (obj == 0);
9607 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9608 *ret = GossipTimestampFilter_write(&obj_conv);
9612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9613 LDKMessageHandler this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 return MessageHandler_free(this_ptr_conv);
9619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9620 LDKMessageHandler this_ptr_conv;
9621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9623 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
9627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9628 LDKMessageHandler this_ptr_conv;
9629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9631 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
9632 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
9633 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9634 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
9636 return MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
9639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
9640 LDKMessageHandler this_ptr_conv;
9641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9643 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
9647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9648 LDKMessageHandler this_ptr_conv;
9649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9651 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
9652 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9653 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9654 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
9656 return MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
9659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
9660 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
9661 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
9662 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9663 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
9665 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
9666 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
9667 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9668 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
9670 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
9671 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9675 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
9676 FREE((void*)this_ptr);
9677 return SocketDescriptor_free(this_ptr_conv);
9680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9681 LDKPeerHandleError this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9684 return PeerHandleError_free(this_ptr_conv);
9687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
9688 LDKPeerHandleError this_ptr_conv;
9689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9691 return PeerHandleError_get_no_connection_possible(&this_ptr_conv);
9694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9695 LDKPeerHandleError this_ptr_conv;
9696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9698 return PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
9701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
9702 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
9703 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9707 LDKPeerManager this_ptr_conv;
9708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9710 return PeerManager_free(this_ptr_conv);
9713 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) {
9714 LDKMessageHandler message_handler_conv;
9715 message_handler_conv.inner = (void*)(message_handler & (~1));
9716 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
9717 LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
9718 FREE((void*)our_node_secret);
9719 unsigned char ephemeral_random_data_arr[32];
9720 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
9721 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
9722 LDKLogger logger_conv = *(LDKLogger*)logger;
9723 if (logger_conv.free == LDKLogger_JCalls_free) {
9724 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9725 LDKLogger_JCalls_clone(logger_conv.this_arg);
9727 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
9728 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
9732 LDKPeerManager this_arg_conv;
9733 this_arg_conv.inner = (void*)(this_arg & (~1));
9734 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9735 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
9736 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
9740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong descriptor) {
9741 LDKPeerManager this_arg_conv;
9742 this_arg_conv.inner = (void*)(this_arg & (~1));
9743 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9744 LDKPublicKey their_node_id_ref;
9745 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
9746 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9747 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9748 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9749 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9751 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
9752 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
9756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9757 LDKPeerManager this_arg_conv;
9758 this_arg_conv.inner = (void*)(this_arg & (~1));
9759 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9760 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
9761 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
9762 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9763 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
9765 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9766 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
9770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9771 LDKPeerManager this_arg_conv;
9772 this_arg_conv.inner = (void*)(this_arg & (~1));
9773 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9774 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9775 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
9776 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
9780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
9781 LDKPeerManager this_arg_conv;
9782 this_arg_conv.inner = (void*)(this_arg & (~1));
9783 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9784 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
9785 LDKu8slice data_conv = *(LDKu8slice*)data;
9786 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
9787 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_conv);
9791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
9792 LDKPeerManager this_arg_conv;
9793 this_arg_conv.inner = (void*)(this_arg & (~1));
9794 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9795 return PeerManager_process_events(&this_arg_conv);
9798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
9799 LDKPeerManager this_arg_conv;
9800 this_arg_conv.inner = (void*)(this_arg & (~1));
9801 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9802 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
9803 return PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
9806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
9807 LDKPeerManager this_arg_conv;
9808 this_arg_conv.inner = (void*)(this_arg & (~1));
9809 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
9810 return PeerManager_timer_tick_occured(&this_arg_conv);
9813 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
9814 unsigned char commitment_seed_arr[32];
9815 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
9816 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
9817 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
9818 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
9822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
9823 LDKPublicKey per_commitment_point_ref;
9824 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9825 unsigned char base_secret_arr[32];
9826 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
9827 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
9828 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9829 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
9833 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
9834 LDKPublicKey per_commitment_point_ref;
9835 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9836 LDKPublicKey base_point_ref;
9837 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
9838 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9839 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
9843 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) {
9844 unsigned char per_commitment_secret_arr[32];
9845 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
9846 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
9847 unsigned char countersignatory_revocation_base_secret_arr[32];
9848 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
9849 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
9850 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
9851 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
9855 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray countersignatory_revocation_base_point) {
9856 LDKPublicKey per_commitment_point_ref;
9857 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
9858 LDKPublicKey countersignatory_revocation_base_point_ref;
9859 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
9860 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
9861 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
9865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9866 LDKTxCreationKeys this_ptr_conv;
9867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9869 return TxCreationKeys_free(this_ptr_conv);
9872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9873 LDKTxCreationKeys orig_conv;
9874 orig_conv.inner = (void*)(orig & (~1));
9875 orig_conv.is_owned = (orig & 1) || (orig == 0);
9876 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
9877 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9880 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9881 LDKTxCreationKeys this_ptr_conv;
9882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9884 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9885 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
9889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9890 LDKTxCreationKeys 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 LDKPublicKey val_ref;
9894 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9895 return TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
9898 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9899 LDKTxCreationKeys this_ptr_conv;
9900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9902 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9903 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
9907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9908 LDKTxCreationKeys this_ptr_conv;
9909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9911 LDKPublicKey val_ref;
9912 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9913 return TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
9916 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9917 LDKTxCreationKeys this_ptr_conv;
9918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9919 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9920 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9921 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
9925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9926 LDKTxCreationKeys this_ptr_conv;
9927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9929 LDKPublicKey val_ref;
9930 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9931 return TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
9934 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9935 LDKTxCreationKeys this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9938 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9939 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
9943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9944 LDKTxCreationKeys this_ptr_conv;
9945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9947 LDKPublicKey val_ref;
9948 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9949 return TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
9952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
9953 LDKTxCreationKeys this_ptr_conv;
9954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
9961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9962 LDKTxCreationKeys this_ptr_conv;
9963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9965 LDKPublicKey val_ref;
9966 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9967 return TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
9970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point_arg, jbyteArray revocation_key_arg, jbyteArray broadcaster_htlc_key_arg, jbyteArray countersignatory_htlc_key_arg, jbyteArray broadcaster_delayed_payment_key_arg) {
9971 LDKPublicKey per_commitment_point_arg_ref;
9972 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
9973 LDKPublicKey revocation_key_arg_ref;
9974 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
9975 LDKPublicKey broadcaster_htlc_key_arg_ref;
9976 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
9977 LDKPublicKey countersignatory_htlc_key_arg_ref;
9978 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
9979 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
9980 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
9981 LDKTxCreationKeys ret = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
9982 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
9986 LDKTxCreationKeys obj_conv;
9987 obj_conv.inner = (void*)(obj & (~1));
9988 obj_conv.is_owned = (obj & 1) || (obj == 0);
9989 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9990 *ret = TxCreationKeys_write(&obj_conv);
9994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
9995 LDKu8slice ser_conv = *(LDKu8slice*)ser;
9996 LDKTxCreationKeys ret = TxCreationKeys_read(ser_conv);
9997 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10001 LDKPreCalculatedTxCreationKeys this_ptr_conv;
10002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10004 return PreCalculatedTxCreationKeys_free(this_ptr_conv);
10007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10008 LDKTxCreationKeys keys_conv;
10009 keys_conv.inner = (void*)(keys & (~1));
10010 keys_conv.is_owned = (keys & 1) || (keys == 0);
10011 if (keys_conv.inner != NULL)
10012 keys_conv = TxCreationKeys_clone(&keys_conv);
10013 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10014 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10018 LDKPreCalculatedTxCreationKeys this_arg_conv;
10019 this_arg_conv.inner = (void*)(this_arg & (~1));
10020 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10021 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10022 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10025 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10026 LDKPreCalculatedTxCreationKeys this_arg_conv;
10027 this_arg_conv.inner = (void*)(this_arg & (~1));
10028 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10029 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10030 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10035 LDKChannelPublicKeys this_ptr_conv;
10036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10038 return ChannelPublicKeys_free(this_ptr_conv);
10041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10042 LDKChannelPublicKeys orig_conv;
10043 orig_conv.inner = (void*)(orig & (~1));
10044 orig_conv.is_owned = (orig & 1) || (orig == 0);
10045 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10046 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10049 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10050 LDKChannelPublicKeys this_ptr_conv;
10051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10053 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10054 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10059 LDKChannelPublicKeys this_ptr_conv;
10060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10062 LDKPublicKey val_ref;
10063 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10064 return ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10067 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10068 LDKChannelPublicKeys this_ptr_conv;
10069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10071 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10072 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10077 LDKChannelPublicKeys this_ptr_conv;
10078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10080 LDKPublicKey val_ref;
10081 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10082 return ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10085 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10086 LDKChannelPublicKeys this_ptr_conv;
10087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10089 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10090 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10095 LDKChannelPublicKeys this_ptr_conv;
10096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10098 LDKPublicKey val_ref;
10099 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10100 return ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10103 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10104 LDKChannelPublicKeys this_ptr_conv;
10105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10107 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10108 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10113 LDKChannelPublicKeys this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10116 LDKPublicKey val_ref;
10117 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10118 return ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10121 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10122 LDKChannelPublicKeys this_ptr_conv;
10123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10125 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10126 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10131 LDKChannelPublicKeys this_ptr_conv;
10132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10134 LDKPublicKey val_ref;
10135 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10136 return ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10139 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_pubkey_arg, jbyteArray revocation_basepoint_arg, jbyteArray payment_point_arg, jbyteArray delayed_payment_basepoint_arg, jbyteArray htlc_basepoint_arg) {
10140 LDKPublicKey funding_pubkey_arg_ref;
10141 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10142 LDKPublicKey revocation_basepoint_arg_ref;
10143 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10144 LDKPublicKey payment_point_arg_ref;
10145 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10146 LDKPublicKey delayed_payment_basepoint_arg_ref;
10147 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10148 LDKPublicKey htlc_basepoint_arg_ref;
10149 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10150 LDKChannelPublicKeys ret = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
10151 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10155 LDKChannelPublicKeys obj_conv;
10156 obj_conv.inner = (void*)(obj & (~1));
10157 obj_conv.is_owned = (obj & 1) || (obj == 0);
10158 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10159 *ret = ChannelPublicKeys_write(&obj_conv);
10163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
10164 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10165 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_conv);
10166 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray broadcaster_delayed_payment_base, jbyteArray broadcaster_htlc_base, jbyteArray countersignatory_revocation_base, jbyteArray countersignatory_htlc_base) {
10170 LDKPublicKey per_commitment_point_ref;
10171 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10172 LDKPublicKey broadcaster_delayed_payment_base_ref;
10173 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10174 LDKPublicKey broadcaster_htlc_base_ref;
10175 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10176 LDKPublicKey countersignatory_revocation_base_ref;
10177 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10178 LDKPublicKey countersignatory_htlc_base_ref;
10179 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10180 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10181 *ret = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
10185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
10186 LDKPublicKey revocation_key_ref;
10187 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10188 LDKPublicKey broadcaster_delayed_payment_key_ref;
10189 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10190 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10191 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10196 LDKHTLCOutputInCommitment this_ptr_conv;
10197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10198 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10199 return HTLCOutputInCommitment_free(this_ptr_conv);
10202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10203 LDKHTLCOutputInCommitment orig_conv;
10204 orig_conv.inner = (void*)(orig & (~1));
10205 orig_conv.is_owned = (orig & 1) || (orig == 0);
10206 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10207 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10211 LDKHTLCOutputInCommitment this_ptr_conv;
10212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10214 return HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10218 LDKHTLCOutputInCommitment this_ptr_conv;
10219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10221 return HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10225 LDKHTLCOutputInCommitment this_ptr_conv;
10226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10228 return HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10232 LDKHTLCOutputInCommitment this_ptr_conv;
10233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10235 return HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10238 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10239 LDKHTLCOutputInCommitment this_ptr_conv;
10240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10242 return HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10246 LDKHTLCOutputInCommitment this_ptr_conv;
10247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10249 return HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10252 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10253 LDKHTLCOutputInCommitment this_ptr_conv;
10254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10256 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10257 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10262 LDKHTLCOutputInCommitment this_ptr_conv;
10263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10265 LDKThirtyTwoBytes val_ref;
10266 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10267 return HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10271 LDKHTLCOutputInCommitment obj_conv;
10272 obj_conv.inner = (void*)(obj & (~1));
10273 obj_conv.is_owned = (obj & 1) || (obj == 0);
10274 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10275 *ret = HTLCOutputInCommitment_write(&obj_conv);
10279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
10280 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10281 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_conv);
10282 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10286 LDKHTLCOutputInCommitment htlc_conv;
10287 htlc_conv.inner = (void*)(htlc & (~1));
10288 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10289 LDKTxCreationKeys keys_conv;
10290 keys_conv.inner = (void*)(keys & (~1));
10291 keys_conv.is_owned = (keys & 1) || (keys == 0);
10292 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10293 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10298 LDKPublicKey broadcaster_ref;
10299 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10300 LDKPublicKey countersignatory_ref;
10301 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10302 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10303 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) {
10308 unsigned char prev_hash_arr[32];
10309 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10310 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10311 LDKHTLCOutputInCommitment htlc_conv;
10312 htlc_conv.inner = (void*)(htlc & (~1));
10313 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10314 LDKPublicKey broadcaster_delayed_payment_key_ref;
10315 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10316 LDKPublicKey revocation_key_ref;
10317 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10318 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10319 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10324 LDKHolderCommitmentTransaction this_ptr_conv;
10325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10327 return HolderCommitmentTransaction_free(this_ptr_conv);
10330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10331 LDKHolderCommitmentTransaction orig_conv;
10332 orig_conv.inner = (void*)(orig & (~1));
10333 orig_conv.is_owned = (orig & 1) || (orig == 0);
10334 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10335 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10339 LDKHolderCommitmentTransaction this_ptr_conv;
10340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10342 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10343 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10348 LDKHolderCommitmentTransaction this_ptr_conv;
10349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10351 LDKTransaction val_conv = *(LDKTransaction*)val;
10353 return HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10357 LDKHolderCommitmentTransaction 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 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
10361 *ret = HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv);
10365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10366 LDKHolderCommitmentTransaction this_ptr_conv;
10367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10369 LDKSignature val_conv = *(LDKSignature*)val;
10371 return HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_conv);
10374 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10375 LDKHolderCommitmentTransaction this_ptr_conv;
10376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10378 return HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10382 LDKHolderCommitmentTransaction this_ptr_conv;
10383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10385 return HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10389 LDKHolderCommitmentTransaction this_ptr_conv;
10390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10392 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10394 return HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
10397 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jlong counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
10398 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
10399 FREE((void*)unsigned_tx);
10400 LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
10401 FREE((void*)counterparty_sig);
10402 LDKPublicKey holder_funding_key_ref;
10403 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
10404 LDKPublicKey counterparty_funding_key_ref;
10405 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
10406 LDKTxCreationKeys keys_conv;
10407 keys_conv.inner = (void*)(keys & (~1));
10408 keys_conv.is_owned = (keys & 1) || (keys == 0);
10409 if (keys_conv.inner != NULL)
10410 keys_conv = TxCreationKeys_clone(&keys_conv);
10411 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
10412 FREE((void*)htlc_data);
10413 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_conv, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_conv);
10414 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10418 LDKHolderCommitmentTransaction this_arg_conv;
10419 this_arg_conv.inner = (void*)(this_arg & (~1));
10420 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10421 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10422 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10426 LDKHolderCommitmentTransaction this_arg_conv;
10427 this_arg_conv.inner = (void*)(this_arg & (~1));
10428 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10429 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10430 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10434 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) {
10435 LDKHolderCommitmentTransaction this_arg_conv;
10436 this_arg_conv.inner = (void*)(this_arg & (~1));
10437 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10438 unsigned char funding_key_arr[32];
10439 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10440 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10441 LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
10442 LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
10443 *ret = HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
10447 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) {
10448 LDKHolderCommitmentTransaction this_arg_conv;
10449 this_arg_conv.inner = (void*)(this_arg & (~1));
10450 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10451 unsigned char htlc_base_key_arr[32];
10452 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10453 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10454 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10455 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10460 LDKHolderCommitmentTransaction obj_conv;
10461 obj_conv.inner = (void*)(obj & (~1));
10462 obj_conv.is_owned = (obj & 1) || (obj == 0);
10463 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10464 *ret = HolderCommitmentTransaction_write(&obj_conv);
10468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
10469 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10470 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_conv);
10471 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10475 LDKInitFeatures this_ptr_conv;
10476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10478 return InitFeatures_free(this_ptr_conv);
10481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10482 LDKNodeFeatures this_ptr_conv;
10483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10485 return NodeFeatures_free(this_ptr_conv);
10488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10489 LDKChannelFeatures this_ptr_conv;
10490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10492 return ChannelFeatures_free(this_ptr_conv);
10495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10496 LDKRouteHop this_ptr_conv;
10497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10499 return RouteHop_free(this_ptr_conv);
10502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10503 LDKRouteHop orig_conv;
10504 orig_conv.inner = (void*)(orig & (~1));
10505 orig_conv.is_owned = (orig & 1) || (orig == 0);
10506 LDKRouteHop ret = RouteHop_clone(&orig_conv);
10507 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10511 LDKRouteHop 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
10519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10520 LDKRouteHop 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_ref;
10524 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10525 return RouteHop_set_pubkey(&this_ptr_conv, val_ref);
10528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10529 LDKRouteHop 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 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
10533 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10537 LDKRouteHop this_ptr_conv;
10538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10540 LDKNodeFeatures val_conv;
10541 val_conv.inner = (void*)(val & (~1));
10542 val_conv.is_owned = (val & 1) || (val == 0);
10543 return RouteHop_set_node_features(&this_ptr_conv, val_conv);
10546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10547 LDKRouteHop this_ptr_conv;
10548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10550 return RouteHop_get_short_channel_id(&this_ptr_conv);
10553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10554 LDKRouteHop this_ptr_conv;
10555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10557 return RouteHop_set_short_channel_id(&this_ptr_conv, val);
10560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10561 LDKRouteHop this_ptr_conv;
10562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10564 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
10565 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10569 LDKRouteHop this_ptr_conv;
10570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10572 LDKChannelFeatures val_conv;
10573 val_conv.inner = (void*)(val & (~1));
10574 val_conv.is_owned = (val & 1) || (val == 0);
10575 return RouteHop_set_channel_features(&this_ptr_conv, val_conv);
10578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10579 LDKRouteHop this_ptr_conv;
10580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10582 return RouteHop_get_fee_msat(&this_ptr_conv);
10585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10586 LDKRouteHop this_ptr_conv;
10587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10589 return RouteHop_set_fee_msat(&this_ptr_conv, val);
10592 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10593 LDKRouteHop this_ptr_conv;
10594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10596 return RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
10599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10600 LDKRouteHop this_ptr_conv;
10601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10603 return RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
10606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv * _env, jclass _b, jbyteArray pubkey_arg, jlong node_features_arg, jlong short_channel_id_arg, jlong channel_features_arg, jlong fee_msat_arg, jint cltv_expiry_delta_arg) {
10607 LDKPublicKey pubkey_arg_ref;
10608 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
10609 LDKNodeFeatures node_features_arg_conv;
10610 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
10611 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
10612 LDKChannelFeatures channel_features_arg_conv;
10613 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
10614 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
10615 LDKRouteHop ret = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
10616 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10620 LDKRoute this_ptr_conv;
10621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10623 return Route_free(this_ptr_conv);
10626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10627 LDKRoute orig_conv;
10628 orig_conv.inner = (void*)(orig & (~1));
10629 orig_conv.is_owned = (orig & 1) || (orig == 0);
10630 LDKRoute ret = Route_clone(&orig_conv);
10631 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10635 LDKRoute this_ptr_conv;
10636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10638 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
10640 return Route_set_paths(&this_ptr_conv, val_conv);
10643 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
10644 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
10645 FREE((void*)paths_arg);
10646 LDKRoute ret = Route_new(paths_arg_conv);
10647 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
10652 obj_conv.inner = (void*)(obj & (~1));
10653 obj_conv.is_owned = (obj & 1) || (obj == 0);
10654 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10655 *ret = Route_write(&obj_conv);
10659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
10660 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10661 LDKRoute ret = Route_read(ser_conv);
10662 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10666 LDKRouteHint 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 RouteHint_free(this_ptr_conv);
10672 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10673 LDKRouteHint 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10677 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
10681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10682 LDKRouteHint this_ptr_conv;
10683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10685 LDKPublicKey val_ref;
10686 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10687 return RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
10690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10691 LDKRouteHint this_ptr_conv;
10692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10694 return RouteHint_get_short_channel_id(&this_ptr_conv);
10697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10698 LDKRouteHint 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 return RouteHint_set_short_channel_id(&this_ptr_conv, val);
10704 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
10705 LDKRouteHint this_ptr_conv;
10706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10708 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
10709 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10713 LDKRouteHint this_ptr_conv;
10714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10716 LDKRoutingFees val_conv;
10717 val_conv.inner = (void*)(val & (~1));
10718 val_conv.is_owned = (val & 1) || (val == 0);
10719 if (val_conv.inner != NULL)
10720 val_conv = RoutingFees_clone(&val_conv);
10721 return RouteHint_set_fees(&this_ptr_conv, val_conv);
10724 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10725 LDKRouteHint 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 return RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
10731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10732 LDKRouteHint this_ptr_conv;
10733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10735 return RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
10738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10739 LDKRouteHint this_ptr_conv;
10740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10742 return RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
10745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10746 LDKRouteHint this_ptr_conv;
10747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10749 return RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
10752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jbyteArray src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
10753 LDKPublicKey src_node_id_arg_ref;
10754 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
10755 LDKRoutingFees fees_arg_conv;
10756 fees_arg_conv.inner = (void*)(fees_arg & (~1));
10757 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
10758 if (fees_arg_conv.inner != NULL)
10759 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
10760 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
10761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jbyteArray our_node_id, jlong network, jbyteArray target, jlong first_hops, jlong last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
10765 LDKPublicKey our_node_id_ref;
10766 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
10767 LDKNetworkGraph network_conv;
10768 network_conv.inner = (void*)(network & (~1));
10769 network_conv.is_owned = (network & 1) || (network == 0);
10770 LDKPublicKey target_ref;
10771 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
10772 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
10773 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
10774 FREE((void*)last_hops);
10775 LDKLogger logger_conv = *(LDKLogger*)logger;
10776 if (logger_conv.free == LDKLogger_JCalls_free) {
10777 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10778 LDKLogger_JCalls_clone(logger_conv.this_arg);
10780 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10781 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
10785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10786 LDKNetworkGraph this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10789 return NetworkGraph_free(this_ptr_conv);
10792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10793 LDKLockedNetworkGraph this_ptr_conv;
10794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10796 return LockedNetworkGraph_free(this_ptr_conv);
10799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10800 LDKNetGraphMsgHandler this_ptr_conv;
10801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10803 return NetGraphMsgHandler_free(this_ptr_conv);
10806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
10807 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10808 LDKLogger logger_conv = *(LDKLogger*)logger;
10809 if (logger_conv.free == LDKLogger_JCalls_free) {
10810 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10811 LDKLogger_JCalls_clone(logger_conv.this_arg);
10813 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
10814 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
10818 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
10819 LDKLogger logger_conv = *(LDKLogger*)logger;
10820 if (logger_conv.free == LDKLogger_JCalls_free) {
10821 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10822 LDKLogger_JCalls_clone(logger_conv.this_arg);
10824 LDKNetworkGraph network_graph_conv;
10825 network_graph_conv.inner = (void*)(network_graph & (~1));
10826 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
10827 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
10828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10832 LDKNetGraphMsgHandler this_arg_conv;
10833 this_arg_conv.inner = (void*)(this_arg & (~1));
10834 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10835 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
10836 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
10840 LDKLockedNetworkGraph this_arg_conv;
10841 this_arg_conv.inner = (void*)(this_arg & (~1));
10842 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10843 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
10844 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
10848 LDKNetGraphMsgHandler this_arg_conv;
10849 this_arg_conv.inner = (void*)(this_arg & (~1));
10850 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10851 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10852 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
10856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10857 LDKDirectionalChannelInfo this_ptr_conv;
10858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10860 return DirectionalChannelInfo_free(this_ptr_conv);
10863 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
10864 LDKDirectionalChannelInfo this_ptr_conv;
10865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10867 return DirectionalChannelInfo_get_last_update(&this_ptr_conv);
10870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10871 LDKDirectionalChannelInfo this_ptr_conv;
10872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10874 return DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
10877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
10878 LDKDirectionalChannelInfo this_ptr_conv;
10879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10881 return DirectionalChannelInfo_get_enabled(&this_ptr_conv);
10884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10885 LDKDirectionalChannelInfo this_ptr_conv;
10886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10888 return DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
10891 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10892 LDKDirectionalChannelInfo this_ptr_conv;
10893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10895 return DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
10898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10899 LDKDirectionalChannelInfo this_ptr_conv;
10900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10902 return DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
10905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10906 LDKDirectionalChannelInfo this_ptr_conv;
10907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10909 return DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
10912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10913 LDKDirectionalChannelInfo this_ptr_conv;
10914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10916 return DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
10919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
10920 LDKDirectionalChannelInfo this_ptr_conv;
10921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10923 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
10924 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10928 LDKDirectionalChannelInfo this_ptr_conv;
10929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10931 LDKChannelUpdate val_conv;
10932 val_conv.inner = (void*)(val & (~1));
10933 val_conv.is_owned = (val & 1) || (val == 0);
10934 if (val_conv.inner != NULL)
10935 val_conv = ChannelUpdate_clone(&val_conv);
10936 return DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
10939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
10940 LDKDirectionalChannelInfo obj_conv;
10941 obj_conv.inner = (void*)(obj & (~1));
10942 obj_conv.is_owned = (obj & 1) || (obj == 0);
10943 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10944 *ret = DirectionalChannelInfo_write(&obj_conv);
10948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
10949 LDKu8slice ser_conv = *(LDKu8slice*)ser;
10950 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_conv);
10951 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10955 LDKChannelInfo this_ptr_conv;
10956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10958 return ChannelInfo_free(this_ptr_conv);
10961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10962 LDKChannelInfo this_ptr_conv;
10963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10965 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
10966 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10970 LDKChannelInfo this_ptr_conv;
10971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10973 LDKChannelFeatures val_conv;
10974 val_conv.inner = (void*)(val & (~1));
10975 val_conv.is_owned = (val & 1) || (val == 0);
10976 return ChannelInfo_set_features(&this_ptr_conv, val_conv);
10979 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
10980 LDKChannelInfo this_ptr_conv;
10981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10983 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10984 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
10988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10989 LDKChannelInfo this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10992 LDKPublicKey val_ref;
10993 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10994 return ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
10997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
10998 LDKChannelInfo this_ptr_conv;
10999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11001 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
11002 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11006 LDKChannelInfo this_ptr_conv;
11007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11009 LDKDirectionalChannelInfo val_conv;
11010 val_conv.inner = (void*)(val & (~1));
11011 val_conv.is_owned = (val & 1) || (val == 0);
11012 return ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11015 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11016 LDKChannelInfo this_ptr_conv;
11017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11019 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11020 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11025 LDKChannelInfo this_ptr_conv;
11026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11028 LDKPublicKey val_ref;
11029 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11030 return ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11034 LDKChannelInfo this_ptr_conv;
11035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11037 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11038 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11042 LDKChannelInfo this_ptr_conv;
11043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11045 LDKDirectionalChannelInfo val_conv;
11046 val_conv.inner = (void*)(val & (~1));
11047 val_conv.is_owned = (val & 1) || (val == 0);
11048 return ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11052 LDKChannelInfo this_ptr_conv;
11053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11055 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11056 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11060 LDKChannelInfo this_ptr_conv;
11061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11063 LDKChannelAnnouncement val_conv;
11064 val_conv.inner = (void*)(val & (~1));
11065 val_conv.is_owned = (val & 1) || (val == 0);
11066 if (val_conv.inner != NULL)
11067 val_conv = ChannelAnnouncement_clone(&val_conv);
11068 return ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11072 LDKChannelInfo obj_conv;
11073 obj_conv.inner = (void*)(obj & (~1));
11074 obj_conv.is_owned = (obj & 1) || (obj == 0);
11075 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11076 *ret = ChannelInfo_write(&obj_conv);
11080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11081 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11082 LDKChannelInfo ret = ChannelInfo_read(ser_conv);
11083 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11087 LDKRoutingFees this_ptr_conv;
11088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11090 return RoutingFees_free(this_ptr_conv);
11093 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11094 LDKRoutingFees orig_conv;
11095 orig_conv.inner = (void*)(orig & (~1));
11096 orig_conv.is_owned = (orig & 1) || (orig == 0);
11097 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11098 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11101 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11102 LDKRoutingFees this_ptr_conv;
11103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11105 return RoutingFees_get_base_msat(&this_ptr_conv);
11108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11109 LDKRoutingFees this_ptr_conv;
11110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11112 return RoutingFees_set_base_msat(&this_ptr_conv, val);
11115 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11116 LDKRoutingFees this_ptr_conv;
11117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11119 return RoutingFees_get_proportional_millionths(&this_ptr_conv);
11122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11123 LDKRoutingFees this_ptr_conv;
11124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11126 return RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11130 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11131 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
11135 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11136 LDKRoutingFees ret = RoutingFees_read(ser_conv);
11137 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11141 LDKRoutingFees obj_conv;
11142 obj_conv.inner = (void*)(obj & (~1));
11143 obj_conv.is_owned = (obj & 1) || (obj == 0);
11144 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11145 *ret = RoutingFees_write(&obj_conv);
11149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11150 LDKNodeAnnouncementInfo this_ptr_conv;
11151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11153 return NodeAnnouncementInfo_free(this_ptr_conv);
11156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11157 LDKNodeAnnouncementInfo this_ptr_conv;
11158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11160 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11161 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11165 LDKNodeAnnouncementInfo this_ptr_conv;
11166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11168 LDKNodeFeatures val_conv;
11169 val_conv.inner = (void*)(val & (~1));
11170 val_conv.is_owned = (val & 1) || (val == 0);
11171 return NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11174 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11175 LDKNodeAnnouncementInfo this_ptr_conv;
11176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11178 return NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11182 LDKNodeAnnouncementInfo this_ptr_conv;
11183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11185 return NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11188 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11189 LDKNodeAnnouncementInfo this_ptr_conv;
11190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11192 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11193 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11198 LDKNodeAnnouncementInfo this_ptr_conv;
11199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11201 LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
11203 return NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_conv);
11206 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11207 LDKNodeAnnouncementInfo this_ptr_conv;
11208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11210 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11211 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11216 LDKNodeAnnouncementInfo this_ptr_conv;
11217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11219 LDKThirtyTwoBytes val_ref;
11220 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11221 return NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11225 LDKNodeAnnouncementInfo this_ptr_conv;
11226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11228 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11230 return NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11234 LDKNodeAnnouncementInfo this_ptr_conv;
11235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11237 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11238 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11242 LDKNodeAnnouncementInfo this_ptr_conv;
11243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11245 LDKNodeAnnouncement val_conv;
11246 val_conv.inner = (void*)(val & (~1));
11247 val_conv.is_owned = (val & 1) || (val == 0);
11248 if (val_conv.inner != NULL)
11249 val_conv = NodeAnnouncement_clone(&val_conv);
11250 return NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11253 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) {
11254 LDKNodeFeatures features_arg_conv;
11255 features_arg_conv.inner = (void*)(features_arg & (~1));
11256 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11257 LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
11258 FREE((void*)rgb_arg);
11259 LDKThirtyTwoBytes alias_arg_ref;
11260 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11261 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11262 FREE((void*)addresses_arg);
11263 LDKNodeAnnouncement announcement_message_arg_conv;
11264 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11265 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11266 if (announcement_message_arg_conv.inner != NULL)
11267 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11268 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11269 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11273 LDKNodeAnnouncementInfo obj_conv;
11274 obj_conv.inner = (void*)(obj & (~1));
11275 obj_conv.is_owned = (obj & 1) || (obj == 0);
11276 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11277 *ret = NodeAnnouncementInfo_write(&obj_conv);
11281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11282 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11283 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_conv);
11284 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11288 LDKNodeInfo this_ptr_conv;
11289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11291 return NodeInfo_free(this_ptr_conv);
11294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11295 LDKNodeInfo this_ptr_conv;
11296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11298 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11300 return NodeInfo_set_channels(&this_ptr_conv, val_conv);
11303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11304 LDKNodeInfo this_ptr_conv;
11305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11307 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11308 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11312 LDKNodeInfo this_ptr_conv;
11313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11315 LDKRoutingFees val_conv;
11316 val_conv.inner = (void*)(val & (~1));
11317 val_conv.is_owned = (val & 1) || (val == 0);
11318 if (val_conv.inner != NULL)
11319 val_conv = RoutingFees_clone(&val_conv);
11320 return NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
11323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
11324 LDKNodeInfo this_ptr_conv;
11325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11327 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
11328 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11332 LDKNodeInfo this_ptr_conv;
11333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11335 LDKNodeAnnouncementInfo val_conv;
11336 val_conv.inner = (void*)(val & (~1));
11337 val_conv.is_owned = (val & 1) || (val == 0);
11338 return NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
11341 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) {
11342 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
11343 FREE((void*)channels_arg);
11344 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
11345 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
11346 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
11347 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
11348 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
11349 LDKNodeAnnouncementInfo announcement_info_arg_conv;
11350 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
11351 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
11352 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
11353 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11357 LDKNodeInfo obj_conv;
11358 obj_conv.inner = (void*)(obj & (~1));
11359 obj_conv.is_owned = (obj & 1) || (obj == 0);
11360 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11361 *ret = NodeInfo_write(&obj_conv);
11365 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
11366 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11367 LDKNodeInfo ret = NodeInfo_read(ser_conv);
11368 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
11372 LDKNetworkGraph obj_conv;
11373 obj_conv.inner = (void*)(obj & (~1));
11374 obj_conv.is_owned = (obj & 1) || (obj == 0);
11375 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11376 *ret = NetworkGraph_write(&obj_conv);
11380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
11381 LDKu8slice ser_conv = *(LDKu8slice*)ser;
11382 LDKNetworkGraph ret = NetworkGraph_read(ser_conv);
11383 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
11387 LDKNetworkGraph ret = NetworkGraph_new();
11388 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11391 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) {
11392 LDKNetworkGraph this_arg_conv;
11393 this_arg_conv.inner = (void*)(this_arg & (~1));
11394 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11395 return NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);