1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 // Always run a, then assert it is true:
8 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Assert a is true or do nothing
10 #define CHECK(a) DO_ASSERT(a)
12 // Running a leak check across all the allocations and frees of the JDK is a mess,
13 // so instead we implement our own naive leak checker here, relying on the -wrap
14 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
15 // and free'd in Rust or C across the generated bindings shared library.
19 static mtx_t allocation_mtx;
21 void __attribute__((constructor)) init_mtx() {
22 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
26 typedef struct allocation {
27 struct allocation* next;
29 const char* struct_name;
33 static allocation* allocation_ll = NULL;
35 void* __real_malloc(size_t len);
36 void* __real_calloc(size_t nmemb, size_t len);
37 static void new_allocation(void* res, const char* struct_name) {
38 allocation* new_alloc = __real_malloc(sizeof(allocation));
40 new_alloc->struct_name = struct_name;
41 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
42 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
43 new_alloc->next = allocation_ll;
44 allocation_ll = new_alloc;
45 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
47 static void* MALLOC(size_t len, const char* struct_name) {
48 void* res = __real_malloc(len);
49 new_allocation(res, struct_name);
52 void __real_free(void* ptr);
53 static void alloc_freed(void* ptr) {
55 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
56 allocation* it = allocation_ll;
57 while (it->ptr != ptr) { p = it; it = it->next; }
58 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
59 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
60 DO_ASSERT(it->ptr == ptr);
63 static void FREE(void* ptr) {
68 void* __wrap_malloc(size_t len) {
69 void* res = __real_malloc(len);
70 new_allocation(res, "malloc call");
73 void* __wrap_calloc(size_t nmemb, size_t len) {
74 void* res = __real_calloc(nmemb, len);
75 new_allocation(res, "calloc call");
78 void __wrap_free(void* ptr) {
83 void* __real_realloc(void* ptr, size_t newlen);
84 void* __wrap_realloc(void* ptr, size_t len) {
86 void* res = __real_realloc(ptr, len);
87 new_allocation(res, "realloc call");
90 void __wrap_reallocarray(void* ptr, size_t new_sz) {
91 // Rust doesn't seem to use reallocarray currently
95 void __attribute__((destructor)) check_leaks() {
96 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
97 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
98 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
99 fprintf(stderr, "\n\n");
101 DO_ASSERT(allocation_ll == NULL);
104 static jmethodID ordinal_meth = NULL;
105 static jmethodID slicedef_meth = NULL;
106 static jclass slicedef_cls = NULL;
107 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
108 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
109 CHECK(ordinal_meth != NULL);
110 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
111 CHECK(slicedef_meth != NULL);
112 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
113 CHECK(slicedef_cls != NULL);
116 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
117 return *((bool*)ptr);
119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
120 return *((long*)ptr);
122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
126 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
127 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
131 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
132 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
133 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
136 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
137 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
138 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
139 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
140 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
143 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
144 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
145 txdata->datalen = (*env)->GetArrayLength(env, bytes);
146 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
147 txdata->data_is_owned = true;
148 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
152 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
153 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
154 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
155 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
156 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
157 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
158 return (long)vec->datalen;
160 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
161 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
162 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
163 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
164 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
165 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
166 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
172 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
173 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
174 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
175 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
177 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
178 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
179 case 0: return LDKAccessError_UnknownChain;
180 case 1: return LDKAccessError_UnknownTx;
184 static jclass LDKAccessError_class = NULL;
185 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
187 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
188 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
189 CHECK(LDKAccessError_class != NULL);
190 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
191 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
192 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
193 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
195 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
197 case LDKAccessError_UnknownChain:
198 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
199 case LDKAccessError_UnknownTx:
200 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
205 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
206 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
207 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
208 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
212 static jclass LDKChannelMonitorUpdateErr_class = NULL;
213 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
215 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
216 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
217 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
218 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
219 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
220 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
221 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
223 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
225 case LDKChannelMonitorUpdateErr_TemporaryFailure:
226 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
227 case LDKChannelMonitorUpdateErr_PermanentFailure:
228 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
233 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
234 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
235 case 0: return LDKConfirmationTarget_Background;
236 case 1: return LDKConfirmationTarget_Normal;
237 case 2: return LDKConfirmationTarget_HighPriority;
241 static jclass LDKConfirmationTarget_class = NULL;
242 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
245 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
246 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
247 CHECK(LDKConfirmationTarget_class != NULL);
248 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
249 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
250 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
251 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
252 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
253 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
255 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
257 case LDKConfirmationTarget_Background:
258 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
259 case LDKConfirmationTarget_Normal:
260 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
261 case LDKConfirmationTarget_HighPriority:
262 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
267 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
268 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
269 case 0: return LDKLevel_Off;
270 case 1: return LDKLevel_Error;
271 case 2: return LDKLevel_Warn;
272 case 3: return LDKLevel_Info;
273 case 4: return LDKLevel_Debug;
274 case 5: return LDKLevel_Trace;
278 static jclass LDKLevel_class = NULL;
279 static jfieldID LDKLevel_LDKLevel_Off = NULL;
280 static jfieldID LDKLevel_LDKLevel_Error = NULL;
281 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
282 static jfieldID LDKLevel_LDKLevel_Info = NULL;
283 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
284 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
285 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
286 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
287 CHECK(LDKLevel_class != NULL);
288 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
289 CHECK(LDKLevel_LDKLevel_Off != NULL);
290 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
291 CHECK(LDKLevel_LDKLevel_Error != NULL);
292 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
293 CHECK(LDKLevel_LDKLevel_Warn != NULL);
294 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
295 CHECK(LDKLevel_LDKLevel_Info != NULL);
296 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
297 CHECK(LDKLevel_LDKLevel_Debug != NULL);
298 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
299 CHECK(LDKLevel_LDKLevel_Trace != NULL);
301 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
304 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
306 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
308 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
310 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
312 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
314 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
319 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
320 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
321 case 0: return LDKNetwork_Bitcoin;
322 case 1: return LDKNetwork_Testnet;
323 case 2: return LDKNetwork_Regtest;
327 static jclass LDKNetwork_class = NULL;
328 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
331 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
332 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
333 CHECK(LDKNetwork_class != NULL);
334 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
335 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
336 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
337 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
338 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
339 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
341 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
343 case LDKNetwork_Bitcoin:
344 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
345 case LDKNetwork_Testnet:
346 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
347 case LDKNetwork_Regtest:
348 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
353 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
354 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
355 case 0: return LDKSecp256k1Error_IncorrectSignature;
356 case 1: return LDKSecp256k1Error_InvalidMessage;
357 case 2: return LDKSecp256k1Error_InvalidPublicKey;
358 case 3: return LDKSecp256k1Error_InvalidSignature;
359 case 4: return LDKSecp256k1Error_InvalidSecretKey;
360 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
361 case 6: return LDKSecp256k1Error_InvalidTweak;
362 case 7: return LDKSecp256k1Error_NotEnoughMemory;
363 case 8: return LDKSecp256k1Error_CallbackPanicked;
367 static jclass LDKSecp256k1Error_class = NULL;
368 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
377 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
378 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
379 CHECK(LDKSecp256k1Error_class != NULL);
380 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
381 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
382 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
383 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
384 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
385 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
386 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
387 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
388 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
389 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
390 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
391 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
392 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
393 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
394 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
395 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
396 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
397 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
399 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
401 case LDKSecp256k1Error_IncorrectSignature:
402 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
403 case LDKSecp256k1Error_InvalidMessage:
404 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
405 case LDKSecp256k1Error_InvalidPublicKey:
406 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
407 case LDKSecp256k1Error_InvalidSignature:
408 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
409 case LDKSecp256k1Error_InvalidSecretKey:
410 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
411 case LDKSecp256k1Error_InvalidRecoveryId:
412 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
413 case LDKSecp256k1Error_InvalidTweak:
414 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
415 case LDKSecp256k1Error_NotEnoughMemory:
416 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
417 case LDKSecp256k1Error_CallbackPanicked:
418 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
423 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
424 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
425 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
428 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
429 ret->datalen = (*env)->GetArrayLength(env, elems);
430 if (ret->datalen == 0) {
433 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
434 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
435 for (size_t i = 0; i < ret->datalen; i++) {
436 ret->data[i] = java_elems[i];
438 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
443 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
445 LDKTransaction b_conv = *(LDKTransaction*)b;
450 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
451 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
453 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
454 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
455 CHECK(val->result_ok);
456 return *val->contents.result;
458 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
459 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
460 CHECK(!val->result_ok);
461 jclass ret = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
465 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
467 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
468 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
469 CHECK(val->result_ok);
470 return *val->contents.result;
472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
473 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
474 CHECK(!val->result_ok);
475 LDKMonitorUpdateError ret = (*val->contents.err);
476 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
479 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
481 a_conv.inner = (void*)(a & (~1));
482 a_conv.is_owned = (a & 1) || (a == 0);
483 if (a_conv.inner != NULL)
484 a_conv = OutPoint_clone(&a_conv);
486 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
491 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
492 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
493 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
496 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
497 ret->datalen = (*env)->GetArrayLength(env, elems);
498 if (ret->datalen == 0) {
501 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
502 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
503 for (size_t i = 0; i < ret->datalen; i++) {
504 jlong arr_elem = java_elems[i];
505 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
506 FREE((void*)arr_elem);
507 ret->data[i] = arr_elem_conv;
509 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
514 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
515 LDKThirtyTwoBytes a_ref;
516 CHECK((*_env)->GetArrayLength (_env, a) == 32);
517 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
519 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
525 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
530 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
531 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
532 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
535 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
537 CHECK((*_env)->GetArrayLength (_env, a) == 64);
538 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
540 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
546 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
549 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
550 CHECK(val->result_ok);
551 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
552 *ret = (*val->contents.result);
555 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
556 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
557 CHECK(!val->result_ok);
558 return *val->contents.err;
560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
561 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
563 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
564 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
565 CHECK(val->result_ok);
566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, (*val->contents.result).compact_form);
570 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
571 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
572 CHECK(!val->result_ok);
573 return *val->contents.err;
575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
576 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
579 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
580 CHECK(val->result_ok);
581 LDKCVecTempl_Signature* ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
582 *ret = (*val->contents.result);
585 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
586 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
587 CHECK(!val->result_ok);
588 return *val->contents.err;
590 static jclass LDKAPIError_APIMisuseError_class = NULL;
591 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
592 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
593 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
594 static jclass LDKAPIError_RouteError_class = NULL;
595 static jmethodID LDKAPIError_RouteError_meth = NULL;
596 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
597 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
598 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
599 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
601 LDKAPIError_APIMisuseError_class =
602 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
603 CHECK(LDKAPIError_APIMisuseError_class != NULL);
604 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
605 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
606 LDKAPIError_FeeRateTooHigh_class =
607 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
608 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
609 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
610 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
611 LDKAPIError_RouteError_class =
612 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
613 CHECK(LDKAPIError_RouteError_class != NULL);
614 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
615 CHECK(LDKAPIError_RouteError_meth != NULL);
616 LDKAPIError_ChannelUnavailable_class =
617 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
618 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
619 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
620 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
621 LDKAPIError_MonitorUpdateFailed_class =
622 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
623 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
624 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
625 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
627 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
628 LDKAPIError *obj = (LDKAPIError*)ptr;
630 case LDKAPIError_APIMisuseError: {
631 long err_ref = (long)&obj->api_misuse_error.err;
632 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
634 case LDKAPIError_FeeRateTooHigh: {
635 long err_ref = (long)&obj->fee_rate_too_high.err;
636 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
638 case LDKAPIError_RouteError: {
639 long err_ref = (long)&obj->route_error.err;
640 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
642 case LDKAPIError_ChannelUnavailable: {
643 long err_ref = (long)&obj->channel_unavailable.err;
644 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
646 case LDKAPIError_MonitorUpdateFailed: {
647 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
652 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
653 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
655 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
656 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
657 CHECK(val->result_ok);
658 return *val->contents.result;
660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
661 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
662 CHECK(!val->result_ok);
663 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
664 *ret = (*val->contents.err);
667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
668 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
670 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
671 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
672 CHECK(val->result_ok);
673 return *val->contents.result;
675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
676 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
677 CHECK(!val->result_ok);
678 LDKPaymentSendFailure ret = (*val->contents.err);
679 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
681 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) {
682 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
683 LDKChannelAnnouncement a_conv;
684 a_conv.inner = (void*)(a & (~1));
685 a_conv.is_owned = (a & 1) || (a == 0);
686 if (a_conv.inner != NULL)
687 a_conv = ChannelAnnouncement_clone(&a_conv);
689 LDKChannelUpdate b_conv;
690 b_conv.inner = (void*)(b & (~1));
691 b_conv.is_owned = (b & 1) || (b == 0);
692 if (b_conv.inner != NULL)
693 b_conv = ChannelUpdate_clone(&b_conv);
695 LDKChannelUpdate c_conv;
696 c_conv.inner = (void*)(c & (~1));
697 c_conv.is_owned = (c & 1) || (c == 0);
698 if (c_conv.inner != NULL)
699 c_conv = ChannelUpdate_clone(&c_conv);
703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
704 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
706 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
707 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
708 CHECK(val->result_ok);
709 return *val->contents.result;
711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
712 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
713 CHECK(!val->result_ok);
714 LDKPeerHandleError ret = (*val->contents.err);
715 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
718 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
719 LDKHTLCOutputInCommitment a_conv;
720 a_conv.inner = (void*)(a & (~1));
721 a_conv.is_owned = (a & 1) || (a == 0);
722 if (a_conv.inner != NULL)
723 a_conv = HTLCOutputInCommitment_clone(&a_conv);
726 CHECK((*_env)->GetArrayLength (_env, b) == 64);
727 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
731 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
732 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
733 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
734 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
735 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
736 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
738 LDKSpendableOutputDescriptor_StaticOutput_class =
739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
740 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
741 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
742 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
743 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
745 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
746 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
747 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
748 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
750 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
751 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
752 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
754 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
755 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
757 case LDKSpendableOutputDescriptor_StaticOutput: {
758 LDKOutPoint outpoint_var = obj->static_output.outpoint;
759 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
760 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
762 if (outpoint_var.is_owned) {
763 outpoint_ref = (long)outpoint_var.inner | 1;
765 outpoint_ref = (long)&outpoint_var;
767 long output_ref = (long)&obj->static_output.output;
768 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
770 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
771 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
772 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
773 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
775 if (outpoint_var.is_owned) {
776 outpoint_ref = (long)outpoint_var.inner | 1;
778 outpoint_ref = (long)&outpoint_var;
780 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
781 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
782 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
783 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
784 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
785 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
786 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);
788 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
789 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
790 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
791 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
793 if (outpoint_var.is_owned) {
794 outpoint_ref = (long)outpoint_var.inner | 1;
796 outpoint_ref = (long)&outpoint_var;
798 long output_ref = (long)&obj->static_output_counterparty_payment.output;
799 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
800 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
805 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
806 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
807 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
810 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
811 ret->datalen = (*env)->GetArrayLength(env, elems);
812 if (ret->datalen == 0) {
815 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
816 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
817 for (size_t i = 0; i < ret->datalen; i++) {
818 jlong arr_elem = java_elems[i];
819 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
820 FREE((void*)arr_elem);
821 ret->data[i] = arr_elem_conv;
823 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
827 static jclass LDKEvent_FundingGenerationReady_class = NULL;
828 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
829 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
830 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
831 static jclass LDKEvent_PaymentReceived_class = NULL;
832 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
833 static jclass LDKEvent_PaymentSent_class = NULL;
834 static jmethodID LDKEvent_PaymentSent_meth = NULL;
835 static jclass LDKEvent_PaymentFailed_class = NULL;
836 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
837 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
838 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
839 static jclass LDKEvent_SpendableOutputs_class = NULL;
840 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
842 LDKEvent_FundingGenerationReady_class =
843 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
844 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
845 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
846 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
847 LDKEvent_FundingBroadcastSafe_class =
848 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
849 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
850 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
851 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
852 LDKEvent_PaymentReceived_class =
853 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
854 CHECK(LDKEvent_PaymentReceived_class != NULL);
855 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
856 CHECK(LDKEvent_PaymentReceived_meth != NULL);
857 LDKEvent_PaymentSent_class =
858 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
859 CHECK(LDKEvent_PaymentSent_class != NULL);
860 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
861 CHECK(LDKEvent_PaymentSent_meth != NULL);
862 LDKEvent_PaymentFailed_class =
863 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
864 CHECK(LDKEvent_PaymentFailed_class != NULL);
865 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
866 CHECK(LDKEvent_PaymentFailed_meth != NULL);
867 LDKEvent_PendingHTLCsForwardable_class =
868 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
869 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
870 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
871 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
872 LDKEvent_SpendableOutputs_class =
873 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
874 CHECK(LDKEvent_SpendableOutputs_class != NULL);
875 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
876 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
878 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
879 LDKEvent *obj = (LDKEvent*)ptr;
881 case LDKEvent_FundingGenerationReady: {
882 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
883 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
884 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
885 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);
887 case LDKEvent_FundingBroadcastSafe: {
888 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
889 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
890 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
891 long funding_txo_ref;
892 if (funding_txo_var.is_owned) {
893 funding_txo_ref = (long)funding_txo_var.inner | 1;
895 funding_txo_ref = (long)&funding_txo_var;
897 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
899 case LDKEvent_PaymentReceived: {
900 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
901 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
902 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
903 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
904 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
906 case LDKEvent_PaymentSent: {
907 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
908 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
909 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
911 case LDKEvent_PaymentFailed: {
912 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
913 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
914 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
916 case LDKEvent_PendingHTLCsForwardable: {
917 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
919 case LDKEvent_SpendableOutputs: {
920 long outputs_ref = (long)&obj->spendable_outputs.outputs;
921 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
926 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
927 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
928 static jclass LDKErrorAction_IgnoreError_class = NULL;
929 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
930 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
931 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
933 LDKErrorAction_DisconnectPeer_class =
934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
935 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
936 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
937 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
938 LDKErrorAction_IgnoreError_class =
939 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
940 CHECK(LDKErrorAction_IgnoreError_class != NULL);
941 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
942 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
943 LDKErrorAction_SendErrorMessage_class =
944 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
945 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
946 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
947 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
949 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
950 LDKErrorAction *obj = (LDKErrorAction*)ptr;
952 case LDKErrorAction_DisconnectPeer: {
953 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
954 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
955 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
957 if (msg_var.is_owned) {
958 msg_ref = (long)msg_var.inner | 1;
960 msg_ref = (long)&msg_var;
962 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
964 case LDKErrorAction_IgnoreError: {
965 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
967 case LDKErrorAction_SendErrorMessage: {
968 LDKErrorMessage msg_var = obj->send_error_message.msg;
969 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
970 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 if (msg_var.is_owned) {
973 msg_ref = (long)msg_var.inner | 1;
975 msg_ref = (long)&msg_var;
977 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
982 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
983 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
984 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
985 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
986 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
987 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
989 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
990 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
991 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
992 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
993 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
994 LDKHTLCFailChannelUpdate_ChannelClosed_class =
995 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
996 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
997 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
998 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
999 LDKHTLCFailChannelUpdate_NodeFailure_class =
1000 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1001 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1002 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1003 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1005 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1006 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1008 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1009 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1010 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1011 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1013 if (msg_var.is_owned) {
1014 msg_ref = (long)msg_var.inner | 1;
1016 msg_ref = (long)&msg_var;
1018 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1020 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1021 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1023 case LDKHTLCFailChannelUpdate_NodeFailure: {
1024 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1025 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1026 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1031 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1032 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1033 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1034 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1035 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1036 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1037 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1038 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1039 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1040 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1041 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1042 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1043 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1044 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1045 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1046 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1047 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1048 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1049 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1050 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1051 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1052 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1053 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1054 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1055 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1056 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1057 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1058 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1059 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1060 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1061 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1062 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1064 LDKMessageSendEvent_SendAcceptChannel_class =
1065 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1066 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1067 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1068 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1069 LDKMessageSendEvent_SendOpenChannel_class =
1070 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1071 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1072 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1073 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1074 LDKMessageSendEvent_SendFundingCreated_class =
1075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1076 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1077 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1078 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1079 LDKMessageSendEvent_SendFundingSigned_class =
1080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1081 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1082 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1083 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1084 LDKMessageSendEvent_SendFundingLocked_class =
1085 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1086 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1087 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1088 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1089 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1090 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1091 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1092 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1093 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1094 LDKMessageSendEvent_UpdateHTLCs_class =
1095 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1096 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1097 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1098 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1099 LDKMessageSendEvent_SendRevokeAndACK_class =
1100 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1101 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1102 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1103 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1104 LDKMessageSendEvent_SendClosingSigned_class =
1105 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1106 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1107 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1108 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1109 LDKMessageSendEvent_SendShutdown_class =
1110 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1111 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1112 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1113 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1114 LDKMessageSendEvent_SendChannelReestablish_class =
1115 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1116 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1117 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1118 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1119 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1120 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1121 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1122 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1123 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1124 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1125 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1126 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1127 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1128 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1129 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1130 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1131 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1132 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1133 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1134 LDKMessageSendEvent_HandleError_class =
1135 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1136 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1137 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1138 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1139 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1141 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1142 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1143 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1145 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1146 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1148 case LDKMessageSendEvent_SendAcceptChannel: {
1149 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1150 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1151 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1152 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1153 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1155 if (msg_var.is_owned) {
1156 msg_ref = (long)msg_var.inner | 1;
1158 msg_ref = (long)&msg_var;
1160 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1162 case LDKMessageSendEvent_SendOpenChannel: {
1163 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1164 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1165 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1166 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1167 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1169 if (msg_var.is_owned) {
1170 msg_ref = (long)msg_var.inner | 1;
1172 msg_ref = (long)&msg_var;
1174 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1176 case LDKMessageSendEvent_SendFundingCreated: {
1177 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1178 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1179 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1180 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1183 if (msg_var.is_owned) {
1184 msg_ref = (long)msg_var.inner | 1;
1186 msg_ref = (long)&msg_var;
1188 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1190 case LDKMessageSendEvent_SendFundingSigned: {
1191 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1192 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1193 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1194 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1195 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1197 if (msg_var.is_owned) {
1198 msg_ref = (long)msg_var.inner | 1;
1200 msg_ref = (long)&msg_var;
1202 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1204 case LDKMessageSendEvent_SendFundingLocked: {
1205 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1206 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1207 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1208 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1211 if (msg_var.is_owned) {
1212 msg_ref = (long)msg_var.inner | 1;
1214 msg_ref = (long)&msg_var;
1216 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1218 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1219 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1220 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1221 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1222 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 if (msg_var.is_owned) {
1226 msg_ref = (long)msg_var.inner | 1;
1228 msg_ref = (long)&msg_var;
1230 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1232 case LDKMessageSendEvent_UpdateHTLCs: {
1233 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1234 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1235 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1236 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1237 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1239 if (updates_var.is_owned) {
1240 updates_ref = (long)updates_var.inner | 1;
1242 updates_ref = (long)&updates_var;
1244 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1246 case LDKMessageSendEvent_SendRevokeAndACK: {
1247 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1248 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1249 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1250 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1251 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1253 if (msg_var.is_owned) {
1254 msg_ref = (long)msg_var.inner | 1;
1256 msg_ref = (long)&msg_var;
1258 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1260 case LDKMessageSendEvent_SendClosingSigned: {
1261 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1262 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1263 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1264 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1265 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1267 if (msg_var.is_owned) {
1268 msg_ref = (long)msg_var.inner | 1;
1270 msg_ref = (long)&msg_var;
1272 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1274 case LDKMessageSendEvent_SendShutdown: {
1275 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1276 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1277 LDKShutdown msg_var = obj->send_shutdown.msg;
1278 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1279 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1281 if (msg_var.is_owned) {
1282 msg_ref = (long)msg_var.inner | 1;
1284 msg_ref = (long)&msg_var;
1286 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1288 case LDKMessageSendEvent_SendChannelReestablish: {
1289 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1290 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1291 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1292 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1293 CHECK((((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 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1302 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1303 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1304 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1305 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1307 if (msg_var.is_owned) {
1308 msg_ref = (long)msg_var.inner | 1;
1310 msg_ref = (long)&msg_var;
1312 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1313 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1314 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1315 long update_msg_ref;
1316 if (update_msg_var.is_owned) {
1317 update_msg_ref = (long)update_msg_var.inner | 1;
1319 update_msg_ref = (long)&update_msg_var;
1321 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1323 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1324 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1325 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 CHECK((((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_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1335 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1336 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1337 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1338 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1340 if (msg_var.is_owned) {
1341 msg_ref = (long)msg_var.inner | 1;
1343 msg_ref = (long)&msg_var;
1345 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1347 case LDKMessageSendEvent_HandleError: {
1348 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1349 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1350 long action_ref = (long)&obj->handle_error.action;
1351 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1353 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1354 long update_ref = (long)&obj->payment_failure_network_update.update;
1355 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1360 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1361 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1362 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1365 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1366 ret->datalen = (*env)->GetArrayLength(env, elems);
1367 if (ret->datalen == 0) {
1370 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1371 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1372 for (size_t i = 0; i < ret->datalen; i++) {
1373 jlong arr_elem = java_elems[i];
1374 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1375 FREE((void*)arr_elem);
1376 ret->data[i] = arr_elem_conv;
1378 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1382 typedef struct LDKMessageSendEventsProvider_JCalls {
1383 atomic_size_t refcnt;
1386 jmethodID get_and_clear_pending_msg_events_meth;
1387 } LDKMessageSendEventsProvider_JCalls;
1388 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1389 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1391 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1394 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1395 LDKCVec_MessageSendEventZ res = *ret;
1399 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1400 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1401 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1403 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1404 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1408 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1409 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1410 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1411 return (void*) this_arg;
1413 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1414 jclass c = (*env)->GetObjectClass(env, o);
1416 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1417 atomic_init(&calls->refcnt, 1);
1418 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1419 calls->o = (*env)->NewWeakGlobalRef(env, o);
1420 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1421 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1423 LDKMessageSendEventsProvider ret = {
1424 .this_arg = (void*) calls,
1425 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1426 .free = LDKMessageSendEventsProvider_JCalls_free,
1430 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1431 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1432 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1433 return (long)res_ptr;
1435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1436 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1441 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1442 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1443 *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1447 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1448 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1449 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1452 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1453 ret->datalen = (*env)->GetArrayLength(env, elems);
1454 if (ret->datalen == 0) {
1457 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1458 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1459 for (size_t i = 0; i < ret->datalen; i++) {
1460 jlong arr_elem = java_elems[i];
1461 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1462 FREE((void*)arr_elem);
1463 ret->data[i] = arr_elem_conv;
1465 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1469 typedef struct LDKEventsProvider_JCalls {
1470 atomic_size_t refcnt;
1473 jmethodID get_and_clear_pending_events_meth;
1474 } LDKEventsProvider_JCalls;
1475 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1476 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1478 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1479 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1481 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1482 LDKCVec_EventZ res = *ret;
1486 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1487 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1488 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1491 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1495 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1496 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1497 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1498 return (void*) this_arg;
1500 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1501 jclass c = (*env)->GetObjectClass(env, o);
1503 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1504 atomic_init(&calls->refcnt, 1);
1505 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1506 calls->o = (*env)->NewWeakGlobalRef(env, o);
1507 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1508 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1510 LDKEventsProvider ret = {
1511 .this_arg = (void*) calls,
1512 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1513 .free = LDKEventsProvider_JCalls_free,
1517 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1518 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1519 *res_ptr = LDKEventsProvider_init(env, _a, o);
1520 return (long)res_ptr;
1522 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1523 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1528 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1529 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1530 *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1534 typedef struct LDKLogger_JCalls {
1535 atomic_size_t refcnt;
1540 void log_jcall(const void* this_arg, const char *record) {
1541 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1543 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1544 jstring record_conv = (*env)->NewStringUTF(env, record);
1545 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1547 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1549 static void LDKLogger_JCalls_free(void* this_arg) {
1550 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1551 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1553 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1554 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1558 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1559 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1560 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1561 return (void*) this_arg;
1563 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1564 jclass c = (*env)->GetObjectClass(env, o);
1566 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1567 atomic_init(&calls->refcnt, 1);
1568 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1569 calls->o = (*env)->NewWeakGlobalRef(env, o);
1570 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1571 CHECK(calls->log_meth != NULL);
1574 .this_arg = (void*) calls,
1576 .free = LDKLogger_JCalls_free,
1580 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1581 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1582 *res_ptr = LDKLogger_init(env, _a, o);
1583 return (long)res_ptr;
1585 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1586 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1591 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1594 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1595 CHECK(val->result_ok);
1596 LDKTxOut* ret = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1597 *ret = (*val->contents.result);
1600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1601 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1602 CHECK(!val->result_ok);
1603 jclass ret = LDKAccessError_to_java(_env, (*val->contents.err));
1606 typedef struct LDKAccess_JCalls {
1607 atomic_size_t refcnt;
1610 jmethodID get_utxo_meth;
1612 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1613 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1615 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1616 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1617 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1618 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1620 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1621 LDKCResult_TxOutAccessErrorZ res = *ret;
1625 static void LDKAccess_JCalls_free(void* this_arg) {
1626 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1627 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1629 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1630 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1634 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1635 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1636 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1637 return (void*) this_arg;
1639 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1640 jclass c = (*env)->GetObjectClass(env, o);
1642 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1643 atomic_init(&calls->refcnt, 1);
1644 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1645 calls->o = (*env)->NewWeakGlobalRef(env, o);
1646 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1647 CHECK(calls->get_utxo_meth != NULL);
1650 .this_arg = (void*) calls,
1651 .get_utxo = get_utxo_jcall,
1652 .free = LDKAccess_JCalls_free,
1656 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1657 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1658 *res_ptr = LDKAccess_init(env, _a, o);
1659 return (long)res_ptr;
1661 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1662 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
1667 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1668 unsigned char genesis_hash_arr[32];
1669 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1670 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1671 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1672 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1673 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1677 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1678 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1679 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1680 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1681 for (size_t i = 0; i < vec->datalen; i++) {
1682 CHECK((((long)vec->data[i].inner) & 1) == 0);
1683 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1685 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1689 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1690 ret->datalen = (*env)->GetArrayLength(env, elems);
1691 if (ret->datalen == 0) {
1694 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1695 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1696 for (size_t i = 0; i < ret->datalen; i++) {
1697 jlong arr_elem = java_elems[i];
1698 LDKHTLCOutputInCommitment arr_elem_conv;
1699 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1700 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1701 if (arr_elem_conv.inner != NULL)
1702 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1703 ret->data[i] = arr_elem_conv;
1705 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1709 typedef struct LDKChannelKeys_JCalls {
1710 atomic_size_t refcnt;
1713 jmethodID get_per_commitment_point_meth;
1714 jmethodID release_commitment_secret_meth;
1715 jmethodID key_derivation_params_meth;
1716 jmethodID sign_counterparty_commitment_meth;
1717 jmethodID sign_holder_commitment_meth;
1718 jmethodID sign_holder_commitment_htlc_transactions_meth;
1719 jmethodID sign_justice_transaction_meth;
1720 jmethodID sign_counterparty_htlc_transaction_meth;
1721 jmethodID sign_closing_transaction_meth;
1722 jmethodID sign_channel_announcement_meth;
1723 jmethodID on_accept_meth;
1724 } LDKChannelKeys_JCalls;
1725 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1726 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1728 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1729 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1731 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1733 CHECK((*env)->GetArrayLength(env, jret) == 33);
1734 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1737 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1738 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1743 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1744 LDKThirtyTwoBytes ret;
1745 CHECK((*env)->GetArrayLength(env, jret) == 32);
1746 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1749 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1750 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1753 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1755 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1756 LDKC2Tuple_u64u64Z res = *ret;
1760 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) {
1761 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1763 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1764 long commitment_tx_ref = (long)&commitment_tx;
1765 long htlcs_ref = (long)&htlcs;
1766 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1768 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);
1769 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1773 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1774 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1779 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1780 LDKCResult_SignatureNoneZ res = *ret;
1784 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1785 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1787 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1788 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1790 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1791 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1795 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) {
1796 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1798 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1799 long justice_tx_ref = (long)&justice_tx;
1800 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1801 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1804 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);
1805 LDKCResult_SignatureNoneZ res = *ret;
1809 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) {
1810 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1812 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1813 long htlc_tx_ref = (long)&htlc_tx;
1814 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1815 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1816 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1818 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);
1819 LDKCResult_SignatureNoneZ res = *ret;
1823 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1824 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1826 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1827 long closing_tx_ref = (long)&closing_tx;
1828 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1830 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1831 LDKCResult_SignatureNoneZ res = *ret;
1835 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1836 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1838 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1839 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1841 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1842 LDKCResult_SignatureNoneZ res = *ret;
1846 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1847 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1849 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1850 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1852 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1854 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1855 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1856 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1858 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1859 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1863 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1864 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1865 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1866 return (void*) this_arg;
1868 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1869 jclass c = (*env)->GetObjectClass(env, o);
1871 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1872 atomic_init(&calls->refcnt, 1);
1873 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1874 calls->o = (*env)->NewWeakGlobalRef(env, o);
1875 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1876 CHECK(calls->get_per_commitment_point_meth != NULL);
1877 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1878 CHECK(calls->release_commitment_secret_meth != NULL);
1879 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1880 CHECK(calls->key_derivation_params_meth != NULL);
1881 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1882 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1883 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1884 CHECK(calls->sign_holder_commitment_meth != NULL);
1885 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1886 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1887 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1888 CHECK(calls->sign_justice_transaction_meth != NULL);
1889 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1890 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1891 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1892 CHECK(calls->sign_closing_transaction_meth != NULL);
1893 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1894 CHECK(calls->sign_channel_announcement_meth != NULL);
1895 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1896 CHECK(calls->on_accept_meth != NULL);
1898 LDKChannelKeys ret = {
1899 .this_arg = (void*) calls,
1900 .get_per_commitment_point = get_per_commitment_point_jcall,
1901 .release_commitment_secret = release_commitment_secret_jcall,
1902 .key_derivation_params = key_derivation_params_jcall,
1903 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1904 .sign_holder_commitment = sign_holder_commitment_jcall,
1905 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1906 .sign_justice_transaction = sign_justice_transaction_jcall,
1907 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1908 .sign_closing_transaction = sign_closing_transaction_jcall,
1909 .sign_channel_announcement = sign_channel_announcement_jcall,
1910 .on_accept = on_accept_jcall,
1911 .clone = LDKChannelKeys_JCalls_clone,
1912 .free = LDKChannelKeys_JCalls_free,
1916 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1917 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1918 *res_ptr = LDKChannelKeys_init(env, _a, o);
1919 return (long)res_ptr;
1921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1922 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1927 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1928 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1929 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1934 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1935 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1936 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1941 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1942 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1943 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1948 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1949 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1950 FREE((void*)commitment_tx);
1951 LDKPreCalculatedTxCreationKeys keys_conv;
1952 keys_conv.inner = (void*)(keys & (~1));
1953 keys_conv.is_owned = (keys & 1) || (keys == 0);
1954 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1956 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1957 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1962 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1963 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1964 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1965 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1966 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1967 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1972 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1973 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1974 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1975 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1976 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1977 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1982 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1983 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1984 FREE((void*)justice_tx);
1985 unsigned char per_commitment_key_arr[32];
1986 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
1987 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1988 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1989 LDKHTLCOutputInCommitment htlc_conv;
1990 htlc_conv.inner = (void*)(htlc & (~1));
1991 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1992 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1993 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1998 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1999 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2000 FREE((void*)htlc_tx);
2001 LDKPublicKey per_commitment_point_ref;
2002 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2003 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2004 LDKHTLCOutputInCommitment htlc_conv;
2005 htlc_conv.inner = (void*)(htlc & (~1));
2006 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2007 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2008 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2013 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2014 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2015 FREE((void*)closing_tx);
2016 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2017 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2021 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2022 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2023 LDKUnsignedChannelAnnouncement msg_conv;
2024 msg_conv.inner = (void*)(msg & (~1));
2025 msg_conv.is_owned = (msg & 1) || (msg == 0);
2026 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2027 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1on_1accept(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
2032 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2033 LDKChannelPublicKeys channel_points_conv;
2034 channel_points_conv.inner = (void*)(channel_points & (~1));
2035 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2036 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2039 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2040 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2041 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2042 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2043 for (size_t i = 0; i < vec->datalen; i++) {
2044 CHECK((((long)vec->data[i].inner) & 1) == 0);
2045 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2047 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2051 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2052 ret->datalen = (*env)->GetArrayLength(env, elems);
2053 if (ret->datalen == 0) {
2056 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2057 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2058 for (size_t i = 0; i < ret->datalen; i++) {
2059 jlong arr_elem = java_elems[i];
2060 LDKMonitorEvent arr_elem_conv;
2061 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2062 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2063 // Warning: we may need a move here but can't clone!
2064 ret->data[i] = arr_elem_conv;
2066 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2070 typedef struct LDKWatch_JCalls {
2071 atomic_size_t refcnt;
2074 jmethodID watch_channel_meth;
2075 jmethodID update_channel_meth;
2076 jmethodID release_pending_monitor_events_meth;
2078 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2079 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2081 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2082 LDKOutPoint funding_txo_var = funding_txo;
2083 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2084 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2085 long funding_txo_ref;
2086 if (funding_txo_var.is_owned) {
2087 funding_txo_ref = (long)funding_txo_var.inner | 1;
2089 funding_txo_ref = (long)&funding_txo_var;
2091 LDKChannelMonitor monitor_var = monitor;
2092 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2093 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2095 if (monitor_var.is_owned) {
2096 monitor_ref = (long)monitor_var.inner | 1;
2098 monitor_ref = (long)&monitor_var;
2100 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2102 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2103 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2107 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2108 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2110 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2111 LDKOutPoint funding_txo_var = funding_txo;
2112 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2113 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2114 long funding_txo_ref;
2115 if (funding_txo_var.is_owned) {
2116 funding_txo_ref = (long)funding_txo_var.inner | 1;
2118 funding_txo_ref = (long)&funding_txo_var;
2120 LDKChannelMonitorUpdate update_var = update;
2121 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2122 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2124 if (update_var.is_owned) {
2125 update_ref = (long)update_var.inner | 1;
2127 update_ref = (long)&update_var;
2129 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2131 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2132 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2136 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2137 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2139 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2140 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2142 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2143 LDKCVec_MonitorEventZ res = *ret;
2147 static void LDKWatch_JCalls_free(void* this_arg) {
2148 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2149 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2151 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2152 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2156 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2157 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2158 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2159 return (void*) this_arg;
2161 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2162 jclass c = (*env)->GetObjectClass(env, o);
2164 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2165 atomic_init(&calls->refcnt, 1);
2166 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2167 calls->o = (*env)->NewWeakGlobalRef(env, o);
2168 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2169 CHECK(calls->watch_channel_meth != NULL);
2170 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2171 CHECK(calls->update_channel_meth != NULL);
2172 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2173 CHECK(calls->release_pending_monitor_events_meth != NULL);
2176 .this_arg = (void*) calls,
2177 .watch_channel = watch_channel_jcall,
2178 .update_channel = update_channel_jcall,
2179 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2180 .free = LDKWatch_JCalls_free,
2184 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2185 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2186 *res_ptr = LDKWatch_init(env, _a, o);
2187 return (long)res_ptr;
2189 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2190 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2195 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2196 LDKOutPoint funding_txo_conv;
2197 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2198 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2199 if (funding_txo_conv.inner != NULL)
2200 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2201 LDKChannelMonitor monitor_conv;
2202 monitor_conv.inner = (void*)(monitor & (~1));
2203 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2204 // Warning: we may need a move here but can't clone!
2205 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2206 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2211 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2212 LDKOutPoint funding_txo_conv;
2213 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2214 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2215 if (funding_txo_conv.inner != NULL)
2216 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2217 LDKChannelMonitorUpdate update_conv;
2218 update_conv.inner = (void*)(update & (~1));
2219 update_conv.is_owned = (update & 1) || (update == 0);
2220 if (update_conv.inner != NULL)
2221 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2222 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2223 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2228 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2229 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2230 *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2234 typedef struct LDKFilter_JCalls {
2235 atomic_size_t refcnt;
2238 jmethodID register_tx_meth;
2239 jmethodID register_output_meth;
2241 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2242 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2244 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2245 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2246 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2247 LDKu8slice script_pubkey_var = script_pubkey;
2248 jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
2249 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2250 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2252 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2254 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2255 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2257 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2258 LDKu8slice script_pubkey_var = script_pubkey;
2259 jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
2260 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2261 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2263 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2265 static void LDKFilter_JCalls_free(void* this_arg) {
2266 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2267 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2269 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2270 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2274 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2275 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2276 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2277 return (void*) this_arg;
2279 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2280 jclass c = (*env)->GetObjectClass(env, o);
2282 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2283 atomic_init(&calls->refcnt, 1);
2284 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2285 calls->o = (*env)->NewWeakGlobalRef(env, o);
2286 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2287 CHECK(calls->register_tx_meth != NULL);
2288 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2289 CHECK(calls->register_output_meth != NULL);
2292 .this_arg = (void*) calls,
2293 .register_tx = register_tx_jcall,
2294 .register_output = register_output_jcall,
2295 .free = LDKFilter_JCalls_free,
2299 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2300 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2301 *res_ptr = LDKFilter_init(env, _a, o);
2302 return (long)res_ptr;
2304 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2305 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2310 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2311 unsigned char txid_arr[32];
2312 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2313 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2314 unsigned char (*txid_ref)[32] = &txid_arr;
2315 LDKu8slice script_pubkey_ref;
2316 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2317 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2318 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2319 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2323 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2324 LDKOutPoint outpoint_conv;
2325 outpoint_conv.inner = (void*)(outpoint & (~1));
2326 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2327 LDKu8slice script_pubkey_ref;
2328 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2329 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2330 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2331 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2334 typedef struct LDKBroadcasterInterface_JCalls {
2335 atomic_size_t refcnt;
2338 jmethodID broadcast_transaction_meth;
2339 } LDKBroadcasterInterface_JCalls;
2340 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2341 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2343 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2344 long tx_ref = (long)&tx;
2345 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2347 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2349 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2350 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2351 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2353 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2354 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2358 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2359 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2360 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2361 return (void*) this_arg;
2363 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2364 jclass c = (*env)->GetObjectClass(env, o);
2366 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2367 atomic_init(&calls->refcnt, 1);
2368 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2369 calls->o = (*env)->NewWeakGlobalRef(env, o);
2370 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2371 CHECK(calls->broadcast_transaction_meth != NULL);
2373 LDKBroadcasterInterface ret = {
2374 .this_arg = (void*) calls,
2375 .broadcast_transaction = broadcast_transaction_jcall,
2376 .free = LDKBroadcasterInterface_JCalls_free,
2380 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2381 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2382 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2383 return (long)res_ptr;
2385 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2386 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2391 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2392 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2394 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2397 typedef struct LDKFeeEstimator_JCalls {
2398 atomic_size_t refcnt;
2401 jmethodID get_est_sat_per_1000_weight_meth;
2402 } LDKFeeEstimator_JCalls;
2403 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2404 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2406 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2407 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2408 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2410 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2412 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2413 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2414 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2416 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2417 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2421 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2422 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2423 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2424 return (void*) this_arg;
2426 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2427 jclass c = (*env)->GetObjectClass(env, o);
2429 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2430 atomic_init(&calls->refcnt, 1);
2431 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2432 calls->o = (*env)->NewWeakGlobalRef(env, o);
2433 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2434 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2436 LDKFeeEstimator ret = {
2437 .this_arg = (void*) calls,
2438 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2439 .free = LDKFeeEstimator_JCalls_free,
2443 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2444 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2445 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2446 return (long)res_ptr;
2448 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2449 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2453 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong this_arg, jclass confirmation_target) {
2454 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2455 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2456 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2461 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2462 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2465 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2466 ret->datalen = (*env)->GetArrayLength(env, elems);
2467 if (ret->datalen == 0) {
2470 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2471 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2472 for (size_t i = 0; i < ret->datalen; i++) {
2473 jlong arr_elem = java_elems[i];
2474 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2475 FREE((void*)arr_elem);
2476 ret->data[i] = arr_elem_conv;
2478 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2482 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2483 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2484 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2487 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2488 ret->datalen = (*env)->GetArrayLength(env, elems);
2489 if (ret->datalen == 0) {
2492 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2493 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2494 for (size_t i = 0; i < ret->datalen; i++) {
2495 jlong arr_elem = java_elems[i];
2496 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2497 FREE((void*)arr_elem);
2498 ret->data[i] = arr_elem_conv;
2500 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2504 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2505 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2506 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2509 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2510 ret->datalen = (*env)->GetArrayLength(env, elems);
2511 if (ret->datalen == 0) {
2514 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2515 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2516 for (size_t i = 0; i < ret->datalen; i++) {
2517 jlong arr_elem = java_elems[i];
2518 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2519 FREE((void*)arr_elem);
2520 ret->data[i] = arr_elem_conv;
2522 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2526 typedef struct LDKKeysInterface_JCalls {
2527 atomic_size_t refcnt;
2530 jmethodID get_node_secret_meth;
2531 jmethodID get_destination_script_meth;
2532 jmethodID get_shutdown_pubkey_meth;
2533 jmethodID get_channel_keys_meth;
2534 jmethodID get_secure_random_bytes_meth;
2535 } LDKKeysInterface_JCalls;
2536 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2537 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2539 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2540 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2542 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2544 CHECK((*env)->GetArrayLength(env, jret) == 32);
2545 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes);
2548 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2549 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2552 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2554 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2555 LDKCVec_u8Z res = *ret;
2559 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2560 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2562 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2565 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2567 CHECK((*env)->GetArrayLength(env, jret) == 33);
2568 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2571 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2572 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2574 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2575 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2577 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2578 LDKChannelKeys res = *ret;
2582 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2583 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2585 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2586 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2588 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2589 LDKThirtyTwoBytes ret;
2590 CHECK((*env)->GetArrayLength(env, jret) == 32);
2591 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2594 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2595 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2596 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2598 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2599 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2603 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2604 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2605 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2606 return (void*) this_arg;
2608 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2609 jclass c = (*env)->GetObjectClass(env, o);
2611 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2612 atomic_init(&calls->refcnt, 1);
2613 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2614 calls->o = (*env)->NewWeakGlobalRef(env, o);
2615 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2616 CHECK(calls->get_node_secret_meth != NULL);
2617 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2618 CHECK(calls->get_destination_script_meth != NULL);
2619 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2620 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2621 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2622 CHECK(calls->get_channel_keys_meth != NULL);
2623 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2624 CHECK(calls->get_secure_random_bytes_meth != NULL);
2626 LDKKeysInterface ret = {
2627 .this_arg = (void*) calls,
2628 .get_node_secret = get_node_secret_jcall,
2629 .get_destination_script = get_destination_script_jcall,
2630 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2631 .get_channel_keys = get_channel_keys_jcall,
2632 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2633 .free = LDKKeysInterface_JCalls_free,
2637 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2638 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2639 *res_ptr = LDKKeysInterface_init(env, _a, o);
2640 return (long)res_ptr;
2642 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2643 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2647 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2648 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2649 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2650 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2655 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2656 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2657 *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2662 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2663 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2664 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jboolean inbound, jlong channel_value_satoshis) {
2669 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2670 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2671 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2675 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2676 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2677 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2678 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2682 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2683 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2684 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2685 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2686 for (size_t i = 0; i < vec->datalen; i++) {
2687 CHECK((((long)vec->data[i].inner) & 1) == 0);
2688 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2690 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2694 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2695 ret->datalen = (*env)->GetArrayLength(env, elems);
2696 if (ret->datalen == 0) {
2699 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2700 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2701 for (size_t i = 0; i < ret->datalen; i++) {
2702 jlong arr_elem = java_elems[i];
2703 LDKChannelDetails arr_elem_conv;
2704 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2705 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2706 if (arr_elem_conv.inner != NULL)
2707 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2708 ret->data[i] = arr_elem_conv;
2710 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2714 static jclass LDKNetAddress_IPv4_class = NULL;
2715 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2716 static jclass LDKNetAddress_IPv6_class = NULL;
2717 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2718 static jclass LDKNetAddress_OnionV2_class = NULL;
2719 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2720 static jclass LDKNetAddress_OnionV3_class = NULL;
2721 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2723 LDKNetAddress_IPv4_class =
2724 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2725 CHECK(LDKNetAddress_IPv4_class != NULL);
2726 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2727 CHECK(LDKNetAddress_IPv4_meth != NULL);
2728 LDKNetAddress_IPv6_class =
2729 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2730 CHECK(LDKNetAddress_IPv6_class != NULL);
2731 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2732 CHECK(LDKNetAddress_IPv6_meth != NULL);
2733 LDKNetAddress_OnionV2_class =
2734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2735 CHECK(LDKNetAddress_OnionV2_class != NULL);
2736 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2737 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2738 LDKNetAddress_OnionV3_class =
2739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2740 CHECK(LDKNetAddress_OnionV3_class != NULL);
2741 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2742 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2744 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2745 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2747 case LDKNetAddress_IPv4: {
2748 long addr_ref = (long)&obj->i_pv4.addr;
2749 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2751 case LDKNetAddress_IPv6: {
2752 long addr_ref = (long)&obj->i_pv6.addr;
2753 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2755 case LDKNetAddress_OnionV2: {
2756 long addr_ref = (long)&obj->onion_v2.addr;
2757 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2759 case LDKNetAddress_OnionV3: {
2760 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2761 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2762 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);
2767 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2768 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2769 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2772 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2773 ret->datalen = (*env)->GetArrayLength(env, elems);
2774 if (ret->datalen == 0) {
2777 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2778 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2779 for (size_t i = 0; i < ret->datalen; i++) {
2780 jlong arr_elem = java_elems[i];
2781 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2782 FREE((void*)arr_elem);
2783 ret->data[i] = arr_elem_conv;
2785 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2789 typedef struct LDKChannelMessageHandler_JCalls {
2790 atomic_size_t refcnt;
2793 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2794 jmethodID handle_open_channel_meth;
2795 jmethodID handle_accept_channel_meth;
2796 jmethodID handle_funding_created_meth;
2797 jmethodID handle_funding_signed_meth;
2798 jmethodID handle_funding_locked_meth;
2799 jmethodID handle_shutdown_meth;
2800 jmethodID handle_closing_signed_meth;
2801 jmethodID handle_update_add_htlc_meth;
2802 jmethodID handle_update_fulfill_htlc_meth;
2803 jmethodID handle_update_fail_htlc_meth;
2804 jmethodID handle_update_fail_malformed_htlc_meth;
2805 jmethodID handle_commitment_signed_meth;
2806 jmethodID handle_revoke_and_ack_meth;
2807 jmethodID handle_update_fee_meth;
2808 jmethodID handle_announcement_signatures_meth;
2809 jmethodID peer_disconnected_meth;
2810 jmethodID peer_connected_meth;
2811 jmethodID handle_channel_reestablish_meth;
2812 jmethodID handle_error_meth;
2813 } LDKChannelMessageHandler_JCalls;
2814 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2815 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2817 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2818 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2819 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2820 LDKInitFeatures their_features_var = their_features;
2821 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2822 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2823 long their_features_ref;
2824 if (their_features_var.is_owned) {
2825 their_features_ref = (long)their_features_var.inner | 1;
2827 their_features_ref = (long)&their_features_var;
2829 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2831 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2833 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2834 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2837 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2838 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2839 LDKInitFeatures their_features_var = their_features;
2840 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2841 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2842 long their_features_ref;
2843 if (their_features_var.is_owned) {
2844 their_features_ref = (long)their_features_var.inner | 1;
2846 their_features_ref = (long)&their_features_var;
2848 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2850 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2852 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2853 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2855 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2856 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2857 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2858 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2860 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2862 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2863 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2865 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2866 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2867 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2868 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2870 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2872 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2873 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2875 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2876 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2877 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2878 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2880 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2882 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2883 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2885 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2886 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2887 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2888 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2890 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2892 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2893 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2895 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2896 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2897 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2898 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2900 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2902 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2903 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2905 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2906 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2907 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2908 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2910 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2912 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2913 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2915 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2916 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2917 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2918 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2920 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2922 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2923 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2925 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2926 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2927 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2928 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2930 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2932 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2933 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2935 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2936 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2937 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2938 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2940 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2942 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2943 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2945 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2946 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2947 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2948 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2950 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2952 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2953 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2955 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2956 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2957 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2958 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2960 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2962 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2963 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2965 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2966 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2967 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2968 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2970 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2972 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2973 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2975 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2976 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2977 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2978 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2980 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2982 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2983 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2985 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2986 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2987 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2988 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2990 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2992 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2993 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2995 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2996 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2997 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2998 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3000 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3002 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3003 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3005 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3006 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
3007 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3008 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3010 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3012 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3013 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3015 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3016 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
3017 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3018 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3020 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3022 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3023 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3024 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3026 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3027 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3031 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3032 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3033 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3034 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3035 return (void*) this_arg;
3037 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3038 jclass c = (*env)->GetObjectClass(env, o);
3040 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3041 atomic_init(&calls->refcnt, 1);
3042 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3043 calls->o = (*env)->NewWeakGlobalRef(env, o);
3044 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3045 CHECK(calls->handle_open_channel_meth != NULL);
3046 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3047 CHECK(calls->handle_accept_channel_meth != NULL);
3048 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3049 CHECK(calls->handle_funding_created_meth != NULL);
3050 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3051 CHECK(calls->handle_funding_signed_meth != NULL);
3052 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3053 CHECK(calls->handle_funding_locked_meth != NULL);
3054 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3055 CHECK(calls->handle_shutdown_meth != NULL);
3056 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3057 CHECK(calls->handle_closing_signed_meth != NULL);
3058 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3059 CHECK(calls->handle_update_add_htlc_meth != NULL);
3060 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3061 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3062 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3063 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3064 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3065 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3066 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3067 CHECK(calls->handle_commitment_signed_meth != NULL);
3068 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3069 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3070 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3071 CHECK(calls->handle_update_fee_meth != NULL);
3072 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3073 CHECK(calls->handle_announcement_signatures_meth != NULL);
3074 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3075 CHECK(calls->peer_disconnected_meth != NULL);
3076 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3077 CHECK(calls->peer_connected_meth != NULL);
3078 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3079 CHECK(calls->handle_channel_reestablish_meth != NULL);
3080 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3081 CHECK(calls->handle_error_meth != NULL);
3083 LDKChannelMessageHandler ret = {
3084 .this_arg = (void*) calls,
3085 .handle_open_channel = handle_open_channel_jcall,
3086 .handle_accept_channel = handle_accept_channel_jcall,
3087 .handle_funding_created = handle_funding_created_jcall,
3088 .handle_funding_signed = handle_funding_signed_jcall,
3089 .handle_funding_locked = handle_funding_locked_jcall,
3090 .handle_shutdown = handle_shutdown_jcall,
3091 .handle_closing_signed = handle_closing_signed_jcall,
3092 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3093 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3094 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3095 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3096 .handle_commitment_signed = handle_commitment_signed_jcall,
3097 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3098 .handle_update_fee = handle_update_fee_jcall,
3099 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3100 .peer_disconnected = peer_disconnected_jcall,
3101 .peer_connected = peer_connected_jcall,
3102 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3103 .handle_error = handle_error_jcall,
3104 .free = LDKChannelMessageHandler_JCalls_free,
3105 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3107 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3110 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3111 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3112 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3113 return (long)res_ptr;
3115 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3116 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3121 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3122 LDKPublicKey their_node_id_ref;
3123 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3124 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3125 LDKInitFeatures their_features_conv;
3126 their_features_conv.inner = (void*)(their_features & (~1));
3127 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3128 // Warning: we may need a move here but can't clone!
3129 LDKOpenChannel msg_conv;
3130 msg_conv.inner = (void*)(msg & (~1));
3131 msg_conv.is_owned = (msg & 1) || (msg == 0);
3132 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
3136 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3137 LDKPublicKey their_node_id_ref;
3138 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3139 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3140 LDKInitFeatures their_features_conv;
3141 their_features_conv.inner = (void*)(their_features & (~1));
3142 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3143 // Warning: we may need a move here but can't clone!
3144 LDKAcceptChannel msg_conv;
3145 msg_conv.inner = (void*)(msg & (~1));
3146 msg_conv.is_owned = (msg & 1) || (msg == 0);
3147 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3151 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3152 LDKPublicKey their_node_id_ref;
3153 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3154 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3155 LDKFundingCreated msg_conv;
3156 msg_conv.inner = (void*)(msg & (~1));
3157 msg_conv.is_owned = (msg & 1) || (msg == 0);
3158 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3162 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3163 LDKPublicKey their_node_id_ref;
3164 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3165 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3166 LDKFundingSigned msg_conv;
3167 msg_conv.inner = (void*)(msg & (~1));
3168 msg_conv.is_owned = (msg & 1) || (msg == 0);
3169 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3173 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3174 LDKPublicKey their_node_id_ref;
3175 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3176 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3177 LDKFundingLocked msg_conv;
3178 msg_conv.inner = (void*)(msg & (~1));
3179 msg_conv.is_owned = (msg & 1) || (msg == 0);
3180 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3184 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3185 LDKPublicKey their_node_id_ref;
3186 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3187 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3188 LDKShutdown msg_conv;
3189 msg_conv.inner = (void*)(msg & (~1));
3190 msg_conv.is_owned = (msg & 1) || (msg == 0);
3191 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3195 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3196 LDKPublicKey their_node_id_ref;
3197 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3198 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3199 LDKClosingSigned msg_conv;
3200 msg_conv.inner = (void*)(msg & (~1));
3201 msg_conv.is_owned = (msg & 1) || (msg == 0);
3202 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3206 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3207 LDKPublicKey their_node_id_ref;
3208 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3209 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3210 LDKUpdateAddHTLC msg_conv;
3211 msg_conv.inner = (void*)(msg & (~1));
3212 msg_conv.is_owned = (msg & 1) || (msg == 0);
3213 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3217 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3218 LDKPublicKey their_node_id_ref;
3219 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3220 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3221 LDKUpdateFulfillHTLC msg_conv;
3222 msg_conv.inner = (void*)(msg & (~1));
3223 msg_conv.is_owned = (msg & 1) || (msg == 0);
3224 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3228 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3229 LDKPublicKey their_node_id_ref;
3230 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3231 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3232 LDKUpdateFailHTLC msg_conv;
3233 msg_conv.inner = (void*)(msg & (~1));
3234 msg_conv.is_owned = (msg & 1) || (msg == 0);
3235 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3239 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3240 LDKPublicKey their_node_id_ref;
3241 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3242 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3243 LDKUpdateFailMalformedHTLC msg_conv;
3244 msg_conv.inner = (void*)(msg & (~1));
3245 msg_conv.is_owned = (msg & 1) || (msg == 0);
3246 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3250 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3251 LDKPublicKey their_node_id_ref;
3252 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3253 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3254 LDKCommitmentSigned msg_conv;
3255 msg_conv.inner = (void*)(msg & (~1));
3256 msg_conv.is_owned = (msg & 1) || (msg == 0);
3257 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3261 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3262 LDKPublicKey their_node_id_ref;
3263 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3264 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3265 LDKRevokeAndACK msg_conv;
3266 msg_conv.inner = (void*)(msg & (~1));
3267 msg_conv.is_owned = (msg & 1) || (msg == 0);
3268 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3272 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3273 LDKPublicKey their_node_id_ref;
3274 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3275 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3276 LDKUpdateFee msg_conv;
3277 msg_conv.inner = (void*)(msg & (~1));
3278 msg_conv.is_owned = (msg & 1) || (msg == 0);
3279 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3283 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3284 LDKPublicKey their_node_id_ref;
3285 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3286 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3287 LDKAnnouncementSignatures msg_conv;
3288 msg_conv.inner = (void*)(msg & (~1));
3289 msg_conv.is_owned = (msg & 1) || (msg == 0);
3290 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jboolean no_connection_possible) {
3294 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3295 LDKPublicKey their_node_id_ref;
3296 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3297 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3298 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3302 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3303 LDKPublicKey their_node_id_ref;
3304 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3305 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3307 msg_conv.inner = (void*)(msg & (~1));
3308 msg_conv.is_owned = (msg & 1) || (msg == 0);
3309 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3313 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3314 LDKPublicKey their_node_id_ref;
3315 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3316 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3317 LDKChannelReestablish msg_conv;
3318 msg_conv.inner = (void*)(msg & (~1));
3319 msg_conv.is_owned = (msg & 1) || (msg == 0);
3320 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3324 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3325 LDKPublicKey their_node_id_ref;
3326 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3327 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3328 LDKErrorMessage msg_conv;
3329 msg_conv.inner = (void*)(msg & (~1));
3330 msg_conv.is_owned = (msg & 1) || (msg == 0);
3331 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3334 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3335 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3336 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3337 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3338 for (size_t i = 0; i < vec->datalen; i++) {
3339 CHECK((((long)vec->data[i].inner) & 1) == 0);
3340 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3342 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3346 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3347 ret->datalen = (*env)->GetArrayLength(env, elems);
3348 if (ret->datalen == 0) {
3351 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3352 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3353 for (size_t i = 0; i < ret->datalen; i++) {
3354 jlong arr_elem = java_elems[i];
3355 LDKChannelMonitor arr_elem_conv;
3356 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3357 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3358 // Warning: we may need a move here but can't clone!
3359 ret->data[i] = arr_elem_conv;
3361 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3365 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3366 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3367 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3370 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3371 ret->datalen = (*env)->GetArrayLength(env, elems);
3372 if (ret->datalen == 0) {
3375 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3376 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3377 for (size_t i = 0; i < ret->datalen; i++) {
3378 ret->data[i] = java_elems[i];
3380 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3384 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3385 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3386 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3387 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3388 for (size_t i = 0; i < vec->datalen; i++) {
3389 CHECK((((long)vec->data[i].inner) & 1) == 0);
3390 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3392 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3396 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3397 ret->datalen = (*env)->GetArrayLength(env, elems);
3398 if (ret->datalen == 0) {
3401 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3402 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3403 for (size_t i = 0; i < ret->datalen; i++) {
3404 jlong arr_elem = java_elems[i];
3405 LDKUpdateAddHTLC arr_elem_conv;
3406 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3407 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3408 if (arr_elem_conv.inner != NULL)
3409 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3410 ret->data[i] = arr_elem_conv;
3412 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3416 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3417 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3418 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3419 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3420 for (size_t i = 0; i < vec->datalen; i++) {
3421 CHECK((((long)vec->data[i].inner) & 1) == 0);
3422 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3424 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3428 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3429 ret->datalen = (*env)->GetArrayLength(env, elems);
3430 if (ret->datalen == 0) {
3433 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3434 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3435 for (size_t i = 0; i < ret->datalen; i++) {
3436 jlong arr_elem = java_elems[i];
3437 LDKUpdateFulfillHTLC arr_elem_conv;
3438 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3439 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3440 if (arr_elem_conv.inner != NULL)
3441 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3442 ret->data[i] = arr_elem_conv;
3444 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3448 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3449 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3450 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3451 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3452 for (size_t i = 0; i < vec->datalen; i++) {
3453 CHECK((((long)vec->data[i].inner) & 1) == 0);
3454 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3456 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3460 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3461 ret->datalen = (*env)->GetArrayLength(env, elems);
3462 if (ret->datalen == 0) {
3465 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3466 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3467 for (size_t i = 0; i < ret->datalen; i++) {
3468 jlong arr_elem = java_elems[i];
3469 LDKUpdateFailHTLC arr_elem_conv;
3470 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3471 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3472 if (arr_elem_conv.inner != NULL)
3473 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3474 ret->data[i] = arr_elem_conv;
3476 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3480 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3481 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3482 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3483 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3484 for (size_t i = 0; i < vec->datalen; i++) {
3485 CHECK((((long)vec->data[i].inner) & 1) == 0);
3486 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3488 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3492 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3493 ret->datalen = (*env)->GetArrayLength(env, elems);
3494 if (ret->datalen == 0) {
3497 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3498 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3499 for (size_t i = 0; i < ret->datalen; i++) {
3500 jlong arr_elem = java_elems[i];
3501 LDKUpdateFailMalformedHTLC arr_elem_conv;
3502 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3503 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3504 if (arr_elem_conv.inner != NULL)
3505 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3506 ret->data[i] = arr_elem_conv;
3508 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3513 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3515 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3516 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3517 CHECK(val->result_ok);
3518 return *val->contents.result;
3520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3521 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3522 CHECK(!val->result_ok);
3523 LDKLightningError ret = (*val->contents.err);
3524 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3526 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3527 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3528 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3531 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3532 ret->datalen = (*env)->GetArrayLength(env, elems);
3533 if (ret->datalen == 0) {
3536 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3537 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3538 for (size_t i = 0; i < ret->datalen; i++) {
3539 jlong arr_elem = java_elems[i];
3540 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3541 FREE((void*)arr_elem);
3542 ret->data[i] = arr_elem_conv;
3544 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3548 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3549 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3550 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3551 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3552 for (size_t i = 0; i < vec->datalen; i++) {
3553 CHECK((((long)vec->data[i].inner) & 1) == 0);
3554 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3556 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3560 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3561 ret->datalen = (*env)->GetArrayLength(env, elems);
3562 if (ret->datalen == 0) {
3565 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3566 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3567 for (size_t i = 0; i < ret->datalen; i++) {
3568 jlong arr_elem = java_elems[i];
3569 LDKNodeAnnouncement arr_elem_conv;
3570 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3571 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3572 if (arr_elem_conv.inner != NULL)
3573 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3574 ret->data[i] = arr_elem_conv;
3576 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3580 typedef struct LDKRoutingMessageHandler_JCalls {
3581 atomic_size_t refcnt;
3584 jmethodID handle_node_announcement_meth;
3585 jmethodID handle_channel_announcement_meth;
3586 jmethodID handle_channel_update_meth;
3587 jmethodID handle_htlc_fail_channel_update_meth;
3588 jmethodID get_next_channel_announcements_meth;
3589 jmethodID get_next_node_announcements_meth;
3590 jmethodID should_request_full_sync_meth;
3591 } LDKRoutingMessageHandler_JCalls;
3592 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3593 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3595 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3596 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3598 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3599 LDKCResult_boolLightningErrorZ res = *ret;
3603 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3604 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3606 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3607 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3609 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3610 LDKCResult_boolLightningErrorZ res = *ret;
3614 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3615 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3617 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3618 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3620 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3621 LDKCResult_boolLightningErrorZ res = *ret;
3625 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3626 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3628 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3629 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3631 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3633 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3634 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3636 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3637 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3639 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3640 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3644 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3645 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3647 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3648 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3649 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3650 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3652 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3653 LDKCVec_NodeAnnouncementZ res = *ret;
3657 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3658 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3660 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3661 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3662 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3663 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3665 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3667 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3668 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3669 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3671 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3672 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3676 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3677 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3678 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3679 return (void*) this_arg;
3681 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3682 jclass c = (*env)->GetObjectClass(env, o);
3684 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3685 atomic_init(&calls->refcnt, 1);
3686 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3687 calls->o = (*env)->NewWeakGlobalRef(env, o);
3688 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3689 CHECK(calls->handle_node_announcement_meth != NULL);
3690 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3691 CHECK(calls->handle_channel_announcement_meth != NULL);
3692 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3693 CHECK(calls->handle_channel_update_meth != NULL);
3694 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3695 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3696 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3697 CHECK(calls->get_next_channel_announcements_meth != NULL);
3698 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3699 CHECK(calls->get_next_node_announcements_meth != NULL);
3700 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3701 CHECK(calls->should_request_full_sync_meth != NULL);
3703 LDKRoutingMessageHandler ret = {
3704 .this_arg = (void*) calls,
3705 .handle_node_announcement = handle_node_announcement_jcall,
3706 .handle_channel_announcement = handle_channel_announcement_jcall,
3707 .handle_channel_update = handle_channel_update_jcall,
3708 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3709 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3710 .get_next_node_announcements = get_next_node_announcements_jcall,
3711 .should_request_full_sync = should_request_full_sync_jcall,
3712 .free = LDKRoutingMessageHandler_JCalls_free,
3716 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3717 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3718 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3719 return (long)res_ptr;
3721 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3722 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3727 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3728 LDKNodeAnnouncement msg_conv;
3729 msg_conv.inner = (void*)(msg & (~1));
3730 msg_conv.is_owned = (msg & 1) || (msg == 0);
3731 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3732 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3737 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3738 LDKChannelAnnouncement msg_conv;
3739 msg_conv.inner = (void*)(msg & (~1));
3740 msg_conv.is_owned = (msg & 1) || (msg == 0);
3741 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3742 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3747 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3748 LDKChannelUpdate msg_conv;
3749 msg_conv.inner = (void*)(msg & (~1));
3750 msg_conv.is_owned = (msg & 1) || (msg == 0);
3751 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3752 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3757 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3758 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3759 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) {
3763 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3764 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3765 *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) {
3770 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3771 LDKPublicKey starting_point_ref;
3772 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3773 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3774 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3775 *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3780 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3781 LDKPublicKey node_id_ref;
3782 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3783 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3784 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3788 typedef struct LDKSocketDescriptor_JCalls {
3789 atomic_size_t refcnt;
3792 jmethodID send_data_meth;
3793 jmethodID disconnect_socket_meth;
3795 jmethodID hash_meth;
3796 } LDKSocketDescriptor_JCalls;
3797 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3798 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3800 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3801 LDKu8slice data_var = data;
3802 jbyteArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
3803 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
3804 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3806 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
3808 void disconnect_socket_jcall(void* this_arg) {
3809 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3811 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3812 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3814 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3816 bool eq_jcall(const void* this_arg, const void *other_arg) {
3817 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3819 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3820 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3822 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3824 uint64_t hash_jcall(const void* this_arg) {
3825 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3827 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3828 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3830 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3832 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3833 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3834 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3837 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3841 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3842 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3843 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3844 return (void*) this_arg;
3846 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3847 jclass c = (*env)->GetObjectClass(env, o);
3849 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3850 atomic_init(&calls->refcnt, 1);
3851 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3852 calls->o = (*env)->NewWeakGlobalRef(env, o);
3853 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3854 CHECK(calls->send_data_meth != NULL);
3855 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3856 CHECK(calls->disconnect_socket_meth != NULL);
3857 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3858 CHECK(calls->eq_meth != NULL);
3859 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3860 CHECK(calls->hash_meth != NULL);
3862 LDKSocketDescriptor ret = {
3863 .this_arg = (void*) calls,
3864 .send_data = send_data_jcall,
3865 .disconnect_socket = disconnect_socket_jcall,
3868 .clone = LDKSocketDescriptor_JCalls_clone,
3869 .free = LDKSocketDescriptor_JCalls_free,
3873 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3874 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3875 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3876 return (long)res_ptr;
3878 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3879 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
3884 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3885 LDKu8slice data_ref;
3886 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
3887 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
3888 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
3889 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
3893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
3894 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3895 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
3898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
3899 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3900 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
3904 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3905 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3906 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3909 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3912 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3913 CHECK(val->result_ok);
3914 LDKCVecTempl_u8 l_u8_var = (*val->contents.result);
3915 jbyteArray l_u8_arr = (*_env)->NewByteArray(_env, l_u8_var.datalen);
3916 (*_env)->SetByteArrayRegion(_env, l_u8_arr, 0, l_u8_var.datalen, l_u8_var.data);
3919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3920 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3921 CHECK(!val->result_ok);
3922 LDKPeerHandleError ret = (*val->contents.err);
3923 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3926 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3929 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3930 CHECK(val->result_ok);
3931 return *val->contents.result;
3933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3934 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3935 CHECK(!val->result_ok);
3936 LDKPeerHandleError ret = (*val->contents.err);
3937 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3940 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3942 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3943 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3944 CHECK(val->result_ok);
3945 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
3946 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (*val->contents.result).bytes);
3949 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3950 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3951 CHECK(!val->result_ok);
3952 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3956 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3958 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3959 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3960 CHECK(val->result_ok);
3961 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
3962 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (*val->contents.result).compressed_form);
3965 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3966 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3967 CHECK(!val->result_ok);
3968 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3971 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3972 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3975 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3976 CHECK(val->result_ok);
3977 LDKTxCreationKeys ret = (*val->contents.result);
3978 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3980 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3981 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3982 CHECK(!val->result_ok);
3983 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3986 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3987 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3988 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3991 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3992 ret->datalen = (*env)->GetArrayLength(env, elems);
3993 if (ret->datalen == 0) {
3996 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3997 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3998 for (size_t i = 0; i < ret->datalen; i++) {
3999 jlong arr_elem = java_elems[i];
4000 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4001 FREE((void*)arr_elem);
4002 ret->data[i] = arr_elem_conv;
4004 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4008 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4009 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4010 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4011 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4012 for (size_t i = 0; i < vec->datalen; i++) {
4013 CHECK((((long)vec->data[i].inner) & 1) == 0);
4014 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4016 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4020 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4021 ret->datalen = (*env)->GetArrayLength(env, elems);
4022 if (ret->datalen == 0) {
4025 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4026 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4027 for (size_t i = 0; i < ret->datalen; i++) {
4028 jlong arr_elem = java_elems[i];
4029 LDKRouteHop arr_elem_conv;
4030 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4031 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4032 if (arr_elem_conv.inner != NULL)
4033 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4034 ret->data[i] = arr_elem_conv;
4036 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4040 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4041 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4042 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4045 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
4046 ret->datalen = (*env)->GetArrayLength(env, elems);
4047 if (ret->datalen == 0) {
4050 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
4051 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4052 for (size_t i = 0; i < ret->datalen; i++) {
4053 jlong arr_elem = java_elems[i];
4054 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
4055 FREE((void*)arr_elem);
4056 ret->data[i] = arr_elem_conv;
4058 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4063 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4066 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4067 CHECK(val->result_ok);
4068 LDKRoute ret = (*val->contents.result);
4069 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4072 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4073 CHECK(!val->result_ok);
4074 LDKLightningError ret = (*val->contents.err);
4075 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4077 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4078 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4079 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4080 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4081 for (size_t i = 0; i < vec->datalen; i++) {
4082 CHECK((((long)vec->data[i].inner) & 1) == 0);
4083 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4085 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4089 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4090 ret->datalen = (*env)->GetArrayLength(env, elems);
4091 if (ret->datalen == 0) {
4094 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4095 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4096 for (size_t i = 0; i < ret->datalen; i++) {
4097 jlong arr_elem = java_elems[i];
4098 LDKRouteHint arr_elem_conv;
4099 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4100 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4101 if (arr_elem_conv.inner != NULL)
4102 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4103 ret->data[i] = arr_elem_conv;
4105 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4110 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4112 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4116 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4118 C2Tuple_OutPointScriptZ_free(arg_conv);
4121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4122 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4124 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4128 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4130 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4134 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4136 C2Tuple_u64u64Z_free(arg_conv);
4139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4140 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4142 C2Tuple_usizeTransactionZ_free(arg_conv);
4145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4146 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4148 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4152 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4154 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4158 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4160 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4161 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4166 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4168 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4172 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4174 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4175 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4180 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4182 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4183 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4188 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4190 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4194 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4196 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4197 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4202 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4204 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4205 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4210 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4212 CResult_NoneAPIErrorZ_free(arg_conv);
4215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4216 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4218 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4219 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4224 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4226 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4230 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4232 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4233 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4238 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4240 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4244 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4246 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4247 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4252 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4254 CResult_NonePaymentSendFailureZ_free(arg_conv);
4257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4258 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4260 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4261 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4266 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4268 CResult_NonePeerHandleErrorZ_free(arg_conv);
4271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4272 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4274 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4275 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4280 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4282 CResult_PublicKeySecpErrorZ_free(arg_conv);
4285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4286 LDKPublicKey arg_ref;
4287 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4288 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4289 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4290 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4295 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4297 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4298 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4303 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4305 CResult_RouteLightningErrorZ_free(arg_conv);
4308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4309 LDKRoute arg_conv = *(LDKRoute*)arg;
4311 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4312 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4317 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4319 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4320 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4325 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4327 CResult_SecretKeySecpErrorZ_free(arg_conv);
4330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4331 LDKSecretKey arg_ref;
4332 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4333 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4334 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4335 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4340 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4342 CResult_SignatureNoneZ_free(arg_conv);
4345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4346 LDKSignature arg_ref;
4347 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4348 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4349 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4350 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4355 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4357 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4358 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4363 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4365 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4369 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4371 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4372 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4377 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4379 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4380 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4385 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4387 CResult_TxOutAccessErrorZ_free(arg_conv);
4390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4391 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4393 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4394 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4399 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4401 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4402 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4407 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4409 CResult_boolLightningErrorZ_free(arg_conv);
4412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4413 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4414 *ret = CResult_boolLightningErrorZ_ok(arg);
4418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4419 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4421 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4422 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4427 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4429 CResult_boolPeerHandleErrorZ_free(arg_conv);
4432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4433 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4434 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4439 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4441 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4445 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4447 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4451 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4453 CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4457 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4459 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4463 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4465 CVec_CVec_RouteHopZZ_free(arg_conv);
4468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4469 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4471 CVec_ChannelDetailsZ_free(arg_conv);
4474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4475 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4477 CVec_ChannelMonitorZ_free(arg_conv);
4480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4481 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4483 CVec_EventZ_free(arg_conv);
4486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4487 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4489 CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4493 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4495 CVec_MessageSendEventZ_free(arg_conv);
4498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4499 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4501 CVec_MonitorEventZ_free(arg_conv);
4504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4505 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4507 CVec_NetAddressZ_free(arg_conv);
4510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4511 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4513 CVec_NodeAnnouncementZ_free(arg_conv);
4516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4517 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4519 CVec_PublicKeyZ_free(arg_conv);
4522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4523 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4525 CVec_RouteHintZ_free(arg_conv);
4528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4529 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4531 CVec_RouteHopZ_free(arg_conv);
4534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4535 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4537 CVec_SignatureZ_free(arg_conv);
4540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4541 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4543 CVec_SpendableOutputDescriptorZ_free(arg_conv);
4546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4547 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4549 CVec_TransactionZ_free(arg_conv);
4552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4553 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4555 CVec_TxOutZ_free(arg_conv);
4558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4559 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4561 CVec_UpdateAddHTLCZ_free(arg_conv);
4564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4565 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4567 CVec_UpdateFailHTLCZ_free(arg_conv);
4570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4571 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4573 CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4577 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4579 CVec_UpdateFulfillHTLCZ_free(arg_conv);
4582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4583 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4585 CVec_u64Z_free(arg_conv);
4588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4589 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4591 CVec_u8Z_free(arg_conv);
4594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4595 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4597 Transaction_free(_res_conv);
4600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4601 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4603 TxOut_free(_res_conv);
4606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4607 LDKTransaction b_conv = *(LDKTransaction*)b;
4609 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4610 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4615 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4616 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4621 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4622 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4628 a_conv.inner = (void*)(a & (~1));
4629 a_conv.is_owned = (a & 1) || (a == 0);
4630 if (a_conv.inner != NULL)
4631 a_conv = OutPoint_clone(&a_conv);
4632 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4634 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4635 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4640 LDKThirtyTwoBytes a_ref;
4641 CHECK((*_env)->GetArrayLength (_env, a) == 32);
4642 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4643 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4645 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4646 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4651 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4652 *ret = C2Tuple_u64u64Z_new(a, b);
4656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4658 CHECK((*_env)->GetArrayLength (_env, a) == 64);
4659 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
4660 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4662 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4663 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_conv);
4667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4668 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4669 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4674 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4675 *ret = CResult_SignatureNoneZ_err();
4679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4680 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4681 *ret = CResult_CVec_SignatureZNoneZ_err();
4685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4686 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4687 *ret = CResult_NoneAPIErrorZ_ok();
4691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4692 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4693 *ret = CResult_NonePaymentSendFailureZ_ok();
4697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4698 LDKChannelAnnouncement a_conv;
4699 a_conv.inner = (void*)(a & (~1));
4700 a_conv.is_owned = (a & 1) || (a == 0);
4701 if (a_conv.inner != NULL)
4702 a_conv = ChannelAnnouncement_clone(&a_conv);
4703 LDKChannelUpdate b_conv;
4704 b_conv.inner = (void*)(b & (~1));
4705 b_conv.is_owned = (b & 1) || (b == 0);
4706 if (b_conv.inner != NULL)
4707 b_conv = ChannelUpdate_clone(&b_conv);
4708 LDKChannelUpdate c_conv;
4709 c_conv.inner = (void*)(c & (~1));
4710 c_conv.is_owned = (c & 1) || (c == 0);
4711 if (c_conv.inner != NULL)
4712 c_conv = ChannelUpdate_clone(&c_conv);
4713 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4714 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4719 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4720 *ret = CResult_NonePeerHandleErrorZ_ok();
4724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
4725 LDKHTLCOutputInCommitment a_conv;
4726 a_conv.inner = (void*)(a & (~1));
4727 a_conv.is_owned = (a & 1) || (a == 0);
4728 if (a_conv.inner != NULL)
4729 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4731 CHECK((*_env)->GetArrayLength (_env, b) == 64);
4732 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
4733 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4734 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
4738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4739 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4740 FREE((void*)this_ptr);
4741 Event_free(this_ptr_conv);
4744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4745 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4746 FREE((void*)this_ptr);
4747 MessageSendEvent_free(this_ptr_conv);
4750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4751 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4752 FREE((void*)this_ptr);
4753 MessageSendEventsProvider_free(this_ptr_conv);
4756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4757 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4758 FREE((void*)this_ptr);
4759 EventsProvider_free(this_ptr_conv);
4762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4763 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4764 FREE((void*)this_ptr);
4765 APIError_free(this_ptr_conv);
4768 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4769 jclass ret = LDKLevel_to_java(_env, Level_max());
4773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4774 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4775 FREE((void*)this_ptr);
4776 Logger_free(this_ptr_conv);
4779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4780 LDKChannelHandshakeConfig this_ptr_conv;
4781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4783 ChannelHandshakeConfig_free(this_ptr_conv);
4786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4787 LDKChannelHandshakeConfig orig_conv;
4788 orig_conv.inner = (void*)(orig & (~1));
4789 orig_conv.is_owned = (orig & 1) || (orig == 0);
4790 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4791 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4794 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4795 LDKChannelHandshakeConfig this_ptr_conv;
4796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4798 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4803 LDKChannelHandshakeConfig this_ptr_conv;
4804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4806 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4809 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4810 LDKChannelHandshakeConfig this_ptr_conv;
4811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4813 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4818 LDKChannelHandshakeConfig this_ptr_conv;
4819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4821 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4825 LDKChannelHandshakeConfig this_ptr_conv;
4826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4828 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4833 LDKChannelHandshakeConfig this_ptr_conv;
4834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4836 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4839 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) {
4840 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4841 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4845 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4846 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4850 LDKChannelHandshakeLimits this_ptr_conv;
4851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4853 ChannelHandshakeLimits_free(this_ptr_conv);
4856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4857 LDKChannelHandshakeLimits orig_conv;
4858 orig_conv.inner = (void*)(orig & (~1));
4859 orig_conv.is_owned = (orig & 1) || (orig == 0);
4860 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4861 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4865 LDKChannelHandshakeLimits this_ptr_conv;
4866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4868 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4873 LDKChannelHandshakeLimits this_ptr_conv;
4874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4876 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4880 LDKChannelHandshakeLimits this_ptr_conv;
4881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4883 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4888 LDKChannelHandshakeLimits this_ptr_conv;
4889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4891 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4895 LDKChannelHandshakeLimits this_ptr_conv;
4896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4898 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4902 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) {
4903 LDKChannelHandshakeLimits this_ptr_conv;
4904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4906 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4909 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4910 LDKChannelHandshakeLimits this_ptr_conv;
4911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4913 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4918 LDKChannelHandshakeLimits this_ptr_conv;
4919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4921 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4924 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4925 LDKChannelHandshakeLimits this_ptr_conv;
4926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4928 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4933 LDKChannelHandshakeLimits this_ptr_conv;
4934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4936 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4940 LDKChannelHandshakeLimits this_ptr_conv;
4941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4943 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4948 LDKChannelHandshakeLimits this_ptr_conv;
4949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4951 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4955 LDKChannelHandshakeLimits this_ptr_conv;
4956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4958 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4963 LDKChannelHandshakeLimits this_ptr_conv;
4964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4965 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4966 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4969 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4970 LDKChannelHandshakeLimits this_ptr_conv;
4971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4973 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4978 LDKChannelHandshakeLimits this_ptr_conv;
4979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4981 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4985 LDKChannelHandshakeLimits this_ptr_conv;
4986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4988 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4993 LDKChannelHandshakeLimits this_ptr_conv;
4994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4996 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4999 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5000 LDKChannelHandshakeLimits this_ptr_conv;
5001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5003 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5008 LDKChannelHandshakeLimits this_ptr_conv;
5009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5011 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5014 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) {
5015 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);
5016 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5020 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5021 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5025 LDKChannelConfig this_ptr_conv;
5026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5028 ChannelConfig_free(this_ptr_conv);
5031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5032 LDKChannelConfig orig_conv;
5033 orig_conv.inner = (void*)(orig & (~1));
5034 orig_conv.is_owned = (orig & 1) || (orig == 0);
5035 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5036 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5039 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5040 LDKChannelConfig this_ptr_conv;
5041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5043 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5048 LDKChannelConfig this_ptr_conv;
5049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5051 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5055 LDKChannelConfig this_ptr_conv;
5056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5058 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5063 LDKChannelConfig this_ptr_conv;
5064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5066 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5069 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5070 LDKChannelConfig this_ptr_conv;
5071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5073 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5078 LDKChannelConfig this_ptr_conv;
5079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5081 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5084 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) {
5085 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5086 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5090 LDKChannelConfig ret = ChannelConfig_default();
5091 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5095 LDKChannelConfig obj_conv;
5096 obj_conv.inner = (void*)(obj & (~1));
5097 obj_conv.is_owned = (obj & 1) || (obj == 0);
5098 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5099 *ret = ChannelConfig_write(&obj_conv);
5103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5105 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5106 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5107 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5108 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5109 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5113 LDKUserConfig 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 UserConfig_free(this_ptr_conv);
5119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5120 LDKUserConfig orig_conv;
5121 orig_conv.inner = (void*)(orig & (~1));
5122 orig_conv.is_owned = (orig & 1) || (orig == 0);
5123 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5124 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5128 LDKUserConfig this_ptr_conv;
5129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5131 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5132 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5136 LDKUserConfig this_ptr_conv;
5137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5139 LDKChannelHandshakeConfig val_conv;
5140 val_conv.inner = (void*)(val & (~1));
5141 val_conv.is_owned = (val & 1) || (val == 0);
5142 if (val_conv.inner != NULL)
5143 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5144 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5148 LDKUserConfig this_ptr_conv;
5149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5151 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5152 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5156 LDKUserConfig this_ptr_conv;
5157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5159 LDKChannelHandshakeLimits val_conv;
5160 val_conv.inner = (void*)(val & (~1));
5161 val_conv.is_owned = (val & 1) || (val == 0);
5162 if (val_conv.inner != NULL)
5163 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5164 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5168 LDKUserConfig this_ptr_conv;
5169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5171 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5172 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5176 LDKUserConfig this_ptr_conv;
5177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5179 LDKChannelConfig val_conv;
5180 val_conv.inner = (void*)(val & (~1));
5181 val_conv.is_owned = (val & 1) || (val == 0);
5182 if (val_conv.inner != NULL)
5183 val_conv = ChannelConfig_clone(&val_conv);
5184 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5187 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) {
5188 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5189 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5190 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5191 if (own_channel_config_arg_conv.inner != NULL)
5192 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5193 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5194 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5195 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5196 if (peer_channel_config_limits_arg_conv.inner != NULL)
5197 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5198 LDKChannelConfig channel_options_arg_conv;
5199 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5200 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5201 if (channel_options_arg_conv.inner != NULL)
5202 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5203 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5204 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5208 LDKUserConfig ret = UserConfig_default();
5209 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5213 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5214 FREE((void*)this_ptr);
5215 Access_free(this_ptr_conv);
5218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5219 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5220 FREE((void*)this_ptr);
5221 Watch_free(this_ptr_conv);
5224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5225 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5226 FREE((void*)this_ptr);
5227 Filter_free(this_ptr_conv);
5230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5231 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5232 FREE((void*)this_ptr);
5233 BroadcasterInterface_free(this_ptr_conv);
5236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5237 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5238 FREE((void*)this_ptr);
5239 FeeEstimator_free(this_ptr_conv);
5242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5243 LDKChainMonitor this_ptr_conv;
5244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5246 ChainMonitor_free(this_ptr_conv);
5249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5250 LDKChainMonitor this_arg_conv;
5251 this_arg_conv.inner = (void*)(this_arg & (~1));
5252 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5253 unsigned char header_arr[80];
5254 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5255 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5256 unsigned char (*header_ref)[80] = &header_arr;
5257 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5258 FREE((void*)txdata);
5259 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5263 LDKChainMonitor this_arg_conv;
5264 this_arg_conv.inner = (void*)(this_arg & (~1));
5265 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5266 unsigned char header_arr[80];
5267 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5268 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5269 unsigned char (*header_ref)[80] = &header_arr;
5270 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5273 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5274 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5275 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5276 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5277 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5278 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5280 LDKLogger logger_conv = *(LDKLogger*)logger;
5281 if (logger_conv.free == LDKLogger_JCalls_free) {
5282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5283 LDKLogger_JCalls_clone(logger_conv.this_arg);
5285 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5286 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5287 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5288 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5290 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5291 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5295 LDKChainMonitor this_arg_conv;
5296 this_arg_conv.inner = (void*)(this_arg & (~1));
5297 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5298 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5299 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5304 LDKChainMonitor this_arg_conv;
5305 this_arg_conv.inner = (void*)(this_arg & (~1));
5306 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5307 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5308 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5313 LDKChannelMonitorUpdate this_ptr_conv;
5314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5316 ChannelMonitorUpdate_free(this_ptr_conv);
5319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5320 LDKChannelMonitorUpdate orig_conv;
5321 orig_conv.inner = (void*)(orig & (~1));
5322 orig_conv.is_owned = (orig & 1) || (orig == 0);
5323 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5324 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5328 LDKChannelMonitorUpdate this_ptr_conv;
5329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5331 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5336 LDKChannelMonitorUpdate this_ptr_conv;
5337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5339 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5343 LDKChannelMonitorUpdate obj_conv;
5344 obj_conv.inner = (void*)(obj & (~1));
5345 obj_conv.is_owned = (obj & 1) || (obj == 0);
5346 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5347 *ret = ChannelMonitorUpdate_write(&obj_conv);
5351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5353 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5354 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5355 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5356 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5357 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5361 LDKMonitorUpdateError this_ptr_conv;
5362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5364 MonitorUpdateError_free(this_ptr_conv);
5367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5368 LDKMonitorEvent this_ptr_conv;
5369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5371 MonitorEvent_free(this_ptr_conv);
5374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5375 LDKHTLCUpdate this_ptr_conv;
5376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5378 HTLCUpdate_free(this_ptr_conv);
5381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5382 LDKHTLCUpdate orig_conv;
5383 orig_conv.inner = (void*)(orig & (~1));
5384 orig_conv.is_owned = (orig & 1) || (orig == 0);
5385 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5386 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5390 LDKHTLCUpdate obj_conv;
5391 obj_conv.inner = (void*)(obj & (~1));
5392 obj_conv.is_owned = (obj & 1) || (obj == 0);
5393 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5394 *ret = HTLCUpdate_write(&obj_conv);
5398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5400 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5401 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5402 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5403 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5404 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5408 LDKChannelMonitor this_ptr_conv;
5409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5411 ChannelMonitor_free(this_ptr_conv);
5414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5415 LDKChannelMonitor this_arg_conv;
5416 this_arg_conv.inner = (void*)(this_arg & (~1));
5417 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5418 LDKChannelMonitorUpdate updates_conv;
5419 updates_conv.inner = (void*)(updates & (~1));
5420 updates_conv.is_owned = (updates & 1) || (updates == 0);
5421 if (updates_conv.inner != NULL)
5422 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5423 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5424 LDKLogger* logger_conv = (LDKLogger*)logger;
5425 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5426 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5431 LDKChannelMonitor this_arg_conv;
5432 this_arg_conv.inner = (void*)(this_arg & (~1));
5433 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5434 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5439 LDKChannelMonitor this_arg_conv;
5440 this_arg_conv.inner = (void*)(this_arg & (~1));
5441 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5442 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5443 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5448 LDKChannelMonitor this_arg_conv;
5449 this_arg_conv.inner = (void*)(this_arg & (~1));
5450 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5451 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5452 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5457 LDKChannelMonitor this_arg_conv;
5458 this_arg_conv.inner = (void*)(this_arg & (~1));
5459 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5460 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5461 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5466 LDKChannelMonitor this_arg_conv;
5467 this_arg_conv.inner = (void*)(this_arg & (~1));
5468 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5469 LDKLogger* logger_conv = (LDKLogger*)logger;
5470 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5471 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5475 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) {
5476 LDKChannelMonitor this_arg_conv;
5477 this_arg_conv.inner = (void*)(this_arg & (~1));
5478 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5479 unsigned char header_arr[80];
5480 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5481 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5482 unsigned char (*header_ref)[80] = &header_arr;
5483 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5484 FREE((void*)txdata);
5485 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5486 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5487 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5488 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5490 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5491 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5492 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5493 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5495 LDKLogger logger_conv = *(LDKLogger*)logger;
5496 if (logger_conv.free == LDKLogger_JCalls_free) {
5497 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5498 LDKLogger_JCalls_clone(logger_conv.this_arg);
5500 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5501 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5505 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) {
5506 LDKChannelMonitor this_arg_conv;
5507 this_arg_conv.inner = (void*)(this_arg & (~1));
5508 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5509 unsigned char header_arr[80];
5510 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5511 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5512 unsigned char (*header_ref)[80] = &header_arr;
5513 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5514 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5515 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5516 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5518 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5519 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5520 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5521 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5523 LDKLogger logger_conv = *(LDKLogger*)logger;
5524 if (logger_conv.free == LDKLogger_JCalls_free) {
5525 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5526 LDKLogger_JCalls_clone(logger_conv.this_arg);
5528 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5532 LDKOutPoint this_ptr_conv;
5533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5535 OutPoint_free(this_ptr_conv);
5538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5539 LDKOutPoint orig_conv;
5540 orig_conv.inner = (void*)(orig & (~1));
5541 orig_conv.is_owned = (orig & 1) || (orig == 0);
5542 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5543 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5546 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5547 LDKOutPoint this_ptr_conv;
5548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5550 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5551 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5556 LDKOutPoint this_ptr_conv;
5557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5559 LDKThirtyTwoBytes val_ref;
5560 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5561 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5562 OutPoint_set_txid(&this_ptr_conv, val_ref);
5565 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5566 LDKOutPoint this_ptr_conv;
5567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5569 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
5573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5574 LDKOutPoint this_ptr_conv;
5575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5577 OutPoint_set_index(&this_ptr_conv, val);
5580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5581 LDKThirtyTwoBytes txid_arg_ref;
5582 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
5583 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5584 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5585 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5588 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5589 LDKOutPoint this_arg_conv;
5590 this_arg_conv.inner = (void*)(this_arg & (~1));
5591 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5592 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5593 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5598 LDKOutPoint obj_conv;
5599 obj_conv.inner = (void*)(obj & (~1));
5600 obj_conv.is_owned = (obj & 1) || (obj == 0);
5601 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5602 *ret = OutPoint_write(&obj_conv);
5606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5608 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5609 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5610 LDKOutPoint ret = OutPoint_read(ser_ref);
5611 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5612 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5616 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5617 FREE((void*)this_ptr);
5618 SpendableOutputDescriptor_free(this_ptr_conv);
5621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5622 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5623 FREE((void*)this_ptr);
5624 ChannelKeys_free(this_ptr_conv);
5627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5628 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5629 FREE((void*)this_ptr);
5630 KeysInterface_free(this_ptr_conv);
5633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5634 LDKInMemoryChannelKeys this_ptr_conv;
5635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5637 InMemoryChannelKeys_free(this_ptr_conv);
5640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5641 LDKInMemoryChannelKeys orig_conv;
5642 orig_conv.inner = (void*)(orig & (~1));
5643 orig_conv.is_owned = (orig & 1) || (orig == 0);
5644 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5645 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5649 LDKInMemoryChannelKeys this_ptr_conv;
5650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5652 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5653 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5658 LDKInMemoryChannelKeys this_ptr_conv;
5659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5661 LDKSecretKey val_ref;
5662 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5663 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5664 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5668 LDKInMemoryChannelKeys this_ptr_conv;
5669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5671 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5672 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5677 LDKInMemoryChannelKeys this_ptr_conv;
5678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5680 LDKSecretKey val_ref;
5681 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5682 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5683 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5687 LDKInMemoryChannelKeys this_ptr_conv;
5688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5690 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5691 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5696 LDKInMemoryChannelKeys this_ptr_conv;
5697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5699 LDKSecretKey val_ref;
5700 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5701 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5702 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5706 LDKInMemoryChannelKeys this_ptr_conv;
5707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5709 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5710 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5715 LDKInMemoryChannelKeys this_ptr_conv;
5716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5718 LDKSecretKey val_ref;
5719 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5720 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5721 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5724 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5725 LDKInMemoryChannelKeys this_ptr_conv;
5726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5728 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5729 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5734 LDKInMemoryChannelKeys this_ptr_conv;
5735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5737 LDKSecretKey val_ref;
5738 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5739 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5740 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
5743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5744 LDKInMemoryChannelKeys this_ptr_conv;
5745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5747 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5748 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5753 LDKInMemoryChannelKeys this_ptr_conv;
5754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5756 LDKThirtyTwoBytes val_ref;
5757 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5758 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5759 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_key, jbyteArray revocation_base_key, jbyteArray payment_key, jbyteArray delayed_payment_base_key, jbyteArray htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
5763 LDKSecretKey funding_key_ref;
5764 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
5765 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
5766 LDKSecretKey revocation_base_key_ref;
5767 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
5768 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
5769 LDKSecretKey payment_key_ref;
5770 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
5771 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
5772 LDKSecretKey delayed_payment_base_key_ref;
5773 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
5774 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
5775 LDKSecretKey htlc_base_key_ref;
5776 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
5777 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
5778 LDKThirtyTwoBytes commitment_seed_ref;
5779 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
5780 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5781 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5782 FREE((void*)key_derivation_params);
5783 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
5784 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5788 LDKInMemoryChannelKeys this_arg_conv;
5789 this_arg_conv.inner = (void*)(this_arg & (~1));
5790 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5791 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5792 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5795 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5796 LDKInMemoryChannelKeys this_arg_conv;
5797 this_arg_conv.inner = (void*)(this_arg & (~1));
5798 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5799 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5803 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5804 LDKInMemoryChannelKeys this_arg_conv;
5805 this_arg_conv.inner = (void*)(this_arg & (~1));
5806 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5807 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5812 LDKInMemoryChannelKeys this_arg_conv;
5813 this_arg_conv.inner = (void*)(this_arg & (~1));
5814 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5815 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5816 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5820 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5821 LDKInMemoryChannelKeys obj_conv;
5822 obj_conv.inner = (void*)(obj & (~1));
5823 obj_conv.is_owned = (obj & 1) || (obj == 0);
5824 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5825 *ret = InMemoryChannelKeys_write(&obj_conv);
5829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5831 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5832 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5833 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
5834 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5835 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5839 LDKKeysManager this_ptr_conv;
5840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5842 KeysManager_free(this_ptr_conv);
5845 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) {
5846 unsigned char seed_arr[32];
5847 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
5848 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5849 unsigned char (*seed_ref)[32] = &seed_arr;
5850 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5851 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5852 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5855 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) {
5856 LDKKeysManager this_arg_conv;
5857 this_arg_conv.inner = (void*)(this_arg & (~1));
5858 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5859 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5860 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5864 LDKKeysManager this_arg_conv;
5865 this_arg_conv.inner = (void*)(this_arg & (~1));
5866 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5867 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5868 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5873 LDKChannelManager this_ptr_conv;
5874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5876 ChannelManager_free(this_ptr_conv);
5879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5880 LDKChannelDetails this_ptr_conv;
5881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5883 ChannelDetails_free(this_ptr_conv);
5886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5887 LDKChannelDetails orig_conv;
5888 orig_conv.inner = (void*)(orig & (~1));
5889 orig_conv.is_owned = (orig & 1) || (orig == 0);
5890 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
5891 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5895 LDKChannelDetails this_ptr_conv;
5896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5898 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5899 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5904 LDKChannelDetails this_ptr_conv;
5905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5907 LDKThirtyTwoBytes val_ref;
5908 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5909 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5910 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5914 LDKChannelDetails this_ptr_conv;
5915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5917 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5918 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5923 LDKChannelDetails this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5926 LDKPublicKey val_ref;
5927 CHECK((*_env)->GetArrayLength (_env, val) == 33);
5928 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5929 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5933 LDKChannelDetails this_ptr_conv;
5934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5936 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5937 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5941 LDKChannelDetails this_ptr_conv;
5942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5944 LDKInitFeatures val_conv;
5945 val_conv.inner = (void*)(val & (~1));
5946 val_conv.is_owned = (val & 1) || (val == 0);
5947 // Warning: we may need a move here but can't clone!
5948 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5952 LDKChannelDetails this_ptr_conv;
5953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5955 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5960 LDKChannelDetails this_ptr_conv;
5961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5963 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5967 LDKChannelDetails this_ptr_conv;
5968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5970 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
5974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5975 LDKChannelDetails this_ptr_conv;
5976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5978 ChannelDetails_set_user_id(&this_ptr_conv, val);
5981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5982 LDKChannelDetails this_ptr_conv;
5983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5985 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5990 LDKChannelDetails this_ptr_conv;
5991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5993 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5997 LDKChannelDetails this_ptr_conv;
5998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6000 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6005 LDKChannelDetails this_ptr_conv;
6006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6008 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6012 LDKChannelDetails this_ptr_conv;
6013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6015 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6020 LDKChannelDetails this_ptr_conv;
6021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6023 ChannelDetails_set_is_live(&this_ptr_conv, val);
6026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6027 LDKPaymentSendFailure this_ptr_conv;
6028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6030 PaymentSendFailure_free(this_ptr_conv);
6033 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) {
6034 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6035 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6036 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6037 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6038 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6040 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6041 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6042 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6043 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6045 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6046 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6047 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6048 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6050 LDKLogger logger_conv = *(LDKLogger*)logger;
6051 if (logger_conv.free == LDKLogger_JCalls_free) {
6052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6053 LDKLogger_JCalls_clone(logger_conv.this_arg);
6055 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6056 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6057 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6058 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6060 LDKUserConfig config_conv;
6061 config_conv.inner = (void*)(config & (~1));
6062 config_conv.is_owned = (config & 1) || (config == 0);
6063 if (config_conv.inner != NULL)
6064 config_conv = UserConfig_clone(&config_conv);
6065 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);
6066 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6069 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) {
6070 LDKChannelManager this_arg_conv;
6071 this_arg_conv.inner = (void*)(this_arg & (~1));
6072 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6073 LDKPublicKey their_network_key_ref;
6074 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6075 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6076 LDKUserConfig override_config_conv;
6077 override_config_conv.inner = (void*)(override_config & (~1));
6078 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6079 if (override_config_conv.inner != NULL)
6080 override_config_conv = UserConfig_clone(&override_config_conv);
6081 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6082 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6087 LDKChannelManager this_arg_conv;
6088 this_arg_conv.inner = (void*)(this_arg & (~1));
6089 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6090 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6091 *ret = ChannelManager_list_channels(&this_arg_conv);
6095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6096 LDKChannelManager this_arg_conv;
6097 this_arg_conv.inner = (void*)(this_arg & (~1));
6098 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6099 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6100 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
6104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6105 LDKChannelManager this_arg_conv;
6106 this_arg_conv.inner = (void*)(this_arg & (~1));
6107 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6108 unsigned char channel_id_arr[32];
6109 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6110 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6111 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6112 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6113 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6118 LDKChannelManager this_arg_conv;
6119 this_arg_conv.inner = (void*)(this_arg & (~1));
6120 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6121 unsigned char channel_id_arr[32];
6122 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6123 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6124 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6125 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6129 LDKChannelManager this_arg_conv;
6130 this_arg_conv.inner = (void*)(this_arg & (~1));
6131 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6132 ChannelManager_force_close_all_channels(&this_arg_conv);
6135 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) {
6136 LDKChannelManager this_arg_conv;
6137 this_arg_conv.inner = (void*)(this_arg & (~1));
6138 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6139 LDKRoute route_conv;
6140 route_conv.inner = (void*)(route & (~1));
6141 route_conv.is_owned = (route & 1) || (route == 0);
6142 LDKThirtyTwoBytes payment_hash_ref;
6143 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6144 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6145 LDKThirtyTwoBytes payment_secret_ref;
6146 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6147 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6148 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6149 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6153 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) {
6154 LDKChannelManager this_arg_conv;
6155 this_arg_conv.inner = (void*)(this_arg & (~1));
6156 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6157 unsigned char temporary_channel_id_arr[32];
6158 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6159 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6160 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6161 LDKOutPoint funding_txo_conv;
6162 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6163 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6164 if (funding_txo_conv.inner != NULL)
6165 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6166 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray rgb, jbyteArray alias, jlong addresses) {
6170 LDKChannelManager this_arg_conv;
6171 this_arg_conv.inner = (void*)(this_arg & (~1));
6172 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6173 LDKThreeBytes rgb_ref;
6174 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6175 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6176 LDKThirtyTwoBytes alias_ref;
6177 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6178 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6179 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
6180 FREE((void*)addresses);
6181 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_conv);
6184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6185 LDKChannelManager this_arg_conv;
6186 this_arg_conv.inner = (void*)(this_arg & (~1));
6187 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6188 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6192 LDKChannelManager this_arg_conv;
6193 this_arg_conv.inner = (void*)(this_arg & (~1));
6194 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6195 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6198 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) {
6199 LDKChannelManager this_arg_conv;
6200 this_arg_conv.inner = (void*)(this_arg & (~1));
6201 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6202 unsigned char payment_hash_arr[32];
6203 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6204 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6205 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6206 LDKThirtyTwoBytes payment_secret_ref;
6207 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6208 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6209 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6213 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) {
6214 LDKChannelManager this_arg_conv;
6215 this_arg_conv.inner = (void*)(this_arg & (~1));
6216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6217 LDKThirtyTwoBytes payment_preimage_ref;
6218 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6219 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6220 LDKThirtyTwoBytes payment_secret_ref;
6221 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6222 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6223 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6228 LDKChannelManager this_arg_conv;
6229 this_arg_conv.inner = (void*)(this_arg & (~1));
6230 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6231 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6232 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6236 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) {
6237 LDKChannelManager this_arg_conv;
6238 this_arg_conv.inner = (void*)(this_arg & (~1));
6239 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6240 LDKOutPoint funding_txo_conv;
6241 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6242 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6243 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6247 LDKChannelManager this_arg_conv;
6248 this_arg_conv.inner = (void*)(this_arg & (~1));
6249 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6250 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6251 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6256 LDKChannelManager this_arg_conv;
6257 this_arg_conv.inner = (void*)(this_arg & (~1));
6258 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6259 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6260 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6265 LDKChannelManager this_arg_conv;
6266 this_arg_conv.inner = (void*)(this_arg & (~1));
6267 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6268 unsigned char header_arr[80];
6269 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6270 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6271 unsigned char (*header_ref)[80] = &header_arr;
6272 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6273 FREE((void*)txdata);
6274 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6278 LDKChannelManager this_arg_conv;
6279 this_arg_conv.inner = (void*)(this_arg & (~1));
6280 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6281 unsigned char header_arr[80];
6282 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6283 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6284 unsigned char (*header_ref)[80] = &header_arr;
6285 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6289 LDKChannelManager this_arg_conv;
6290 this_arg_conv.inner = (void*)(this_arg & (~1));
6291 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6292 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6293 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6298 LDKChannelManagerReadArgs this_ptr_conv;
6299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6301 ChannelManagerReadArgs_free(this_ptr_conv);
6304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6305 LDKChannelManagerReadArgs this_ptr_conv;
6306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6308 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6313 LDKChannelManagerReadArgs this_ptr_conv;
6314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6316 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6317 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6318 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6319 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6321 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6325 LDKChannelManagerReadArgs this_ptr_conv;
6326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6328 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6333 LDKChannelManagerReadArgs this_ptr_conv;
6334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6336 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6337 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6338 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6339 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6341 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6345 LDKChannelManagerReadArgs 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 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6353 LDKChannelManagerReadArgs this_ptr_conv;
6354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6356 LDKWatch val_conv = *(LDKWatch*)val;
6357 if (val_conv.free == LDKWatch_JCalls_free) {
6358 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6359 LDKWatch_JCalls_clone(val_conv.this_arg);
6361 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6365 LDKChannelManagerReadArgs this_ptr_conv;
6366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6368 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6373 LDKChannelManagerReadArgs this_ptr_conv;
6374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6375 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6376 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6377 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6378 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6379 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6381 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6385 LDKChannelManagerReadArgs 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 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6393 LDKChannelManagerReadArgs this_ptr_conv;
6394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6396 LDKLogger val_conv = *(LDKLogger*)val;
6397 if (val_conv.free == LDKLogger_JCalls_free) {
6398 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6399 LDKLogger_JCalls_clone(val_conv.this_arg);
6401 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6405 LDKChannelManagerReadArgs this_ptr_conv;
6406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6408 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6409 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6413 LDKChannelManagerReadArgs this_ptr_conv;
6414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6416 LDKUserConfig val_conv;
6417 val_conv.inner = (void*)(val & (~1));
6418 val_conv.is_owned = (val & 1) || (val == 0);
6419 if (val_conv.inner != NULL)
6420 val_conv = UserConfig_clone(&val_conv);
6421 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6424 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) {
6425 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6426 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6427 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6428 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6430 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6431 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6432 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6433 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6435 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6436 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6437 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6438 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6440 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6441 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6442 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6443 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6445 LDKLogger logger_conv = *(LDKLogger*)logger;
6446 if (logger_conv.free == LDKLogger_JCalls_free) {
6447 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6448 LDKLogger_JCalls_clone(logger_conv.this_arg);
6450 LDKUserConfig default_config_conv;
6451 default_config_conv.inner = (void*)(default_config & (~1));
6452 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6453 if (default_config_conv.inner != NULL)
6454 default_config_conv = UserConfig_clone(&default_config_conv);
6455 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6456 FREE((void*)channel_monitors);
6457 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6458 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6462 LDKDecodeError 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 DecodeError_free(this_ptr_conv);
6468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6469 LDKInit 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 Init_free(this_ptr_conv);
6475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6477 orig_conv.inner = (void*)(orig & (~1));
6478 orig_conv.is_owned = (orig & 1) || (orig == 0);
6479 LDKInit ret = Init_clone(&orig_conv);
6480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6484 LDKErrorMessage this_ptr_conv;
6485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6487 ErrorMessage_free(this_ptr_conv);
6490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6491 LDKErrorMessage orig_conv;
6492 orig_conv.inner = (void*)(orig & (~1));
6493 orig_conv.is_owned = (orig & 1) || (orig == 0);
6494 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6495 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6498 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6499 LDKErrorMessage this_ptr_conv;
6500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6502 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6503 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6508 LDKErrorMessage this_ptr_conv;
6509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6511 LDKThirtyTwoBytes val_ref;
6512 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6513 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6514 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6518 LDKErrorMessage 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 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6522 *ret = ErrorMessage_get_data(&this_ptr_conv);
6526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6527 LDKErrorMessage this_ptr_conv;
6528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6530 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6532 ErrorMessage_set_data(&this_ptr_conv, val_conv);
6535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6536 LDKThirtyTwoBytes channel_id_arg_ref;
6537 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
6538 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6539 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6540 FREE((void*)data_arg);
6541 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6542 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6546 LDKPing 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 Ping_free(this_ptr_conv);
6552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6554 orig_conv.inner = (void*)(orig & (~1));
6555 orig_conv.is_owned = (orig & 1) || (orig == 0);
6556 LDKPing ret = Ping_clone(&orig_conv);
6557 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6560 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6561 LDKPing this_ptr_conv;
6562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6564 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
6568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6569 LDKPing this_ptr_conv;
6570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6572 Ping_set_ponglen(&this_ptr_conv, val);
6575 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6576 LDKPing this_ptr_conv;
6577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6579 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
6583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6584 LDKPing this_ptr_conv;
6585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6587 Ping_set_byteslen(&this_ptr_conv, val);
6590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6591 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6592 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6596 LDKPong this_ptr_conv;
6597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6599 Pong_free(this_ptr_conv);
6602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6604 orig_conv.inner = (void*)(orig & (~1));
6605 orig_conv.is_owned = (orig & 1) || (orig == 0);
6606 LDKPong ret = Pong_clone(&orig_conv);
6607 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6610 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6611 LDKPong this_ptr_conv;
6612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6614 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
6618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6619 LDKPong this_ptr_conv;
6620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6622 Pong_set_byteslen(&this_ptr_conv, val);
6625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6626 LDKPong ret = Pong_new(byteslen_arg);
6627 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6631 LDKOpenChannel this_ptr_conv;
6632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6634 OpenChannel_free(this_ptr_conv);
6637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6638 LDKOpenChannel orig_conv;
6639 orig_conv.inner = (void*)(orig & (~1));
6640 orig_conv.is_owned = (orig & 1) || (orig == 0);
6641 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6642 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6646 LDKOpenChannel this_ptr_conv;
6647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6649 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6650 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6655 LDKOpenChannel this_ptr_conv;
6656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6658 LDKThirtyTwoBytes val_ref;
6659 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6660 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6661 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6664 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6665 LDKOpenChannel this_ptr_conv;
6666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6668 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6669 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6674 LDKOpenChannel this_ptr_conv;
6675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6677 LDKThirtyTwoBytes val_ref;
6678 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6679 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6680 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6684 LDKOpenChannel this_ptr_conv;
6685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6687 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
6691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6692 LDKOpenChannel this_ptr_conv;
6693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6695 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6699 LDKOpenChannel this_ptr_conv;
6700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6702 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
6706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6707 LDKOpenChannel this_ptr_conv;
6708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6710 OpenChannel_set_push_msat(&this_ptr_conv, val);
6713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6714 LDKOpenChannel this_ptr_conv;
6715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6717 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6722 LDKOpenChannel this_ptr_conv;
6723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6725 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6729 LDKOpenChannel this_ptr_conv;
6730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6732 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6736 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) {
6737 LDKOpenChannel this_ptr_conv;
6738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6740 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6744 LDKOpenChannel this_ptr_conv;
6745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6747 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6752 LDKOpenChannel this_ptr_conv;
6753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6755 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6759 LDKOpenChannel this_ptr_conv;
6760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6762 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6767 LDKOpenChannel this_ptr_conv;
6768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6770 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6773 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6774 LDKOpenChannel this_ptr_conv;
6775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6777 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6782 LDKOpenChannel this_ptr_conv;
6783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6785 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6788 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6789 LDKOpenChannel this_ptr_conv;
6790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6792 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
6796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6797 LDKOpenChannel this_ptr_conv;
6798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6800 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6803 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6804 LDKOpenChannel this_ptr_conv;
6805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6807 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6812 LDKOpenChannel this_ptr_conv;
6813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6815 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6818 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6819 LDKOpenChannel this_ptr_conv;
6820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6822 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6823 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6828 LDKOpenChannel this_ptr_conv;
6829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6831 LDKPublicKey val_ref;
6832 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6833 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6834 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6837 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6838 LDKOpenChannel this_ptr_conv;
6839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6841 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6842 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6847 LDKOpenChannel this_ptr_conv;
6848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6850 LDKPublicKey val_ref;
6851 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6852 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6853 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6856 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6857 LDKOpenChannel this_ptr_conv;
6858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6860 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6861 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6866 LDKOpenChannel this_ptr_conv;
6867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6869 LDKPublicKey val_ref;
6870 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6871 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6872 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6875 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6876 LDKOpenChannel this_ptr_conv;
6877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6879 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6880 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6885 LDKOpenChannel this_ptr_conv;
6886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6888 LDKPublicKey val_ref;
6889 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6890 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6891 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6895 LDKOpenChannel this_ptr_conv;
6896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6898 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6899 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6904 LDKOpenChannel this_ptr_conv;
6905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6907 LDKPublicKey val_ref;
6908 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6909 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6910 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6914 LDKOpenChannel this_ptr_conv;
6915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6917 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6918 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6923 LDKOpenChannel this_ptr_conv;
6924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6926 LDKPublicKey val_ref;
6927 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6928 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6929 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6932 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6933 LDKOpenChannel 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 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
6940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6941 LDKOpenChannel this_ptr_conv;
6942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6944 OpenChannel_set_channel_flags(&this_ptr_conv, val);
6947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6948 LDKAcceptChannel this_ptr_conv;
6949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6951 AcceptChannel_free(this_ptr_conv);
6954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6955 LDKAcceptChannel orig_conv;
6956 orig_conv.inner = (void*)(orig & (~1));
6957 orig_conv.is_owned = (orig & 1) || (orig == 0);
6958 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6959 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6962 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6963 LDKAcceptChannel this_ptr_conv;
6964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6965 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6966 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6967 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6972 LDKAcceptChannel this_ptr_conv;
6973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6975 LDKThirtyTwoBytes val_ref;
6976 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6977 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6978 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6982 LDKAcceptChannel this_ptr_conv;
6983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6985 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6990 LDKAcceptChannel this_ptr_conv;
6991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6993 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6997 LDKAcceptChannel this_ptr_conv;
6998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7000 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7004 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) {
7005 LDKAcceptChannel this_ptr_conv;
7006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7008 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7012 LDKAcceptChannel this_ptr_conv;
7013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7015 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7020 LDKAcceptChannel this_ptr_conv;
7021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7023 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7026 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7027 LDKAcceptChannel this_ptr_conv;
7028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7030 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7035 LDKAcceptChannel this_ptr_conv;
7036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7038 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7041 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7042 LDKAcceptChannel this_ptr_conv;
7043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7045 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7050 LDKAcceptChannel this_ptr_conv;
7051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7053 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7056 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7057 LDKAcceptChannel this_ptr_conv;
7058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7060 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7065 LDKAcceptChannel this_ptr_conv;
7066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7068 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7071 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7072 LDKAcceptChannel this_ptr_conv;
7073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7075 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7080 LDKAcceptChannel this_ptr_conv;
7081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7083 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7087 LDKAcceptChannel this_ptr_conv;
7088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7090 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7091 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7096 LDKAcceptChannel 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 LDKPublicKey val_ref;
7100 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7101 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7102 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7105 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7106 LDKAcceptChannel this_ptr_conv;
7107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7109 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7110 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7115 LDKAcceptChannel this_ptr_conv;
7116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7118 LDKPublicKey val_ref;
7119 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7120 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7121 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7125 LDKAcceptChannel this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7128 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7129 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7134 LDKAcceptChannel this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 LDKPublicKey val_ref;
7138 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7139 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7140 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7143 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7144 LDKAcceptChannel this_ptr_conv;
7145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7147 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7148 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7153 LDKAcceptChannel this_ptr_conv;
7154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7156 LDKPublicKey val_ref;
7157 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7158 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7159 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7162 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7163 LDKAcceptChannel this_ptr_conv;
7164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7166 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7167 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7172 LDKAcceptChannel this_ptr_conv;
7173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7175 LDKPublicKey val_ref;
7176 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7177 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7178 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7181 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7182 LDKAcceptChannel this_ptr_conv;
7183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7185 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7186 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7191 LDKAcceptChannel this_ptr_conv;
7192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7194 LDKPublicKey val_ref;
7195 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7196 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7197 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7201 LDKFundingCreated this_ptr_conv;
7202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7204 FundingCreated_free(this_ptr_conv);
7207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7208 LDKFundingCreated orig_conv;
7209 orig_conv.inner = (void*)(orig & (~1));
7210 orig_conv.is_owned = (orig & 1) || (orig == 0);
7211 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7212 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7215 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7216 LDKFundingCreated 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7220 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7225 LDKFundingCreated this_ptr_conv;
7226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7228 LDKThirtyTwoBytes val_ref;
7229 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7230 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7231 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7234 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7235 LDKFundingCreated this_ptr_conv;
7236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7238 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7239 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7244 LDKFundingCreated this_ptr_conv;
7245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7247 LDKThirtyTwoBytes val_ref;
7248 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7249 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7250 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7253 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7254 LDKFundingCreated this_ptr_conv;
7255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7257 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7262 LDKFundingCreated this_ptr_conv;
7263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7265 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7268 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7269 LDKFundingCreated this_ptr_conv;
7270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7272 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7273 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7278 LDKFundingCreated this_ptr_conv;
7279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7280 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7281 LDKSignature val_ref;
7282 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7283 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7284 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jbyteArray temporary_channel_id_arg, jbyteArray funding_txid_arg, jshort funding_output_index_arg, jbyteArray signature_arg) {
7288 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7289 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7290 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7291 LDKThirtyTwoBytes funding_txid_arg_ref;
7292 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7293 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7294 LDKSignature signature_arg_ref;
7295 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7296 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7297 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7298 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7302 LDKFundingSigned this_ptr_conv;
7303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7305 FundingSigned_free(this_ptr_conv);
7308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7309 LDKFundingSigned orig_conv;
7310 orig_conv.inner = (void*)(orig & (~1));
7311 orig_conv.is_owned = (orig & 1) || (orig == 0);
7312 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7313 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7316 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7317 LDKFundingSigned this_ptr_conv;
7318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7320 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7321 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7326 LDKFundingSigned this_ptr_conv;
7327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7329 LDKThirtyTwoBytes val_ref;
7330 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7331 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7332 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7335 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7336 LDKFundingSigned this_ptr_conv;
7337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7339 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7340 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
7344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7345 LDKFundingSigned this_ptr_conv;
7346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7348 LDKSignature val_ref;
7349 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7350 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7351 FundingSigned_set_signature(&this_ptr_conv, val_ref);
7354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
7355 LDKThirtyTwoBytes channel_id_arg_ref;
7356 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7357 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7358 LDKSignature signature_arg_ref;
7359 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7360 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7361 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
7362 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7366 LDKFundingLocked this_ptr_conv;
7367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7369 FundingLocked_free(this_ptr_conv);
7372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7373 LDKFundingLocked orig_conv;
7374 orig_conv.inner = (void*)(orig & (~1));
7375 orig_conv.is_owned = (orig & 1) || (orig == 0);
7376 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7377 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7380 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7381 LDKFundingLocked this_ptr_conv;
7382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7384 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7385 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7390 LDKFundingLocked this_ptr_conv;
7391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7393 LDKThirtyTwoBytes val_ref;
7394 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7395 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7396 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7399 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7400 LDKFundingLocked this_ptr_conv;
7401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7403 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7404 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7409 LDKFundingLocked this_ptr_conv;
7410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7412 LDKPublicKey val_ref;
7413 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7414 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7415 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7419 LDKThirtyTwoBytes channel_id_arg_ref;
7420 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7421 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7422 LDKPublicKey next_per_commitment_point_arg_ref;
7423 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7424 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7425 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7426 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7430 LDKShutdown 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 Shutdown_free(this_ptr_conv);
7436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7437 LDKShutdown orig_conv;
7438 orig_conv.inner = (void*)(orig & (~1));
7439 orig_conv.is_owned = (orig & 1) || (orig == 0);
7440 LDKShutdown ret = Shutdown_clone(&orig_conv);
7441 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7445 LDKShutdown this_ptr_conv;
7446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7448 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7449 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7454 LDKShutdown this_ptr_conv;
7455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7457 LDKThirtyTwoBytes val_ref;
7458 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7459 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7460 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7463 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7464 LDKShutdown this_ptr_conv;
7465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7467 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
7468 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7469 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7474 LDKShutdown this_ptr_conv;
7475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7477 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7479 Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7483 LDKThirtyTwoBytes channel_id_arg_ref;
7484 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7485 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7486 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7487 FREE((void*)scriptpubkey_arg);
7488 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7489 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7493 LDKClosingSigned this_ptr_conv;
7494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7496 ClosingSigned_free(this_ptr_conv);
7499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7500 LDKClosingSigned orig_conv;
7501 orig_conv.inner = (void*)(orig & (~1));
7502 orig_conv.is_owned = (orig & 1) || (orig == 0);
7503 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7504 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7508 LDKClosingSigned this_ptr_conv;
7509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7511 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7512 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7517 LDKClosingSigned this_ptr_conv;
7518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7520 LDKThirtyTwoBytes val_ref;
7521 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7522 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7523 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7527 LDKClosingSigned this_ptr_conv;
7528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7530 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7535 LDKClosingSigned this_ptr_conv;
7536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7538 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7542 LDKClosingSigned this_ptr_conv;
7543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7545 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7546 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
7550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7551 LDKClosingSigned 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 LDKSignature val_ref;
7555 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7556 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7557 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
7560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jbyteArray signature_arg) {
7561 LDKThirtyTwoBytes channel_id_arg_ref;
7562 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7563 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7564 LDKSignature signature_arg_ref;
7565 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7566 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7567 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
7568 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7572 LDKUpdateAddHTLC this_ptr_conv;
7573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7575 UpdateAddHTLC_free(this_ptr_conv);
7578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7579 LDKUpdateAddHTLC orig_conv;
7580 orig_conv.inner = (void*)(orig & (~1));
7581 orig_conv.is_owned = (orig & 1) || (orig == 0);
7582 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7583 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7586 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7587 LDKUpdateAddHTLC this_ptr_conv;
7588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7590 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7591 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7596 LDKUpdateAddHTLC this_ptr_conv;
7597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7599 LDKThirtyTwoBytes val_ref;
7600 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7601 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7602 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7606 LDKUpdateAddHTLC this_ptr_conv;
7607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7609 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7614 LDKUpdateAddHTLC this_ptr_conv;
7615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7617 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7621 LDKUpdateAddHTLC this_ptr_conv;
7622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7624 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7629 LDKUpdateAddHTLC this_ptr_conv;
7630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7632 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7636 LDKUpdateAddHTLC this_ptr_conv;
7637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7639 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7640 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7645 LDKUpdateAddHTLC this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7648 LDKThirtyTwoBytes val_ref;
7649 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7650 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7651 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7654 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7655 LDKUpdateAddHTLC this_ptr_conv;
7656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7658 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7663 LDKUpdateAddHTLC this_ptr_conv;
7664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7666 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7670 LDKUpdateFulfillHTLC this_ptr_conv;
7671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7672 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7673 UpdateFulfillHTLC_free(this_ptr_conv);
7676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7677 LDKUpdateFulfillHTLC orig_conv;
7678 orig_conv.inner = (void*)(orig & (~1));
7679 orig_conv.is_owned = (orig & 1) || (orig == 0);
7680 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7681 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7684 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7685 LDKUpdateFulfillHTLC this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7688 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7689 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7694 LDKUpdateFulfillHTLC this_ptr_conv;
7695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7697 LDKThirtyTwoBytes val_ref;
7698 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7699 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7700 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7704 LDKUpdateFulfillHTLC this_ptr_conv;
7705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7707 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7712 LDKUpdateFulfillHTLC this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7718 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7719 LDKUpdateFulfillHTLC this_ptr_conv;
7720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7722 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7723 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7728 LDKUpdateFulfillHTLC this_ptr_conv;
7729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7731 LDKThirtyTwoBytes val_ref;
7732 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7733 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7734 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7737 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) {
7738 LDKThirtyTwoBytes channel_id_arg_ref;
7739 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7740 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7741 LDKThirtyTwoBytes payment_preimage_arg_ref;
7742 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
7743 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7744 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7745 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7749 LDKUpdateFailHTLC 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 UpdateFailHTLC_free(this_ptr_conv);
7755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7756 LDKUpdateFailHTLC orig_conv;
7757 orig_conv.inner = (void*)(orig & (~1));
7758 orig_conv.is_owned = (orig & 1) || (orig == 0);
7759 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7760 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7763 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7764 LDKUpdateFailHTLC this_ptr_conv;
7765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7767 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7768 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7773 LDKUpdateFailHTLC this_ptr_conv;
7774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7776 LDKThirtyTwoBytes val_ref;
7777 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7778 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7779 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7783 LDKUpdateFailHTLC this_ptr_conv;
7784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7786 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7791 LDKUpdateFailHTLC this_ptr_conv;
7792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7794 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7798 LDKUpdateFailMalformedHTLC this_ptr_conv;
7799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7801 UpdateFailMalformedHTLC_free(this_ptr_conv);
7804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7805 LDKUpdateFailMalformedHTLC orig_conv;
7806 orig_conv.inner = (void*)(orig & (~1));
7807 orig_conv.is_owned = (orig & 1) || (orig == 0);
7808 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7809 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7813 LDKUpdateFailMalformedHTLC this_ptr_conv;
7814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7816 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7817 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7822 LDKUpdateFailMalformedHTLC this_ptr_conv;
7823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7825 LDKThirtyTwoBytes val_ref;
7826 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7827 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7828 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7832 LDKUpdateFailMalformedHTLC this_ptr_conv;
7833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7835 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7840 LDKUpdateFailMalformedHTLC this_ptr_conv;
7841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7843 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7846 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7847 LDKUpdateFailMalformedHTLC this_ptr_conv;
7848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7850 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7855 LDKUpdateFailMalformedHTLC this_ptr_conv;
7856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7858 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7862 LDKCommitmentSigned this_ptr_conv;
7863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7865 CommitmentSigned_free(this_ptr_conv);
7868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7869 LDKCommitmentSigned orig_conv;
7870 orig_conv.inner = (void*)(orig & (~1));
7871 orig_conv.is_owned = (orig & 1) || (orig == 0);
7872 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7873 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7876 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7877 LDKCommitmentSigned 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7881 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7886 LDKCommitmentSigned this_ptr_conv;
7887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7889 LDKThirtyTwoBytes val_ref;
7890 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7891 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7892 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7895 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7896 LDKCommitmentSigned this_ptr_conv;
7897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
7904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7905 LDKCommitmentSigned this_ptr_conv;
7906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7908 LDKSignature val_ref;
7909 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7910 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7911 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
7914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7915 LDKCommitmentSigned 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 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7920 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg, jlong htlc_signatures_arg) {
7924 LDKThirtyTwoBytes channel_id_arg_ref;
7925 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7926 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7927 LDKSignature signature_arg_ref;
7928 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7929 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7930 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7931 FREE((void*)htlc_signatures_arg);
7932 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_conv);
7933 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7937 LDKRevokeAndACK this_ptr_conv;
7938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7940 RevokeAndACK_free(this_ptr_conv);
7943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7944 LDKRevokeAndACK orig_conv;
7945 orig_conv.inner = (void*)(orig & (~1));
7946 orig_conv.is_owned = (orig & 1) || (orig == 0);
7947 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7948 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7951 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7952 LDKRevokeAndACK this_ptr_conv;
7953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7955 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7956 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7961 LDKRevokeAndACK this_ptr_conv;
7962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7964 LDKThirtyTwoBytes val_ref;
7965 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7966 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7967 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7970 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7971 LDKRevokeAndACK this_ptr_conv;
7972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7974 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7975 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7980 LDKRevokeAndACK this_ptr_conv;
7981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7983 LDKThirtyTwoBytes val_ref;
7984 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7985 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7986 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7989 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7990 LDKRevokeAndACK this_ptr_conv;
7991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7993 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7994 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7999 LDKRevokeAndACK this_ptr_conv;
8000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8002 LDKPublicKey val_ref;
8003 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8004 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8005 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8008 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) {
8009 LDKThirtyTwoBytes channel_id_arg_ref;
8010 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8011 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8012 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8013 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8014 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8015 LDKPublicKey next_per_commitment_point_arg_ref;
8016 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8017 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8018 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8019 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8023 LDKUpdateFee this_ptr_conv;
8024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8026 UpdateFee_free(this_ptr_conv);
8029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8030 LDKUpdateFee orig_conv;
8031 orig_conv.inner = (void*)(orig & (~1));
8032 orig_conv.is_owned = (orig & 1) || (orig == 0);
8033 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8037 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8038 LDKUpdateFee 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 ret_arr = (*_env)->NewByteArray(_env, 32);
8042 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8047 LDKUpdateFee 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 LDKThirtyTwoBytes val_ref;
8051 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8052 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8053 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8056 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8057 LDKUpdateFee this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8060 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8065 LDKUpdateFee 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 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8072 LDKThirtyTwoBytes channel_id_arg_ref;
8073 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8074 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8075 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8076 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8080 LDKDataLossProtect this_ptr_conv;
8081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8083 DataLossProtect_free(this_ptr_conv);
8086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8087 LDKDataLossProtect orig_conv;
8088 orig_conv.inner = (void*)(orig & (~1));
8089 orig_conv.is_owned = (orig & 1) || (orig == 0);
8090 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8091 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8094 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8095 LDKDataLossProtect this_ptr_conv;
8096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8098 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8099 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8104 LDKDataLossProtect this_ptr_conv;
8105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8107 LDKThirtyTwoBytes val_ref;
8108 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8109 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8110 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8114 LDKDataLossProtect this_ptr_conv;
8115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8117 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8118 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8123 LDKDataLossProtect this_ptr_conv;
8124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8126 LDKPublicKey val_ref;
8127 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8128 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8129 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8132 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) {
8133 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8134 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8135 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8136 LDKPublicKey my_current_per_commitment_point_arg_ref;
8137 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8138 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8139 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8140 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8144 LDKChannelReestablish this_ptr_conv;
8145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8147 ChannelReestablish_free(this_ptr_conv);
8150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8151 LDKChannelReestablish orig_conv;
8152 orig_conv.inner = (void*)(orig & (~1));
8153 orig_conv.is_owned = (orig & 1) || (orig == 0);
8154 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8155 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8158 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8159 LDKChannelReestablish this_ptr_conv;
8160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8162 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8163 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8168 LDKChannelReestablish this_ptr_conv;
8169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8171 LDKThirtyTwoBytes val_ref;
8172 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8173 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8174 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8178 LDKChannelReestablish this_ptr_conv;
8179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8181 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8186 LDKChannelReestablish this_ptr_conv;
8187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8189 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8193 LDKChannelReestablish this_ptr_conv;
8194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8196 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8201 LDKChannelReestablish this_ptr_conv;
8202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8204 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8208 LDKAnnouncementSignatures 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 AnnouncementSignatures_free(this_ptr_conv);
8214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8215 LDKAnnouncementSignatures orig_conv;
8216 orig_conv.inner = (void*)(orig & (~1));
8217 orig_conv.is_owned = (orig & 1) || (orig == 0);
8218 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8219 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8222 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8223 LDKAnnouncementSignatures this_ptr_conv;
8224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8225 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8226 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8227 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8232 LDKAnnouncementSignatures this_ptr_conv;
8233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8235 LDKThirtyTwoBytes val_ref;
8236 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8237 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8238 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8242 LDKAnnouncementSignatures this_ptr_conv;
8243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8245 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8250 LDKAnnouncementSignatures this_ptr_conv;
8251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8253 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8256 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8257 LDKAnnouncementSignatures this_ptr_conv;
8258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8260 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8261 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8266 LDKAnnouncementSignatures this_ptr_conv;
8267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8269 LDKSignature val_ref;
8270 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8271 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8272 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8275 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8276 LDKAnnouncementSignatures 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8280 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8285 LDKAnnouncementSignatures 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 LDKSignature val_ref;
8289 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8290 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8291 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jbyteArray node_signature_arg, jbyteArray bitcoin_signature_arg) {
8295 LDKThirtyTwoBytes channel_id_arg_ref;
8296 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8297 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8298 LDKSignature node_signature_arg_ref;
8299 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8300 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8301 LDKSignature bitcoin_signature_arg_ref;
8302 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8303 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8304 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8305 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8309 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8310 FREE((void*)this_ptr);
8311 NetAddress_free(this_ptr_conv);
8314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8315 LDKUnsignedNodeAnnouncement this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8318 UnsignedNodeAnnouncement_free(this_ptr_conv);
8321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8322 LDKUnsignedNodeAnnouncement orig_conv;
8323 orig_conv.inner = (void*)(orig & (~1));
8324 orig_conv.is_owned = (orig & 1) || (orig == 0);
8325 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
8326 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8329 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8330 LDKUnsignedNodeAnnouncement this_ptr_conv;
8331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8333 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8334 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8338 LDKUnsignedNodeAnnouncement this_ptr_conv;
8339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8341 LDKNodeFeatures val_conv;
8342 val_conv.inner = (void*)(val & (~1));
8343 val_conv.is_owned = (val & 1) || (val == 0);
8344 // Warning: we may need a move here but can't clone!
8345 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8348 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8349 LDKUnsignedNodeAnnouncement this_ptr_conv;
8350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8352 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8357 LDKUnsignedNodeAnnouncement this_ptr_conv;
8358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8360 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8363 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8364 LDKUnsignedNodeAnnouncement this_ptr_conv;
8365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8367 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8368 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8373 LDKUnsignedNodeAnnouncement this_ptr_conv;
8374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8375 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8376 LDKPublicKey val_ref;
8377 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8378 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8379 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8382 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8383 LDKUnsignedNodeAnnouncement this_ptr_conv;
8384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8386 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8387 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8392 LDKUnsignedNodeAnnouncement this_ptr_conv;
8393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8395 LDKThreeBytes val_ref;
8396 CHECK((*_env)->GetArrayLength (_env, val) == 3);
8397 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
8398 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
8401 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8402 LDKUnsignedNodeAnnouncement this_ptr_conv;
8403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8405 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8406 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8411 LDKUnsignedNodeAnnouncement this_ptr_conv;
8412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8414 LDKThirtyTwoBytes val_ref;
8415 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8416 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8417 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8421 LDKUnsignedNodeAnnouncement this_ptr_conv;
8422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8424 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8426 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8430 LDKNodeAnnouncement this_ptr_conv;
8431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8433 NodeAnnouncement_free(this_ptr_conv);
8436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8437 LDKNodeAnnouncement orig_conv;
8438 orig_conv.inner = (void*)(orig & (~1));
8439 orig_conv.is_owned = (orig & 1) || (orig == 0);
8440 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8441 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8445 LDKNodeAnnouncement this_ptr_conv;
8446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8448 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8449 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
8453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8454 LDKNodeAnnouncement this_ptr_conv;
8455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8457 LDKSignature val_ref;
8458 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8459 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8460 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
8463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8464 LDKNodeAnnouncement this_ptr_conv;
8465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8467 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8468 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8472 LDKNodeAnnouncement this_ptr_conv;
8473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8475 LDKUnsignedNodeAnnouncement val_conv;
8476 val_conv.inner = (void*)(val & (~1));
8477 val_conv.is_owned = (val & 1) || (val == 0);
8478 if (val_conv.inner != NULL)
8479 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8480 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8484 LDKSignature signature_arg_ref;
8485 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8486 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8487 LDKUnsignedNodeAnnouncement contents_arg_conv;
8488 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8489 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8490 if (contents_arg_conv.inner != NULL)
8491 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8492 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
8493 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8497 LDKUnsignedChannelAnnouncement this_ptr_conv;
8498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8500 UnsignedChannelAnnouncement_free(this_ptr_conv);
8503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8504 LDKUnsignedChannelAnnouncement orig_conv;
8505 orig_conv.inner = (void*)(orig & (~1));
8506 orig_conv.is_owned = (orig & 1) || (orig == 0);
8507 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8508 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8512 LDKUnsignedChannelAnnouncement this_ptr_conv;
8513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8515 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8516 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8520 LDKUnsignedChannelAnnouncement this_ptr_conv;
8521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8523 LDKChannelFeatures val_conv;
8524 val_conv.inner = (void*)(val & (~1));
8525 val_conv.is_owned = (val & 1) || (val == 0);
8526 // Warning: we may need a move here but can't clone!
8527 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8530 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8531 LDKUnsignedChannelAnnouncement 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8535 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8540 LDKUnsignedChannelAnnouncement this_ptr_conv;
8541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8543 LDKThirtyTwoBytes val_ref;
8544 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8545 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8546 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8550 LDKUnsignedChannelAnnouncement this_ptr_conv;
8551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8553 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8558 LDKUnsignedChannelAnnouncement this_ptr_conv;
8559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8561 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8565 LDKUnsignedChannelAnnouncement this_ptr_conv;
8566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8568 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8569 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8574 LDKUnsignedChannelAnnouncement 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 LDKPublicKey val_ref;
8578 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8579 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8580 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8584 LDKUnsignedChannelAnnouncement this_ptr_conv;
8585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8593 LDKUnsignedChannelAnnouncement this_ptr_conv;
8594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8596 LDKPublicKey val_ref;
8597 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8598 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8599 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8603 LDKUnsignedChannelAnnouncement this_ptr_conv;
8604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8606 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8607 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8612 LDKUnsignedChannelAnnouncement this_ptr_conv;
8613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8615 LDKPublicKey val_ref;
8616 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8617 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8618 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8621 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8622 LDKUnsignedChannelAnnouncement this_ptr_conv;
8623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8625 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8626 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8631 LDKUnsignedChannelAnnouncement this_ptr_conv;
8632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8634 LDKPublicKey val_ref;
8635 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8636 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8637 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8641 LDKChannelAnnouncement this_ptr_conv;
8642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8644 ChannelAnnouncement_free(this_ptr_conv);
8647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8648 LDKChannelAnnouncement orig_conv;
8649 orig_conv.inner = (void*)(orig & (~1));
8650 orig_conv.is_owned = (orig & 1) || (orig == 0);
8651 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8652 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8655 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8656 LDKChannelAnnouncement this_ptr_conv;
8657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8659 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8660 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
8664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8665 LDKChannelAnnouncement this_ptr_conv;
8666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8668 LDKSignature val_ref;
8669 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8670 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8671 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
8674 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8675 LDKChannelAnnouncement this_ptr_conv;
8676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8678 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8679 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
8683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8684 LDKChannelAnnouncement this_ptr_conv;
8685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8687 LDKSignature val_ref;
8688 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8689 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8690 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
8693 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8694 LDKChannelAnnouncement this_ptr_conv;
8695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8697 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8698 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
8702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8703 LDKChannelAnnouncement this_ptr_conv;
8704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8706 LDKSignature val_ref;
8707 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8708 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8709 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
8712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8713 LDKChannelAnnouncement this_ptr_conv;
8714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8716 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8717 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
8721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8722 LDKChannelAnnouncement this_ptr_conv;
8723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8725 LDKSignature val_ref;
8726 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8727 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8728 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
8731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8732 LDKChannelAnnouncement 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 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8740 LDKChannelAnnouncement this_ptr_conv;
8741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8743 LDKUnsignedChannelAnnouncement val_conv;
8744 val_conv.inner = (void*)(val & (~1));
8745 val_conv.is_owned = (val & 1) || (val == 0);
8746 if (val_conv.inner != NULL)
8747 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8748 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray node_signature_1_arg, jbyteArray node_signature_2_arg, jbyteArray bitcoin_signature_1_arg, jbyteArray bitcoin_signature_2_arg, jlong contents_arg) {
8752 LDKSignature node_signature_1_arg_ref;
8753 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
8754 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
8755 LDKSignature node_signature_2_arg_ref;
8756 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
8757 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
8758 LDKSignature bitcoin_signature_1_arg_ref;
8759 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
8760 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
8761 LDKSignature bitcoin_signature_2_arg_ref;
8762 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
8763 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
8764 LDKUnsignedChannelAnnouncement contents_arg_conv;
8765 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8766 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8767 if (contents_arg_conv.inner != NULL)
8768 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8769 LDKChannelAnnouncement ret = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
8770 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8774 LDKUnsignedChannelUpdate this_ptr_conv;
8775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8777 UnsignedChannelUpdate_free(this_ptr_conv);
8780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8781 LDKUnsignedChannelUpdate orig_conv;
8782 orig_conv.inner = (void*)(orig & (~1));
8783 orig_conv.is_owned = (orig & 1) || (orig == 0);
8784 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8785 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8789 LDKUnsignedChannelUpdate this_ptr_conv;
8790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8792 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8793 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8798 LDKUnsignedChannelUpdate this_ptr_conv;
8799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8801 LDKThirtyTwoBytes val_ref;
8802 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8803 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8804 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8808 LDKUnsignedChannelUpdate this_ptr_conv;
8809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8811 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8816 LDKUnsignedChannelUpdate this_ptr_conv;
8817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8819 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8822 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8823 LDKUnsignedChannelUpdate this_ptr_conv;
8824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8826 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8831 LDKUnsignedChannelUpdate this_ptr_conv;
8832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8834 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8837 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8838 LDKUnsignedChannelUpdate this_ptr_conv;
8839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8841 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8846 LDKUnsignedChannelUpdate this_ptr_conv;
8847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8849 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8852 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8853 LDKUnsignedChannelUpdate this_ptr_conv;
8854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8856 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8861 LDKUnsignedChannelUpdate this_ptr_conv;
8862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8864 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8868 LDKUnsignedChannelUpdate this_ptr_conv;
8869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8871 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8876 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8882 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8883 LDKUnsignedChannelUpdate this_ptr_conv;
8884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8886 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8891 LDKUnsignedChannelUpdate this_ptr_conv;
8892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8894 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8897 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8898 LDKUnsignedChannelUpdate this_ptr_conv;
8899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8901 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8906 LDKUnsignedChannelUpdate this_ptr_conv;
8907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8909 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8913 LDKChannelUpdate this_ptr_conv;
8914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8916 ChannelUpdate_free(this_ptr_conv);
8919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8920 LDKChannelUpdate orig_conv;
8921 orig_conv.inner = (void*)(orig & (~1));
8922 orig_conv.is_owned = (orig & 1) || (orig == 0);
8923 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8924 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8927 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8928 LDKChannelUpdate this_ptr_conv;
8929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8931 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8932 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
8936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8937 LDKChannelUpdate 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 LDKSignature val_ref;
8941 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8942 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8943 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
8946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8947 LDKChannelUpdate this_ptr_conv;
8948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8950 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8951 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8955 LDKChannelUpdate this_ptr_conv;
8956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8958 LDKUnsignedChannelUpdate val_conv;
8959 val_conv.inner = (void*)(val & (~1));
8960 val_conv.is_owned = (val & 1) || (val == 0);
8961 if (val_conv.inner != NULL)
8962 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8963 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8967 LDKSignature signature_arg_ref;
8968 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8969 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8970 LDKUnsignedChannelUpdate contents_arg_conv;
8971 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8972 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8973 if (contents_arg_conv.inner != NULL)
8974 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
8975 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
8976 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8980 LDKQueryChannelRange 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 QueryChannelRange_free(this_ptr_conv);
8986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8987 LDKQueryChannelRange orig_conv;
8988 orig_conv.inner = (void*)(orig & (~1));
8989 orig_conv.is_owned = (orig & 1) || (orig == 0);
8990 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
8991 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8995 LDKQueryChannelRange this_ptr_conv;
8996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8997 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8998 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8999 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9004 LDKQueryChannelRange this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9007 LDKThirtyTwoBytes val_ref;
9008 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9009 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9010 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9013 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9014 LDKQueryChannelRange this_ptr_conv;
9015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9017 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9022 LDKQueryChannelRange this_ptr_conv;
9023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9025 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9028 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9029 LDKQueryChannelRange this_ptr_conv;
9030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9032 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9037 LDKQueryChannelRange this_ptr_conv;
9038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9040 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9043 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) {
9044 LDKThirtyTwoBytes chain_hash_arg_ref;
9045 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9046 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9047 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9048 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9052 LDKReplyChannelRange this_ptr_conv;
9053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9055 ReplyChannelRange_free(this_ptr_conv);
9058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9059 LDKReplyChannelRange orig_conv;
9060 orig_conv.inner = (void*)(orig & (~1));
9061 orig_conv.is_owned = (orig & 1) || (orig == 0);
9062 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9063 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9066 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9067 LDKReplyChannelRange 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9071 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9076 LDKReplyChannelRange this_ptr_conv;
9077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9079 LDKThirtyTwoBytes val_ref;
9080 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9081 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9082 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9085 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9086 LDKReplyChannelRange this_ptr_conv;
9087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9089 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9094 LDKReplyChannelRange this_ptr_conv;
9095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9097 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9100 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9101 LDKReplyChannelRange this_ptr_conv;
9102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9104 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9109 LDKReplyChannelRange this_ptr_conv;
9110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9112 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9116 LDKReplyChannelRange this_ptr_conv;
9117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9119 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9124 LDKReplyChannelRange this_ptr_conv;
9125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9127 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9131 LDKReplyChannelRange this_ptr_conv;
9132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9134 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9136 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
9139 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) {
9140 LDKThirtyTwoBytes chain_hash_arg_ref;
9141 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9142 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9143 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9144 FREE((void*)short_channel_ids_arg);
9145 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
9146 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9150 LDKQueryShortChannelIds this_ptr_conv;
9151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9153 QueryShortChannelIds_free(this_ptr_conv);
9156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9157 LDKQueryShortChannelIds orig_conv;
9158 orig_conv.inner = (void*)(orig & (~1));
9159 orig_conv.is_owned = (orig & 1) || (orig == 0);
9160 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9161 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9164 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9165 LDKQueryShortChannelIds this_ptr_conv;
9166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9168 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9169 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9174 LDKQueryShortChannelIds this_ptr_conv;
9175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9177 LDKThirtyTwoBytes val_ref;
9178 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9179 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9180 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9184 LDKQueryShortChannelIds this_ptr_conv;
9185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9187 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9189 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
9192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
9193 LDKThirtyTwoBytes chain_hash_arg_ref;
9194 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9195 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9196 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9197 FREE((void*)short_channel_ids_arg);
9198 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
9199 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9203 LDKReplyShortChannelIdsEnd this_ptr_conv;
9204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9206 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9210 LDKReplyShortChannelIdsEnd orig_conv;
9211 orig_conv.inner = (void*)(orig & (~1));
9212 orig_conv.is_owned = (orig & 1) || (orig == 0);
9213 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9214 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9217 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9218 LDKReplyShortChannelIdsEnd this_ptr_conv;
9219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9221 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9222 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9227 LDKReplyShortChannelIdsEnd this_ptr_conv;
9228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9230 LDKThirtyTwoBytes val_ref;
9231 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9232 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9233 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9237 LDKReplyShortChannelIdsEnd this_ptr_conv;
9238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9240 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9245 LDKReplyShortChannelIdsEnd this_ptr_conv;
9246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9248 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9251 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9252 LDKThirtyTwoBytes chain_hash_arg_ref;
9253 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9254 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9255 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
9256 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9260 LDKGossipTimestampFilter this_ptr_conv;
9261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9263 GossipTimestampFilter_free(this_ptr_conv);
9266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9267 LDKGossipTimestampFilter orig_conv;
9268 orig_conv.inner = (void*)(orig & (~1));
9269 orig_conv.is_owned = (orig & 1) || (orig == 0);
9270 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
9271 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9274 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9275 LDKGossipTimestampFilter this_ptr_conv;
9276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9278 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9279 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
9283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9284 LDKGossipTimestampFilter this_ptr_conv;
9285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9287 LDKThirtyTwoBytes val_ref;
9288 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9289 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9290 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
9293 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9294 LDKGossipTimestampFilter this_ptr_conv;
9295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9297 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
9301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9302 LDKGossipTimestampFilter this_ptr_conv;
9303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9305 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
9308 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
9309 LDKGossipTimestampFilter this_ptr_conv;
9310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9312 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
9316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9317 LDKGossipTimestampFilter this_ptr_conv;
9318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9320 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
9323 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) {
9324 LDKThirtyTwoBytes chain_hash_arg_ref;
9325 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9326 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9327 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
9328 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9332 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
9333 FREE((void*)this_ptr);
9334 ErrorAction_free(this_ptr_conv);
9337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9338 LDKLightningError this_ptr_conv;
9339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9341 LightningError_free(this_ptr_conv);
9344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
9345 LDKLightningError this_ptr_conv;
9346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9348 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
9349 *ret = LightningError_get_err(&this_ptr_conv);
9353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9354 LDKLightningError this_ptr_conv;
9355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9357 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
9359 LightningError_set_err(&this_ptr_conv, val_conv);
9362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
9363 LDKLightningError this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9366 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
9367 *ret = LightningError_get_action(&this_ptr_conv);
9371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9372 LDKLightningError this_ptr_conv;
9373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9375 LDKErrorAction val_conv = *(LDKErrorAction*)val;
9377 LightningError_set_action(&this_ptr_conv, val_conv);
9380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
9381 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
9382 FREE((void*)err_arg);
9383 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9384 FREE((void*)action_arg);
9385 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
9386 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9390 LDKCommitmentUpdate this_ptr_conv;
9391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9393 CommitmentUpdate_free(this_ptr_conv);
9396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9397 LDKCommitmentUpdate orig_conv;
9398 orig_conv.inner = (void*)(orig & (~1));
9399 orig_conv.is_owned = (orig & 1) || (orig == 0);
9400 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9401 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9405 LDKCommitmentUpdate this_ptr_conv;
9406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9408 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9410 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9414 LDKCommitmentUpdate this_ptr_conv;
9415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9417 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9419 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9423 LDKCommitmentUpdate this_ptr_conv;
9424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9426 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9428 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9432 LDKCommitmentUpdate this_ptr_conv;
9433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9435 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9437 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9441 LDKCommitmentUpdate this_ptr_conv;
9442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9444 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9445 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9449 LDKCommitmentUpdate this_ptr_conv;
9450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9452 LDKUpdateFee val_conv;
9453 val_conv.inner = (void*)(val & (~1));
9454 val_conv.is_owned = (val & 1) || (val == 0);
9455 if (val_conv.inner != NULL)
9456 val_conv = UpdateFee_clone(&val_conv);
9457 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9461 LDKCommitmentUpdate this_ptr_conv;
9462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9464 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9465 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9469 LDKCommitmentUpdate this_ptr_conv;
9470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9472 LDKCommitmentSigned val_conv;
9473 val_conv.inner = (void*)(val & (~1));
9474 val_conv.is_owned = (val & 1) || (val == 0);
9475 if (val_conv.inner != NULL)
9476 val_conv = CommitmentSigned_clone(&val_conv);
9477 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9480 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) {
9481 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9482 FREE((void*)update_add_htlcs_arg);
9483 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9484 FREE((void*)update_fulfill_htlcs_arg);
9485 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9486 FREE((void*)update_fail_htlcs_arg);
9487 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9488 FREE((void*)update_fail_malformed_htlcs_arg);
9489 LDKUpdateFee update_fee_arg_conv;
9490 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9491 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9492 if (update_fee_arg_conv.inner != NULL)
9493 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9494 LDKCommitmentSigned commitment_signed_arg_conv;
9495 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9496 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9497 if (commitment_signed_arg_conv.inner != NULL)
9498 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9499 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);
9500 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9504 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9505 FREE((void*)this_ptr);
9506 HTLCFailChannelUpdate_free(this_ptr_conv);
9509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9510 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9511 FREE((void*)this_ptr);
9512 ChannelMessageHandler_free(this_ptr_conv);
9515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9516 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9517 FREE((void*)this_ptr);
9518 RoutingMessageHandler_free(this_ptr_conv);
9521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9522 LDKAcceptChannel obj_conv;
9523 obj_conv.inner = (void*)(obj & (~1));
9524 obj_conv.is_owned = (obj & 1) || (obj == 0);
9525 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9526 *ret = AcceptChannel_write(&obj_conv);
9530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9532 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9533 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9534 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
9535 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9536 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9540 LDKAnnouncementSignatures obj_conv;
9541 obj_conv.inner = (void*)(obj & (~1));
9542 obj_conv.is_owned = (obj & 1) || (obj == 0);
9543 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9544 *ret = AnnouncementSignatures_write(&obj_conv);
9548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9550 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9551 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9552 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
9553 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9554 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9558 LDKChannelReestablish obj_conv;
9559 obj_conv.inner = (void*)(obj & (~1));
9560 obj_conv.is_owned = (obj & 1) || (obj == 0);
9561 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9562 *ret = ChannelReestablish_write(&obj_conv);
9566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9568 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9569 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9570 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
9571 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9572 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9576 LDKClosingSigned obj_conv;
9577 obj_conv.inner = (void*)(obj & (~1));
9578 obj_conv.is_owned = (obj & 1) || (obj == 0);
9579 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9580 *ret = ClosingSigned_write(&obj_conv);
9584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9586 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9587 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9588 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
9589 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9590 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9594 LDKCommitmentSigned obj_conv;
9595 obj_conv.inner = (void*)(obj & (~1));
9596 obj_conv.is_owned = (obj & 1) || (obj == 0);
9597 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9598 *ret = CommitmentSigned_write(&obj_conv);
9602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9604 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9605 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9606 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
9607 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9608 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9612 LDKFundingCreated obj_conv;
9613 obj_conv.inner = (void*)(obj & (~1));
9614 obj_conv.is_owned = (obj & 1) || (obj == 0);
9615 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9616 *ret = FundingCreated_write(&obj_conv);
9620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9622 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9623 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9624 LDKFundingCreated ret = FundingCreated_read(ser_ref);
9625 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9626 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9630 LDKFundingSigned obj_conv;
9631 obj_conv.inner = (void*)(obj & (~1));
9632 obj_conv.is_owned = (obj & 1) || (obj == 0);
9633 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9634 *ret = FundingSigned_write(&obj_conv);
9638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9640 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9641 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9642 LDKFundingSigned ret = FundingSigned_read(ser_ref);
9643 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9644 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9648 LDKFundingLocked obj_conv;
9649 obj_conv.inner = (void*)(obj & (~1));
9650 obj_conv.is_owned = (obj & 1) || (obj == 0);
9651 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9652 *ret = FundingLocked_write(&obj_conv);
9656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9658 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9659 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9660 LDKFundingLocked ret = FundingLocked_read(ser_ref);
9661 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9662 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9667 obj_conv.inner = (void*)(obj & (~1));
9668 obj_conv.is_owned = (obj & 1) || (obj == 0);
9669 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9670 *ret = Init_write(&obj_conv);
9674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9676 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9677 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9678 LDKInit ret = Init_read(ser_ref);
9679 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9680 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9684 LDKOpenChannel obj_conv;
9685 obj_conv.inner = (void*)(obj & (~1));
9686 obj_conv.is_owned = (obj & 1) || (obj == 0);
9687 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9688 *ret = OpenChannel_write(&obj_conv);
9692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9694 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9695 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9696 LDKOpenChannel ret = OpenChannel_read(ser_ref);
9697 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9702 LDKRevokeAndACK obj_conv;
9703 obj_conv.inner = (void*)(obj & (~1));
9704 obj_conv.is_owned = (obj & 1) || (obj == 0);
9705 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9706 *ret = RevokeAndACK_write(&obj_conv);
9710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9712 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9713 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9714 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
9715 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9716 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9720 LDKShutdown obj_conv;
9721 obj_conv.inner = (void*)(obj & (~1));
9722 obj_conv.is_owned = (obj & 1) || (obj == 0);
9723 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9724 *ret = Shutdown_write(&obj_conv);
9728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9730 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9731 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9732 LDKShutdown ret = Shutdown_read(ser_ref);
9733 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9734 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9738 LDKUpdateFailHTLC obj_conv;
9739 obj_conv.inner = (void*)(obj & (~1));
9740 obj_conv.is_owned = (obj & 1) || (obj == 0);
9741 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9742 *ret = UpdateFailHTLC_write(&obj_conv);
9746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9748 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9749 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9750 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
9751 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9752 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9756 LDKUpdateFailMalformedHTLC obj_conv;
9757 obj_conv.inner = (void*)(obj & (~1));
9758 obj_conv.is_owned = (obj & 1) || (obj == 0);
9759 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9760 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
9764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9766 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9767 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9768 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
9769 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9770 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9774 LDKUpdateFee obj_conv;
9775 obj_conv.inner = (void*)(obj & (~1));
9776 obj_conv.is_owned = (obj & 1) || (obj == 0);
9777 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9778 *ret = UpdateFee_write(&obj_conv);
9782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9784 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9785 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9786 LDKUpdateFee ret = UpdateFee_read(ser_ref);
9787 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9788 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9792 LDKUpdateFulfillHTLC obj_conv;
9793 obj_conv.inner = (void*)(obj & (~1));
9794 obj_conv.is_owned = (obj & 1) || (obj == 0);
9795 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9796 *ret = UpdateFulfillHTLC_write(&obj_conv);
9800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9802 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9803 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9804 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
9805 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9806 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9810 LDKUpdateAddHTLC obj_conv;
9811 obj_conv.inner = (void*)(obj & (~1));
9812 obj_conv.is_owned = (obj & 1) || (obj == 0);
9813 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9814 *ret = UpdateAddHTLC_write(&obj_conv);
9818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9820 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9821 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9822 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
9823 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9824 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9829 obj_conv.inner = (void*)(obj & (~1));
9830 obj_conv.is_owned = (obj & 1) || (obj == 0);
9831 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9832 *ret = Ping_write(&obj_conv);
9836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9838 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9839 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9840 LDKPing ret = Ping_read(ser_ref);
9841 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9842 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9847 obj_conv.inner = (void*)(obj & (~1));
9848 obj_conv.is_owned = (obj & 1) || (obj == 0);
9849 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9850 *ret = Pong_write(&obj_conv);
9854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9856 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9857 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9858 LDKPong ret = Pong_read(ser_ref);
9859 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9860 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9864 LDKUnsignedChannelAnnouncement obj_conv;
9865 obj_conv.inner = (void*)(obj & (~1));
9866 obj_conv.is_owned = (obj & 1) || (obj == 0);
9867 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9868 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9874 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9875 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9876 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
9877 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9878 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9882 LDKChannelAnnouncement obj_conv;
9883 obj_conv.inner = (void*)(obj & (~1));
9884 obj_conv.is_owned = (obj & 1) || (obj == 0);
9885 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9886 *ret = ChannelAnnouncement_write(&obj_conv);
9890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9892 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9893 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9894 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
9895 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9896 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9900 LDKUnsignedChannelUpdate obj_conv;
9901 obj_conv.inner = (void*)(obj & (~1));
9902 obj_conv.is_owned = (obj & 1) || (obj == 0);
9903 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9904 *ret = UnsignedChannelUpdate_write(&obj_conv);
9908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9910 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9911 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9912 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
9913 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9914 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9918 LDKChannelUpdate obj_conv;
9919 obj_conv.inner = (void*)(obj & (~1));
9920 obj_conv.is_owned = (obj & 1) || (obj == 0);
9921 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9922 *ret = ChannelUpdate_write(&obj_conv);
9926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9928 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9929 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9930 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
9931 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9932 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9936 LDKErrorMessage obj_conv;
9937 obj_conv.inner = (void*)(obj & (~1));
9938 obj_conv.is_owned = (obj & 1) || (obj == 0);
9939 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9940 *ret = ErrorMessage_write(&obj_conv);
9944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9946 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9947 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9948 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
9949 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9954 LDKUnsignedNodeAnnouncement obj_conv;
9955 obj_conv.inner = (void*)(obj & (~1));
9956 obj_conv.is_owned = (obj & 1) || (obj == 0);
9957 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9958 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9964 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9965 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9966 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
9967 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9968 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9972 LDKNodeAnnouncement obj_conv;
9973 obj_conv.inner = (void*)(obj & (~1));
9974 obj_conv.is_owned = (obj & 1) || (obj == 0);
9975 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9976 *ret = NodeAnnouncement_write(&obj_conv);
9980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9982 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9983 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9984 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
9985 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9986 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9991 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9992 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9993 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
9994 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9995 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9999 LDKQueryShortChannelIds obj_conv;
10000 obj_conv.inner = (void*)(obj & (~1));
10001 obj_conv.is_owned = (obj & 1) || (obj == 0);
10002 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10003 *ret = QueryShortChannelIds_write(&obj_conv);
10007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10008 LDKu8slice ser_ref;
10009 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10010 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10011 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10012 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10013 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10017 LDKReplyShortChannelIdsEnd obj_conv;
10018 obj_conv.inner = (void*)(obj & (~1));
10019 obj_conv.is_owned = (obj & 1) || (obj == 0);
10020 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10021 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
10025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10026 LDKu8slice ser_ref;
10027 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10028 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10029 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
10030 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10031 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10035 LDKQueryChannelRange obj_conv;
10036 obj_conv.inner = (void*)(obj & (~1));
10037 obj_conv.is_owned = (obj & 1) || (obj == 0);
10038 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10039 *ret = QueryChannelRange_write(&obj_conv);
10043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10044 LDKu8slice ser_ref;
10045 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10046 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10047 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
10048 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10049 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10053 LDKReplyChannelRange obj_conv;
10054 obj_conv.inner = (void*)(obj & (~1));
10055 obj_conv.is_owned = (obj & 1) || (obj == 0);
10056 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10057 *ret = ReplyChannelRange_write(&obj_conv);
10061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10062 LDKu8slice ser_ref;
10063 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10064 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10065 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
10066 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10067 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
10071 LDKGossipTimestampFilter obj_conv;
10072 obj_conv.inner = (void*)(obj & (~1));
10073 obj_conv.is_owned = (obj & 1) || (obj == 0);
10074 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10075 *ret = GossipTimestampFilter_write(&obj_conv);
10079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10080 LDKMessageHandler this_ptr_conv;
10081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10083 MessageHandler_free(this_ptr_conv);
10086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10087 LDKMessageHandler this_ptr_conv;
10088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10090 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
10094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10095 LDKMessageHandler 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 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
10099 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
10100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10101 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
10103 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
10106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10107 LDKMessageHandler this_ptr_conv;
10108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10110 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
10114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10115 LDKMessageHandler this_ptr_conv;
10116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10118 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
10119 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10120 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10121 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
10123 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
10126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
10127 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
10128 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
10129 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10130 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
10132 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
10133 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10134 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10135 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
10137 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
10138 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10142 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
10143 FREE((void*)this_ptr);
10144 SocketDescriptor_free(this_ptr_conv);
10147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10148 LDKPeerHandleError this_ptr_conv;
10149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10151 PeerHandleError_free(this_ptr_conv);
10154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
10155 LDKPeerHandleError this_ptr_conv;
10156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10158 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
10162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10163 LDKPeerHandleError this_ptr_conv;
10164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10166 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
10169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
10170 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
10171 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10175 LDKPeerManager this_ptr_conv;
10176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10178 PeerManager_free(this_ptr_conv);
10181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jbyteArray our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
10182 LDKMessageHandler message_handler_conv;
10183 message_handler_conv.inner = (void*)(message_handler & (~1));
10184 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
10185 // Warning: we may need a move here but can't clone!
10186 LDKSecretKey our_node_secret_ref;
10187 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
10188 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
10189 unsigned char ephemeral_random_data_arr[32];
10190 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
10191 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
10192 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
10193 LDKLogger logger_conv = *(LDKLogger*)logger;
10194 if (logger_conv.free == LDKLogger_JCalls_free) {
10195 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10196 LDKLogger_JCalls_clone(logger_conv.this_arg);
10198 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
10199 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
10203 LDKPeerManager this_arg_conv;
10204 this_arg_conv.inner = (void*)(this_arg & (~1));
10205 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10206 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
10207 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
10211 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) {
10212 LDKPeerManager this_arg_conv;
10213 this_arg_conv.inner = (void*)(this_arg & (~1));
10214 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10215 LDKPublicKey their_node_id_ref;
10216 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
10217 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10218 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10219 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10220 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10221 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10223 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10224 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
10228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10229 LDKPeerManager this_arg_conv;
10230 this_arg_conv.inner = (void*)(this_arg & (~1));
10231 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10232 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10233 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10234 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10235 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10237 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10238 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
10242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10243 LDKPeerManager this_arg_conv;
10244 this_arg_conv.inner = (void*)(this_arg & (~1));
10245 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10246 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10247 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10248 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
10252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
10253 LDKPeerManager this_arg_conv;
10254 this_arg_conv.inner = (void*)(this_arg & (~1));
10255 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10256 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
10257 LDKu8slice data_ref;
10258 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
10259 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
10260 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10261 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
10262 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
10266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
10267 LDKPeerManager this_arg_conv;
10268 this_arg_conv.inner = (void*)(this_arg & (~1));
10269 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10270 PeerManager_process_events(&this_arg_conv);
10273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10274 LDKPeerManager this_arg_conv;
10275 this_arg_conv.inner = (void*)(this_arg & (~1));
10276 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10277 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10278 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
10281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
10282 LDKPeerManager this_arg_conv;
10283 this_arg_conv.inner = (void*)(this_arg & (~1));
10284 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10285 PeerManager_timer_tick_occured(&this_arg_conv);
10288 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
10289 unsigned char commitment_seed_arr[32];
10290 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
10291 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
10292 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
10293 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10294 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
10298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
10299 LDKPublicKey per_commitment_point_ref;
10300 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10301 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10302 unsigned char base_secret_arr[32];
10303 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
10304 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
10305 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
10306 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10307 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
10311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
10312 LDKPublicKey per_commitment_point_ref;
10313 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10314 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10315 LDKPublicKey base_point_ref;
10316 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
10317 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
10318 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10319 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
10323 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) {
10324 unsigned char per_commitment_secret_arr[32];
10325 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
10326 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
10327 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
10328 unsigned char countersignatory_revocation_base_secret_arr[32];
10329 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
10330 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
10331 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
10332 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10333 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
10337 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) {
10338 LDKPublicKey per_commitment_point_ref;
10339 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10340 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10341 LDKPublicKey countersignatory_revocation_base_point_ref;
10342 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
10343 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
10344 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10345 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
10349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10350 LDKTxCreationKeys this_ptr_conv;
10351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10353 TxCreationKeys_free(this_ptr_conv);
10356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10357 LDKTxCreationKeys orig_conv;
10358 orig_conv.inner = (void*)(orig & (~1));
10359 orig_conv.is_owned = (orig & 1) || (orig == 0);
10360 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
10361 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10364 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10365 LDKTxCreationKeys this_ptr_conv;
10366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10368 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10369 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
10373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10374 LDKTxCreationKeys this_ptr_conv;
10375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10377 LDKPublicKey val_ref;
10378 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10379 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10380 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
10383 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10384 LDKTxCreationKeys this_ptr_conv;
10385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10387 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10388 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
10392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10393 LDKTxCreationKeys this_ptr_conv;
10394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10396 LDKPublicKey val_ref;
10397 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10398 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10399 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
10402 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10403 LDKTxCreationKeys this_ptr_conv;
10404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10406 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10407 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
10411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10412 LDKTxCreationKeys this_ptr_conv;
10413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10415 LDKPublicKey val_ref;
10416 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10417 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10418 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
10421 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10422 LDKTxCreationKeys this_ptr_conv;
10423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10425 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10426 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
10430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10431 LDKTxCreationKeys this_ptr_conv;
10432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10434 LDKPublicKey val_ref;
10435 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10436 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10437 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
10440 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10441 LDKTxCreationKeys this_ptr_conv;
10442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10444 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10445 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
10449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10450 LDKTxCreationKeys this_ptr_conv;
10451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10453 LDKPublicKey val_ref;
10454 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10455 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10456 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
10459 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) {
10460 LDKPublicKey per_commitment_point_arg_ref;
10461 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
10462 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
10463 LDKPublicKey revocation_key_arg_ref;
10464 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
10465 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
10466 LDKPublicKey broadcaster_htlc_key_arg_ref;
10467 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
10468 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
10469 LDKPublicKey countersignatory_htlc_key_arg_ref;
10470 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
10471 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
10472 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
10473 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
10474 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
10475 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);
10476 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10480 LDKTxCreationKeys obj_conv;
10481 obj_conv.inner = (void*)(obj & (~1));
10482 obj_conv.is_owned = (obj & 1) || (obj == 0);
10483 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10484 *ret = TxCreationKeys_write(&obj_conv);
10488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10489 LDKu8slice ser_ref;
10490 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10491 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10492 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
10493 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10494 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10498 LDKPreCalculatedTxCreationKeys this_ptr_conv;
10499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10501 PreCalculatedTxCreationKeys_free(this_ptr_conv);
10504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10505 LDKTxCreationKeys keys_conv;
10506 keys_conv.inner = (void*)(keys & (~1));
10507 keys_conv.is_owned = (keys & 1) || (keys == 0);
10508 if (keys_conv.inner != NULL)
10509 keys_conv = TxCreationKeys_clone(&keys_conv);
10510 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10511 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10515 LDKPreCalculatedTxCreationKeys this_arg_conv;
10516 this_arg_conv.inner = (void*)(this_arg & (~1));
10517 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10518 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10519 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10522 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10523 LDKPreCalculatedTxCreationKeys this_arg_conv;
10524 this_arg_conv.inner = (void*)(this_arg & (~1));
10525 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10526 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10527 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10532 LDKChannelPublicKeys this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10535 ChannelPublicKeys_free(this_ptr_conv);
10538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10539 LDKChannelPublicKeys orig_conv;
10540 orig_conv.inner = (void*)(orig & (~1));
10541 orig_conv.is_owned = (orig & 1) || (orig == 0);
10542 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10543 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10546 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10547 LDKChannelPublicKeys 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10556 LDKChannelPublicKeys this_ptr_conv;
10557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10559 LDKPublicKey val_ref;
10560 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10561 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10562 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10565 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10566 LDKChannelPublicKeys this_ptr_conv;
10567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10569 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10570 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10575 LDKChannelPublicKeys this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10578 LDKPublicKey val_ref;
10579 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10580 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10581 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10584 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10585 LDKChannelPublicKeys this_ptr_conv;
10586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10588 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10589 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10594 LDKChannelPublicKeys this_ptr_conv;
10595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10597 LDKPublicKey val_ref;
10598 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10599 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10600 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10603 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10604 LDKChannelPublicKeys this_ptr_conv;
10605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10607 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10608 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10613 LDKChannelPublicKeys this_ptr_conv;
10614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10616 LDKPublicKey val_ref;
10617 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10618 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10619 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10622 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10623 LDKChannelPublicKeys this_ptr_conv;
10624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10626 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10627 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10632 LDKChannelPublicKeys this_ptr_conv;
10633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10635 LDKPublicKey val_ref;
10636 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10637 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10638 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10641 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) {
10642 LDKPublicKey funding_pubkey_arg_ref;
10643 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
10644 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10645 LDKPublicKey revocation_basepoint_arg_ref;
10646 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
10647 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10648 LDKPublicKey payment_point_arg_ref;
10649 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
10650 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10651 LDKPublicKey delayed_payment_basepoint_arg_ref;
10652 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
10653 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10654 LDKPublicKey htlc_basepoint_arg_ref;
10655 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
10656 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10657 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);
10658 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10662 LDKChannelPublicKeys obj_conv;
10663 obj_conv.inner = (void*)(obj & (~1));
10664 obj_conv.is_owned = (obj & 1) || (obj == 0);
10665 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10666 *ret = ChannelPublicKeys_write(&obj_conv);
10670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10671 LDKu8slice ser_ref;
10672 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10673 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10674 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
10675 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10676 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10679 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) {
10680 LDKPublicKey per_commitment_point_ref;
10681 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10682 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10683 LDKPublicKey broadcaster_delayed_payment_base_ref;
10684 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
10685 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10686 LDKPublicKey broadcaster_htlc_base_ref;
10687 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
10688 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10689 LDKPublicKey countersignatory_revocation_base_ref;
10690 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
10691 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10692 LDKPublicKey countersignatory_htlc_base_ref;
10693 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
10694 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10695 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10696 *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);
10700 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) {
10701 LDKPublicKey revocation_key_ref;
10702 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10703 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10704 LDKPublicKey broadcaster_delayed_payment_key_ref;
10705 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10706 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10707 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10708 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10713 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_free(this_ptr_conv);
10719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10720 LDKHTLCOutputInCommitment orig_conv;
10721 orig_conv.inner = (void*)(orig & (~1));
10722 orig_conv.is_owned = (orig & 1) || (orig == 0);
10723 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10724 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10728 LDKHTLCOutputInCommitment this_ptr_conv;
10729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10731 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10736 LDKHTLCOutputInCommitment this_ptr_conv;
10737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10739 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10743 LDKHTLCOutputInCommitment this_ptr_conv;
10744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10746 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10751 LDKHTLCOutputInCommitment this_ptr_conv;
10752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10754 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10757 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10758 LDKHTLCOutputInCommitment this_ptr_conv;
10759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10761 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10766 LDKHTLCOutputInCommitment this_ptr_conv;
10767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10769 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10772 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10773 LDKHTLCOutputInCommitment this_ptr_conv;
10774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10776 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10777 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10782 LDKHTLCOutputInCommitment this_ptr_conv;
10783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10785 LDKThirtyTwoBytes val_ref;
10786 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10787 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10788 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10792 LDKHTLCOutputInCommitment obj_conv;
10793 obj_conv.inner = (void*)(obj & (~1));
10794 obj_conv.is_owned = (obj & 1) || (obj == 0);
10795 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10796 *ret = HTLCOutputInCommitment_write(&obj_conv);
10800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10801 LDKu8slice ser_ref;
10802 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10803 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10804 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
10805 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10806 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10810 LDKHTLCOutputInCommitment htlc_conv;
10811 htlc_conv.inner = (void*)(htlc & (~1));
10812 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10813 LDKTxCreationKeys keys_conv;
10814 keys_conv.inner = (void*)(keys & (~1));
10815 keys_conv.is_owned = (keys & 1) || (keys == 0);
10816 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10817 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10822 LDKPublicKey broadcaster_ref;
10823 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
10824 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10825 LDKPublicKey countersignatory_ref;
10826 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
10827 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10828 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10829 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10833 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) {
10834 unsigned char prev_hash_arr[32];
10835 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
10836 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10837 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10838 LDKHTLCOutputInCommitment htlc_conv;
10839 htlc_conv.inner = (void*)(htlc & (~1));
10840 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10841 LDKPublicKey broadcaster_delayed_payment_key_ref;
10842 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10843 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10844 LDKPublicKey revocation_key_ref;
10845 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10846 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10847 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10848 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10853 LDKHolderCommitmentTransaction this_ptr_conv;
10854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10856 HolderCommitmentTransaction_free(this_ptr_conv);
10859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10860 LDKHolderCommitmentTransaction orig_conv;
10861 orig_conv.inner = (void*)(orig & (~1));
10862 orig_conv.is_owned = (orig & 1) || (orig == 0);
10863 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10864 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10868 LDKHolderCommitmentTransaction this_ptr_conv;
10869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10871 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10872 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10877 LDKHolderCommitmentTransaction this_ptr_conv;
10878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10880 LDKTransaction val_conv = *(LDKTransaction*)val;
10882 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10885 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10886 LDKHolderCommitmentTransaction this_ptr_conv;
10887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
10894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10895 LDKHolderCommitmentTransaction this_ptr_conv;
10896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10898 LDKSignature val_ref;
10899 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10900 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10901 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
10904 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10905 LDKHolderCommitmentTransaction this_ptr_conv;
10906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10908 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10913 LDKHolderCommitmentTransaction 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 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10920 LDKHolderCommitmentTransaction 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 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10925 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
10928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
10929 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
10930 FREE((void*)unsigned_tx);
10931 LDKSignature counterparty_sig_ref;
10932 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
10933 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
10934 LDKPublicKey holder_funding_key_ref;
10935 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
10936 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
10937 LDKPublicKey counterparty_funding_key_ref;
10938 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
10939 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
10940 LDKTxCreationKeys keys_conv;
10941 keys_conv.inner = (void*)(keys & (~1));
10942 keys_conv.is_owned = (keys & 1) || (keys == 0);
10943 if (keys_conv.inner != NULL)
10944 keys_conv = TxCreationKeys_clone(&keys_conv);
10945 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
10946 FREE((void*)htlc_data);
10947 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_conv);
10948 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10952 LDKHolderCommitmentTransaction this_arg_conv;
10953 this_arg_conv.inner = (void*)(this_arg & (~1));
10954 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10955 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10956 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10959 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10960 LDKHolderCommitmentTransaction this_arg_conv;
10961 this_arg_conv.inner = (void*)(this_arg & (~1));
10962 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10963 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10964 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10968 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jbyteArray funding_redeemscript, jlong channel_value_satoshis) {
10969 LDKHolderCommitmentTransaction this_arg_conv;
10970 this_arg_conv.inner = (void*)(this_arg & (~1));
10971 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10972 unsigned char funding_key_arr[32];
10973 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
10974 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10975 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10976 LDKu8slice funding_redeemscript_ref;
10977 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
10978 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
10979 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10980 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
10981 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
10985 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) {
10986 LDKHolderCommitmentTransaction this_arg_conv;
10987 this_arg_conv.inner = (void*)(this_arg & (~1));
10988 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10989 unsigned char htlc_base_key_arr[32];
10990 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
10991 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10992 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10993 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10994 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10999 LDKHolderCommitmentTransaction obj_conv;
11000 obj_conv.inner = (void*)(obj & (~1));
11001 obj_conv.is_owned = (obj & 1) || (obj == 0);
11002 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11003 *ret = HolderCommitmentTransaction_write(&obj_conv);
11007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11008 LDKu8slice ser_ref;
11009 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11010 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11011 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
11012 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11013 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11017 LDKInitFeatures this_ptr_conv;
11018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11020 InitFeatures_free(this_ptr_conv);
11023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11024 LDKNodeFeatures this_ptr_conv;
11025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11027 NodeFeatures_free(this_ptr_conv);
11030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11031 LDKChannelFeatures this_ptr_conv;
11032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11034 ChannelFeatures_free(this_ptr_conv);
11037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11038 LDKRouteHop this_ptr_conv;
11039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11041 RouteHop_free(this_ptr_conv);
11044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11045 LDKRouteHop orig_conv;
11046 orig_conv.inner = (void*)(orig & (~1));
11047 orig_conv.is_owned = (orig & 1) || (orig == 0);
11048 LDKRouteHop ret = RouteHop_clone(&orig_conv);
11049 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11052 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11053 LDKRouteHop this_ptr_conv;
11054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11056 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11057 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
11061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11062 LDKRouteHop this_ptr_conv;
11063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11065 LDKPublicKey val_ref;
11066 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11067 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11068 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
11071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11072 LDKRouteHop this_ptr_conv;
11073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11075 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
11076 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11080 LDKRouteHop this_ptr_conv;
11081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11083 LDKNodeFeatures val_conv;
11084 val_conv.inner = (void*)(val & (~1));
11085 val_conv.is_owned = (val & 1) || (val == 0);
11086 // Warning: we may need a move here but can't clone!
11087 RouteHop_set_node_features(&this_ptr_conv, val_conv);
11090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11091 LDKRouteHop this_ptr_conv;
11092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11094 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
11098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11099 LDKRouteHop this_ptr_conv;
11100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11102 RouteHop_set_short_channel_id(&this_ptr_conv, val);
11105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11106 LDKRouteHop this_ptr_conv;
11107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11109 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
11110 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11114 LDKRouteHop this_ptr_conv;
11115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11117 LDKChannelFeatures val_conv;
11118 val_conv.inner = (void*)(val & (~1));
11119 val_conv.is_owned = (val & 1) || (val == 0);
11120 // Warning: we may need a move here but can't clone!
11121 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
11124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11125 LDKRouteHop this_ptr_conv;
11126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11128 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
11132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11133 LDKRouteHop this_ptr_conv;
11134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11136 RouteHop_set_fee_msat(&this_ptr_conv, val);
11139 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11140 LDKRouteHop this_ptr_conv;
11141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11143 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
11147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11148 LDKRouteHop this_ptr_conv;
11149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11151 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
11154 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) {
11155 LDKPublicKey pubkey_arg_ref;
11156 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
11157 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
11158 LDKNodeFeatures node_features_arg_conv;
11159 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
11160 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
11161 // Warning: we may need a move here but can't clone!
11162 LDKChannelFeatures channel_features_arg_conv;
11163 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
11164 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
11165 // Warning: we may need a move here but can't clone!
11166 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);
11167 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11171 LDKRoute this_ptr_conv;
11172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11174 Route_free(this_ptr_conv);
11177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11178 LDKRoute orig_conv;
11179 orig_conv.inner = (void*)(orig & (~1));
11180 orig_conv.is_owned = (orig & 1) || (orig == 0);
11181 LDKRoute ret = Route_clone(&orig_conv);
11182 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11186 LDKRoute this_ptr_conv;
11187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11189 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
11191 Route_set_paths(&this_ptr_conv, val_conv);
11194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
11195 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
11196 FREE((void*)paths_arg);
11197 LDKRoute ret = Route_new(paths_arg_conv);
11198 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
11203 obj_conv.inner = (void*)(obj & (~1));
11204 obj_conv.is_owned = (obj & 1) || (obj == 0);
11205 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11206 *ret = Route_write(&obj_conv);
11210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11211 LDKu8slice ser_ref;
11212 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11213 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11214 LDKRoute ret = Route_read(ser_ref);
11215 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11216 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11220 LDKRouteHint this_ptr_conv;
11221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11223 RouteHint_free(this_ptr_conv);
11226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11227 LDKRouteHint orig_conv;
11228 orig_conv.inner = (void*)(orig & (~1));
11229 orig_conv.is_owned = (orig & 1) || (orig == 0);
11230 LDKRouteHint ret = RouteHint_clone(&orig_conv);
11231 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11234 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11235 LDKRouteHint this_ptr_conv;
11236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11238 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11239 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
11243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11244 LDKRouteHint this_ptr_conv;
11245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11247 LDKPublicKey val_ref;
11248 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11249 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11250 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
11253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11254 LDKRouteHint this_ptr_conv;
11255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11257 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
11261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11262 LDKRouteHint this_ptr_conv;
11263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11265 RouteHint_set_short_channel_id(&this_ptr_conv, val);
11268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11269 LDKRouteHint this_ptr_conv;
11270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11272 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
11273 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11277 LDKRouteHint this_ptr_conv;
11278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11280 LDKRoutingFees val_conv;
11281 val_conv.inner = (void*)(val & (~1));
11282 val_conv.is_owned = (val & 1) || (val == 0);
11283 if (val_conv.inner != NULL)
11284 val_conv = RoutingFees_clone(&val_conv);
11285 RouteHint_set_fees(&this_ptr_conv, val_conv);
11288 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11289 LDKRouteHint this_ptr_conv;
11290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11292 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
11296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11297 LDKRouteHint this_ptr_conv;
11298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11300 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
11303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11304 LDKRouteHint 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 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
11311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11312 LDKRouteHint 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 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
11318 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) {
11319 LDKPublicKey src_node_id_arg_ref;
11320 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
11321 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
11322 LDKRoutingFees fees_arg_conv;
11323 fees_arg_conv.inner = (void*)(fees_arg & (~1));
11324 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
11325 if (fees_arg_conv.inner != NULL)
11326 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
11327 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
11328 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11331 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) {
11332 LDKPublicKey our_node_id_ref;
11333 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
11334 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
11335 LDKNetworkGraph network_conv;
11336 network_conv.inner = (void*)(network & (~1));
11337 network_conv.is_owned = (network & 1) || (network == 0);
11338 LDKPublicKey target_ref;
11339 CHECK((*_env)->GetArrayLength (_env, target) == 33);
11340 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
11341 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
11342 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
11343 FREE((void*)last_hops);
11344 LDKLogger logger_conv = *(LDKLogger*)logger;
11345 if (logger_conv.free == LDKLogger_JCalls_free) {
11346 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11347 LDKLogger_JCalls_clone(logger_conv.this_arg);
11349 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11350 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
11354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11355 LDKNetworkGraph this_ptr_conv;
11356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11358 NetworkGraph_free(this_ptr_conv);
11361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11362 LDKLockedNetworkGraph this_ptr_conv;
11363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11365 LockedNetworkGraph_free(this_ptr_conv);
11368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11369 LDKNetGraphMsgHandler this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11372 NetGraphMsgHandler_free(this_ptr_conv);
11375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
11376 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11377 LDKLogger logger_conv = *(LDKLogger*)logger;
11378 if (logger_conv.free == LDKLogger_JCalls_free) {
11379 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11380 LDKLogger_JCalls_clone(logger_conv.this_arg);
11382 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
11383 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
11387 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11388 LDKLogger logger_conv = *(LDKLogger*)logger;
11389 if (logger_conv.free == LDKLogger_JCalls_free) {
11390 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11391 LDKLogger_JCalls_clone(logger_conv.this_arg);
11393 LDKNetworkGraph network_graph_conv;
11394 network_graph_conv.inner = (void*)(network_graph & (~1));
11395 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
11396 // Warning: we may need a move here but can't clone!
11397 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
11398 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11402 LDKNetGraphMsgHandler this_arg_conv;
11403 this_arg_conv.inner = (void*)(this_arg & (~1));
11404 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11405 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
11406 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11410 LDKLockedNetworkGraph this_arg_conv;
11411 this_arg_conv.inner = (void*)(this_arg & (~1));
11412 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11413 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
11414 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
11418 LDKNetGraphMsgHandler this_arg_conv;
11419 this_arg_conv.inner = (void*)(this_arg & (~1));
11420 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11421 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11422 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
11426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11427 LDKDirectionalChannelInfo this_ptr_conv;
11428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11430 DirectionalChannelInfo_free(this_ptr_conv);
11433 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11434 LDKDirectionalChannelInfo this_ptr_conv;
11435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11437 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
11441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11442 LDKDirectionalChannelInfo this_ptr_conv;
11443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11445 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
11448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
11449 LDKDirectionalChannelInfo this_ptr_conv;
11450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11452 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
11456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11457 LDKDirectionalChannelInfo this_ptr_conv;
11458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11460 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
11463 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11464 LDKDirectionalChannelInfo this_ptr_conv;
11465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11467 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
11471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11472 LDKDirectionalChannelInfo this_ptr_conv;
11473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11475 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
11478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11479 LDKDirectionalChannelInfo this_ptr_conv;
11480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11482 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
11486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11487 LDKDirectionalChannelInfo this_ptr_conv;
11488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11490 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
11493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11494 LDKDirectionalChannelInfo this_ptr_conv;
11495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11497 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
11498 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11502 LDKDirectionalChannelInfo this_ptr_conv;
11503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11505 LDKChannelUpdate val_conv;
11506 val_conv.inner = (void*)(val & (~1));
11507 val_conv.is_owned = (val & 1) || (val == 0);
11508 if (val_conv.inner != NULL)
11509 val_conv = ChannelUpdate_clone(&val_conv);
11510 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
11513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11514 LDKDirectionalChannelInfo obj_conv;
11515 obj_conv.inner = (void*)(obj & (~1));
11516 obj_conv.is_owned = (obj & 1) || (obj == 0);
11517 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11518 *ret = DirectionalChannelInfo_write(&obj_conv);
11522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11523 LDKu8slice ser_ref;
11524 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11525 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11526 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
11527 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11528 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11532 LDKChannelInfo this_ptr_conv;
11533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11535 ChannelInfo_free(this_ptr_conv);
11538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11539 LDKChannelInfo this_ptr_conv;
11540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11542 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
11543 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11547 LDKChannelInfo this_ptr_conv;
11548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11550 LDKChannelFeatures val_conv;
11551 val_conv.inner = (void*)(val & (~1));
11552 val_conv.is_owned = (val & 1) || (val == 0);
11553 // Warning: we may need a move here but can't clone!
11554 ChannelInfo_set_features(&this_ptr_conv, val_conv);
11557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11558 LDKChannelInfo this_ptr_conv;
11559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
11566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11567 LDKChannelInfo this_ptr_conv;
11568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11570 LDKPublicKey val_ref;
11571 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11572 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11573 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
11576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11577 LDKChannelInfo this_ptr_conv;
11578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11580 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
11581 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11585 LDKChannelInfo this_ptr_conv;
11586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11588 LDKDirectionalChannelInfo val_conv;
11589 val_conv.inner = (void*)(val & (~1));
11590 val_conv.is_owned = (val & 1) || (val == 0);
11591 // Warning: we may need a move here but can't clone!
11592 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11596 LDKChannelInfo this_ptr_conv;
11597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11605 LDKChannelInfo this_ptr_conv;
11606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11608 LDKPublicKey val_ref;
11609 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11610 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11611 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11615 LDKChannelInfo this_ptr_conv;
11616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11618 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11619 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11623 LDKChannelInfo this_ptr_conv;
11624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11626 LDKDirectionalChannelInfo val_conv;
11627 val_conv.inner = (void*)(val & (~1));
11628 val_conv.is_owned = (val & 1) || (val == 0);
11629 // Warning: we may need a move here but can't clone!
11630 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11634 LDKChannelInfo this_ptr_conv;
11635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11637 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11638 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11642 LDKChannelInfo this_ptr_conv;
11643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11644 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11645 LDKChannelAnnouncement val_conv;
11646 val_conv.inner = (void*)(val & (~1));
11647 val_conv.is_owned = (val & 1) || (val == 0);
11648 if (val_conv.inner != NULL)
11649 val_conv = ChannelAnnouncement_clone(&val_conv);
11650 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11654 LDKChannelInfo obj_conv;
11655 obj_conv.inner = (void*)(obj & (~1));
11656 obj_conv.is_owned = (obj & 1) || (obj == 0);
11657 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11658 *ret = ChannelInfo_write(&obj_conv);
11662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11663 LDKu8slice ser_ref;
11664 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11665 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11666 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
11667 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11668 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11672 LDKRoutingFees this_ptr_conv;
11673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11675 RoutingFees_free(this_ptr_conv);
11678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11679 LDKRoutingFees orig_conv;
11680 orig_conv.inner = (void*)(orig & (~1));
11681 orig_conv.is_owned = (orig & 1) || (orig == 0);
11682 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11683 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11686 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11687 LDKRoutingFees this_ptr_conv;
11688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11690 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
11694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11695 LDKRoutingFees this_ptr_conv;
11696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11698 RoutingFees_set_base_msat(&this_ptr_conv, val);
11701 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11702 LDKRoutingFees this_ptr_conv;
11703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11705 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
11709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11710 LDKRoutingFees this_ptr_conv;
11711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11713 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11717 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11718 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11722 LDKu8slice ser_ref;
11723 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11724 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11725 LDKRoutingFees ret = RoutingFees_read(ser_ref);
11726 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11727 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11731 LDKRoutingFees obj_conv;
11732 obj_conv.inner = (void*)(obj & (~1));
11733 obj_conv.is_owned = (obj & 1) || (obj == 0);
11734 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11735 *ret = RoutingFees_write(&obj_conv);
11739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11740 LDKNodeAnnouncementInfo this_ptr_conv;
11741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11743 NodeAnnouncementInfo_free(this_ptr_conv);
11746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11747 LDKNodeAnnouncementInfo this_ptr_conv;
11748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11750 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11751 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11755 LDKNodeAnnouncementInfo this_ptr_conv;
11756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11758 LDKNodeFeatures val_conv;
11759 val_conv.inner = (void*)(val & (~1));
11760 val_conv.is_owned = (val & 1) || (val == 0);
11761 // Warning: we may need a move here but can't clone!
11762 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11765 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11766 LDKNodeAnnouncementInfo this_ptr_conv;
11767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11769 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11774 LDKNodeAnnouncementInfo this_ptr_conv;
11775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11777 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11781 LDKNodeAnnouncementInfo this_ptr_conv;
11782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11784 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11785 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11790 LDKNodeAnnouncementInfo this_ptr_conv;
11791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11793 LDKThreeBytes val_ref;
11794 CHECK((*_env)->GetArrayLength (_env, val) == 3);
11795 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
11796 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
11799 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11800 LDKNodeAnnouncementInfo this_ptr_conv;
11801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11803 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11804 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11809 LDKNodeAnnouncementInfo this_ptr_conv;
11810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11812 LDKThirtyTwoBytes val_ref;
11813 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11814 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11815 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11819 LDKNodeAnnouncementInfo this_ptr_conv;
11820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11822 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11824 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11828 LDKNodeAnnouncementInfo this_ptr_conv;
11829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11831 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11832 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11836 LDKNodeAnnouncementInfo this_ptr_conv;
11837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11839 LDKNodeAnnouncement val_conv;
11840 val_conv.inner = (void*)(val & (~1));
11841 val_conv.is_owned = (val & 1) || (val == 0);
11842 if (val_conv.inner != NULL)
11843 val_conv = NodeAnnouncement_clone(&val_conv);
11844 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jbyteArray rgb_arg, jbyteArray alias_arg, jlong addresses_arg, jlong announcement_message_arg) {
11848 LDKNodeFeatures features_arg_conv;
11849 features_arg_conv.inner = (void*)(features_arg & (~1));
11850 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11851 // Warning: we may need a move here but can't clone!
11852 LDKThreeBytes rgb_arg_ref;
11853 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
11854 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
11855 LDKThirtyTwoBytes alias_arg_ref;
11856 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
11857 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11858 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11859 FREE((void*)addresses_arg);
11860 LDKNodeAnnouncement announcement_message_arg_conv;
11861 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11862 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11863 if (announcement_message_arg_conv.inner != NULL)
11864 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11865 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11866 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11870 LDKNodeAnnouncementInfo obj_conv;
11871 obj_conv.inner = (void*)(obj & (~1));
11872 obj_conv.is_owned = (obj & 1) || (obj == 0);
11873 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11874 *ret = NodeAnnouncementInfo_write(&obj_conv);
11878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11879 LDKu8slice ser_ref;
11880 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11881 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11882 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
11883 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11884 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11888 LDKNodeInfo this_ptr_conv;
11889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11891 NodeInfo_free(this_ptr_conv);
11894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11895 LDKNodeInfo this_ptr_conv;
11896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11898 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11900 NodeInfo_set_channels(&this_ptr_conv, val_conv);
11903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11904 LDKNodeInfo this_ptr_conv;
11905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11907 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11908 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11912 LDKNodeInfo this_ptr_conv;
11913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11915 LDKRoutingFees val_conv;
11916 val_conv.inner = (void*)(val & (~1));
11917 val_conv.is_owned = (val & 1) || (val == 0);
11918 if (val_conv.inner != NULL)
11919 val_conv = RoutingFees_clone(&val_conv);
11920 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
11923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
11924 LDKNodeInfo this_ptr_conv;
11925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11927 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
11928 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11932 LDKNodeInfo this_ptr_conv;
11933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11935 LDKNodeAnnouncementInfo val_conv;
11936 val_conv.inner = (void*)(val & (~1));
11937 val_conv.is_owned = (val & 1) || (val == 0);
11938 // Warning: we may need a move here but can't clone!
11939 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
11942 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) {
11943 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
11944 FREE((void*)channels_arg);
11945 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
11946 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
11947 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
11948 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
11949 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
11950 LDKNodeAnnouncementInfo announcement_info_arg_conv;
11951 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
11952 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
11953 // Warning: we may need a move here but can't clone!
11954 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
11955 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11959 LDKNodeInfo obj_conv;
11960 obj_conv.inner = (void*)(obj & (~1));
11961 obj_conv.is_owned = (obj & 1) || (obj == 0);
11962 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11963 *ret = NodeInfo_write(&obj_conv);
11967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11968 LDKu8slice ser_ref;
11969 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11970 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11971 LDKNodeInfo ret = NodeInfo_read(ser_ref);
11972 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11973 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
11977 LDKNetworkGraph obj_conv;
11978 obj_conv.inner = (void*)(obj & (~1));
11979 obj_conv.is_owned = (obj & 1) || (obj == 0);
11980 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11981 *ret = NetworkGraph_write(&obj_conv);
11985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11986 LDKu8slice ser_ref;
11987 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11988 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11989 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
11990 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11991 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
11995 LDKNetworkGraph ret = NetworkGraph_new();
11996 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11999 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) {
12000 LDKNetworkGraph this_arg_conv;
12001 this_arg_conv.inner = (void*)(this_arg & (~1));
12002 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12003 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);